ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

List source members from a source physical file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • List source members from a source physical file

    Hello there, here goes a beginner's question

    If I want to list all the programs that start with the string XYZ from a library, to an outfile, I do the following command:

    DSPOBJD OBJ(MYLIB/XYZ*) OBJTYPE(*PGM) OUTPUT(*OUTFILE) OUTFILE(QTEMP/TEST)

    What I need is the same thing, but for the source members of a source physical file, e.g. all the sources that starts with the XYZ string from a QRPGSRC. I stumbled across the following command:

    DSPFD FILE(MYLIB/QRPGSRC) TYPE(*MBRLIST) OUTPUT(*OUTFILE) OUTFILE(QTEMP/TEST)

    It lists all the source members from MYLIB/QRPGSRC, I could then do a RPG to select the ones which start with XYZ. The problem is, this way is too slow! I have source physical files that contains up to 10000 sources. So my question is: Is there a faster way to do this? Faster as the DSPOBJD command?

    Hope I was clear enough.

  • #2
    Re: List source members from a source physical file

    you could use DSPOBJD and then read the file and use SQL to query SYSPSTAT for the members
    Code:
    SELECT * FROM syspstat WHERE TABLE_NAME ='QRPGLESRC' and 
    TABLE_SCHEMA = 'TTLIB'
    i believe that the DSPFD is your bottleneck not the DSPOBJD...
    I'm not anti-social, I just don't like people -Tommy Holden

    Comment


    • #3
      Re: List source members from a source physical file

      Hi Seko,

      I just wrote a little program which I think does what you're looking for. I just tested it and it works for me and is very quick. Let me know if you have any questions.

      Code:
           H DFTACTGRP(*NO) ACTGRP(*CALLER)
      
           FQRPGSRC   IF   E             Disk    ExtMbr('*ALL')
           F                                     Usropn
           F                                     Infds(Infds)
           F                                     Rename(QRPGSRC:SRCREC)
           FPGMDOC    UF A E           K Disk
      
           D INFDS           DS                  Qualified
           D  MEMBER               129    138
      
            /Free
      
             //-- Read and process the XYZ* source members
             Open(E) QRpgSrc;
             Read(E) SrcRec;
             Dow Not %Eof(QRpgSrc);
      
               If %subst(InfDS.member:1:3) = 'XYZ' ;
                 SRCNAM = InfDS.member;
                 Write IPGMDOC;
               EndIf;
      
               Read(E) SrcRec;
             EndDo;
      
             *inlr = *on;
             Return;
      
            /End-Free
      It reads through all the source members in QRPGSRC and selects only those that start with XYZ. Then it writes them to an outfile that I called PGMDOC.

      Here's the DDS source for PGMDOC:
      Code:
                      R IPGMDOC                                             
                                                                            
                        SRCNAM        10A         TEXT('Source Member Name')
                                                                            
                      K SRCNAM
      Obviously you can edit this just slightly and have it process QRPGLESRC or any other source file.
      Last edited by Viking; May 2, 2014, 10:16 AM.

      Comment


      • #4
        Re: List source members from a source physical file

        Using the System API QUSLMBR should be faster:
        Try something like this:
        Code:
         /If Defined (*CRTBNDRPG)                                                 
        H DFTACTGRP(*NO) ACTGRP(*NEW)                                             
         /EndIf                                                                   
         *------------------------------------------------------------------------
         * Prototypes / Reference Data Structures                                 
         *------------------------------------------------------------------------
         * Create User Space                                                      
        D QUSCRTUS        PR                  ExtPgm('QUSCRTUS')                  
        D   ParUSQual                         LikeDS(RefDSObjQual) Const          
        D   ParExtAttr                  10A                      Const            
        D   ParInitSize                 10I 0                    Const            
        D   ParInitVal                   1A                      Const            
        D   ParPublicAut                10A                      Const            
        D   ParDescript                 50A                      Const            
                                                                                  
        D   ParReplace                  10A   Options(*NoPass)   Const            
        D   ParErrDS                          LikeDS(RefDSErrCde)                 
        D                                     Options(*NoPass: *VarSize)          
                                                                                  
        D   ParDomain                   10A   Options(*NoPass)   Const            
                                                                                  
        D   ParTrSize                   10I 0 Options(*NoPass)   Const            
        D   ParOptSpcAlign...                                                     
        D                                1A   Options(*NoPass)   Const            
                                                                                  
         * Delete User Space                                                      
        D QUSDLTUS        PR                  ExtPgm('QUSDLTUS')                  
        D   ParUSQual                         LikeDS(RefDSObjQual) Const          
        D   ParErrDS                          LikeDS(RefDSErrCde)                 
        D                                     Options(*VarSize)                   
                                                                                  
        D   ParDomain                   10A   Options(*NoPass)   Const            
                                                                                  
        D   ParTrSize                   10I 0 Options(*NoPass)   Const            
        D   ParOptSpcAlign...                                                     
        D                                1A   Options(*NoPass)   Const            
                                                                                  
         * Retrieve Pointer To User Space                                         
        D QUSPTRUS        PR                  ExtPGM('QUSPTRUS')                  
        D   ParUSQual                         LikeDS(RefDSObjQual)  Const         
        D   ParUsPtr                      *                                       
        D   ParErrDS                          LikeDS(RefDSErrCde)                 
        D                                     Options(*NoPass: *VarSize)          
                                                                                  
         * QUSLMBR  - List Member                                                 
        D QUSLMBR         PR                  ExtPgm('QUSLMBR')                   
        D   ParUSQual                         LikeDS(RefDSObjQual)  Const         
        D   ParFormat                    8A                         Const         
        D   ParFileQual                       LikeDS(RefDSObjQual)  Const         
        D   ParMember                   10A                         Const         
        D   ParOvrProc                   1                          Const         
        D   ParErrDS                          LikeDS(RefDSErrCde)                 
        D                                     Options(*NoPass: *VarSize)          
         * Header Information                                                     
        D RefDSGenHdr100  DS                  Qualified Based(DummyPtr)           
        D   UserArea                    64A                                       
        D   SizeGenHdr                  10I 0                                     
        D   ReleaseLVL                   4A                                       
        D   Format                       8A                                       
        D   APIUsed                     10A                                       
        D   CrtDateTime                 13A                                       
        D   InfoSts                      1A                                       
        D   SizeUsrSpc                  10I 0                                     
        D   OffSetInput                 10I 0                                     
        D   SizeInput                   10I 0                                     
        D   OffSetHeader                10I 0                                     
        D   SizeHeader                  10I 0                                     
        D   OffSetData...                                                         
        D                               10I 0                                     
        D   SizeData                    10I 0                                     
        D   NbrListEntry                10I 0                                     
        D   SizeListEntry...                                                      
        D                               10I 0                                     
        D   CCSIDListEntry...                                                     
        D                               10I 0                                     
        D   Country                      2A                                       
        D   LangId                       3A                                       
        D   SubsetListInd...                                                      
        D                                1A                                       
        D   Reseved1                    42A                                       
                                                                                  
         * Data Structure Format MBRL0100                                         
        D RefDSMBRL0100   DS                  qualified based(DummyPtr)           
        D   Member                      10A                                       
                                                                                  
         * Data Structure Format MBRL0200                                         
        D RefDSMBRL0200   DS                  qualified based(DummyPtr)           
        D   Member                      10A                                       
        D   SourceType                  10A                                       
        D   CrtDate                     13A                                       
        D   UpdDate                     13A                                       
        D   TextDescr                   50A                                       
        D   CCSIDText                   10I 0                                     
                                                                                  
         * Qualified Object                                                       
        D RefDSObjQual    DS                  Qualified Based(DummyPtr)           
        D   Name                        10A                                       
        D   Lib                         10A                                       
                                                                                  
         * API ErrorDS                                                            
        D RefDSErrCde     DS                  Qualified                           
        D   ByteProv                    10I 0 inz(%Size(RefDSErrCde))             
        D   ByteAvail                   10I 0                                     
        D   MsgId                        7A                                       
        D   Reserved                     1A                                       
        D   ExceptData                 256A                                       
                                                                                  
         *------------------------------------------------------------------------
         * Global variables                                                       
         *------------------------------------------------------------------------
        D GblDSListHdr    DS                  LikeDS(RefDSGenHdr100)              
        D                                     Based(GblPtrDSGenHdr)               
                                                                                  
        D GblDSMBRL0200   DS                  LikeDS(RefDSMBRL0200)               
        D                                     Based(GblPtrDSMBRL0200)             
                                                                                  
        D GblDSErrCde     DS                  LikeDS(RefDSErrCde)   Inz(*LikeDS)  
                                                                                  
        D GblDSUsrSPc     DS                  Qualified                           
        D    Name                       10A   Inz('MBRLIST')                      
        D    Lib                        10A   Inz('QTEMP')                        
                                                                                  
        D GblDSFileQual   DS                  Qualified                           
        D    Name                       10A   Inz('QRPGSRC')                    
        D    Lib                        10A   Inz('YOURSCHEMA')                   
                                                                                  
        D GblText         S             50A                                       
        D GblIndex        S             10I 0                                     
                                                                                  
        D PGMSDS         SDS                    Qualified                         
        D    MsgTxt              91    140A                                       
         *------------------------------------------------------------------------
         /free                                                                    
           *INLR = *On;                                                           
                                                                                  
           Monitor;                                                               
             // Create and Fill User Space                                        
             QUSCRTUS(GblDSUsrSpc: *Blanks: 256: x'00': '*USE': 'Member List':    
                      '*YES': GblDSErrCde);                                       
             QUSLMBR(GblDSUsrSpc: 'MBRL0200': GblDSFileQual: '*ALL':              
                     *Zeros: GblDSErrCde);                                        
                                                                                  
             QUSPTRUS(GblDSUsrSPc: GblPtrDSGenHdr: GblDSErrCde);                  
                                                                                  
             //Loop through the call stack entries returned in the receiver Variab
             For GblIndex = 1 to GblDSListHdr.NbrListEntry;                       
                                                                                  
                 //Read Callstack entries                                         
                 If GblIndex = 1;                                                 
                    GblPtrDSMBRL0200  = GblPtrDSGenHdr + GblDSListHdr.OffsetData; 
                 else;                                                            
                    GblPtrDSMBRL0200 += GblDSListHdr.SizeListEntry;               
                 endif;       
                      
                 if %Subst(GblDSMbrL0200.Member: 1: 3) <> 'XYZ';
                    iter;
                 EndIf;                                     
                                                                                  
                 //Do whatever you want with the found member                                          
             EndFor;                                                              
                                                                                  
             QUSDLTUS(GblDSUsrSpc: GblDSErrCde);    //Delete user space                                  
                                                                                  
             On-Error;                                                            
                CallP(E) QUSDLTUS(GblDSUsrSpc: GblDSErrCde);                      
                Dsply PGMSDS.MsgTxt;                                              
             EndMon;                                                              
                                                                                  
             return;                                                              
         /end-free
        Last edited by B.Hauser; May 2, 2014, 01:17 PM.

        Comment


        • #5
          Re: List source members from a source physical file

          Originally posted by Seko1987_MAD
          The problem is, this way is too slow! I have source physical files that contains up to 10000 sources. So my question is: Is there a faster way to do this? Faster as the DSPOBJD command?
          It's hard to say without knowing what "way too slow" means. Trying to process sets of files with up to 10000 members is going to be (relatively) slow. That's generally too many members for almost any file if decent performance is needed.

          It's also hard to say without knowing what data is needed for each member. If the name is really all that's needed, the time can probably be cut down to maybe a third by not using DSPFD at all and replacing it with the List Database File Members (QUSLMBR) API specifying format MBRL0100. (More detailed formats take more time.)

          You could use the SYSIBM/SYSPSTAT view, but I'd expect it to be slower than the API and possibly slower than what you're already using. And reading every source record in every member seems likely slower than just retrieving the member names alone.
          Tom

          There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

          Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

          Comment


          • #6
            Re: List source members from a source physical file

            Ah you're right. Now that I've eaten lunch and see these comments, I realize that of course you're right that reading all the records in each member is not necessary or desirable. And my example will duplicate the names in the output file for every line and of course that's not good. Never mind. :-)

            Yes, just processing the member names is what you want.
            Last edited by Viking; May 2, 2014, 02:39 PM.

            Comment


            • #7
              Re: List source members from a source physical file

              I'm sure QUSLMBR will be faster than DSPFD... but probably only by a small amount. (The time it takes to create a PF and write 10000 rows... maybe a second or so?)

              I'm curious if it would really make a big difference?
              Last edited by Scott Klement; May 6, 2014, 08:44 PM.

              Comment


              • #8
                Re: List source members from a source physical file

                Times varied significantly in multiple tests, depending on whether the functions had run multiple times, whether temporary objects already existed, whether other jobs were accessing the same source file, etc. Some elements likely become memory-resident after multiple runs. I had the machine to myself.

                I ran on an older 170 at V5R3. I didn't have source files with 10000 members. In one variation, I had multiple files with a total of 3407 members, and I took a little effort to create a new source file that got up to 2945 members. It didn't make much difference; the API was significantly (often dramatically) the better performer with as much as a 40:1 speed benefit. A 3:1 benefit seems a reasonable expectation.

                Running interactively against the single large source file, DSPFD would take anywhere from 40 secs up to a minute. The API never took as much as two full seconds.

                I used a slightly modified version of a CL procedure that I created once to give a list of all of my source members in a library. It's just an old proc for personal use, but it was close to what was needed. All it does is build a file of members using DSPFD *MBRLIST. It doesn't do any selection of "XYZ*".
                Code:
                pgm    ( +
                         &ProdLib     +
                       )
                
                   dcl   &ProdLib     *char    10
                
                
                   dcl   &qusrspc     *char    20
                   dcl   &qobj        *char    20
                
                   dcl   &F           *char    10
                
                /* This is a general-purpose field to hold objlst data...           */
                   dcl   &us_hdr      *char   150   /* Space header      */
                   dcl   &us_obje     *char   108   /* A single entry    */
                
                   dcl   &us_exatr    *char    10
                
                /* General fields for *usrspc header...                             */
                   dcl   &offslst     *int
                   dcl   &nbrlste     *int
                   dcl   &sizlste     *int
                
                   dcl   &i           *int
                
                   dcl   &qtime1      *char     9
                   dcl   &qtime2      *char     9
                
                
                   chgvar        &qusrspc        ( &ProdLib *cat 'QTEMP' )
                
                   call    QUSCRTUS   ( +
                                        &qusrspc                +
                                        'TMPLST    '            +
                                        x'00001000'             +
                                        X'00'                   +
                                        '*ALL      '            +
                                        'Temp list files        ' +
                                        '*YES      '            +
                                        x'0000000000000000'     +
                                      )
                
                   chgvar          &qobj            ( '*ALL      ' *cat &ProdLib )
                
                   call    QUSLOBJ    ( +
                                        &qusrspc                +
                                        'OBJL0200'              +
                                        &qobj                   +
                                        '*FILE     '            +
                                        x'0000000000000000'     +
                                      )
                
                /*  Retrieve the initialization data...                             */
                
                   call    QUSRTVUS   ( +
                                        &qusrspc                +
                                        x'00000001'             +
                                        x'00000096'             +
                                        &us_hdr                 +
                                      )
                
                   chgvar          &offslst     %bin( &us_hdr    125 4 )
                   chgvar          &nbrlste     %bin( &us_hdr    133 4 )
                   chgvar          &sizlste     %bin( &us_hdr    137 4 )
                
                
                   if ( &nbrlste *eq 0 )     do
                      sndpgmmsg  msgid( CPF9898 ) msgf( QCPFMSG ) +
                                   msgdta( 'No *FILE objects listed' )
                      goto   Clean_up
                   enddo
                
                /* Set the offset to the list within the space...            */
                
                   chgvar          &offslst         ( &offslst + 1 )
                
                /*------------------------------------------------------------------*/
                /* Entries have been placed in the *usrspc for every file in the    */
                /*  named lib. We can now loop through to list the members from     */
                /*  each listed file...                                             */
                
                /* Start retrieval of *FILE entries from the *usrspc...             */
                
                   rtvsysval   QTIME  rtnvar( &qtime1 )
                
                 Nxt_F:
                
                   dofor   &i  from( 1 ) to( &nbrlste )
                
                      call    QUSRTVUS   ( +
                                           &qusrspc                +
                                           &offslst                +
                                           &sizlste                +
                                           &us_obje                +
                                         )
                
                   /* Extract obj info from list entry...                       */
                
                      chgvar       &us_exatr    %sst( &us_obje    32  10 )
                
                
                   /*  Is it a physical file?                                          */
                
                      if ( &us_exatr *eq 'PF' )  do
                
                         chgvar    &F           %sst( &us_obje     1  10 )
                         dspfd     &ProdLib/&F  type( *MBRLIST ) +
                                     output( *OUTFILE ) outfile( QTEMP/FMBRS ) +
                                     outmbr( *FIRST *ADD )
                
                      enddo
                
                
                      chgvar       &offslst         ( &offslst + &sizlste )
                
                   enddo
                
                
                Clean_up:
                
                   rtvsysval   QTIME  rtnvar( &qtime2 )
                
                   sndpgmmsg   ( 'Times:  ' *cat &qtime1 *bcat &qtime2 )
                
                   return
                
                endpgm
                It has a single argument, a *CHAR (10) for a library name. I created my "large" source file in a new library in order to isolate the timing. Timing is done at a very limited section of the program.

                The same code was used for the API test, except the inner loop had this code in place:
                Code:
                   dcl   &qusrspc2    *char    20
                
                
                   /*  Is it a physical file?                                          */
                
                      if ( &us_exatr *eq 'PF' )  do
                
                         chgvar    &F           %sst( &us_obje     1  10 )
                
                         chgvar  &qusrspc2       ( &F       *cat 'QTEMP' )
                
                         call    QUSCRTUS   ( +
                                              &qusrspc2               +
                                              'TMPLST    '            +
                                              x'00001000'             +
                                              X'00'                   +
                                              '*ALL      '            +
                                              'Temp list mbrs         ' +
                                              '*YES      '            +
                                              x'0000000000000000'     +
                                            )
                
                         chgvar    &qobj            ( &F *cat &ProdLib )
                
                         call    QUSLMBR    ( +
                                              &qusrspc2               +
                                              'MBRL0100'              +
                                              &qobj                   +
                                              '*ALL      '            +
                                              '0'                     +
                                              x'0000000000000000'     +
                                            )
                
                
                      enddo
                The DCL for &qusrspc2 was also added at the top.

                It's not particularly scientific. But when I get as much as 40:1 speed advantages on simple specific tests and every general variation I can think of gives at least significant advantage, I didn't see much point in going farther.

                Now, going to the next step would make a little added difference. Running a SELECT statement over the output file vs. running a loop over the names in the space should be done. I don't know if it'd be best to generate a blocked INSERT over an array positioned on the space or if direct selection from the space is needed. For me, I don't have a good reason to convert space entries into a table. (Birgitta's article on UDFs in developerWorks seems appropriate here.)

                But I don't know the full requirements.

                And perhaps most importantly, the API has a set of choices in the formats that can be retrieved. To get better performance, the minimal format (MBRL0100) is used to retrieve only the member names. If the name is all that's needed, it can be quickly retrieved. One or more names can then be selected from the list, and those selections can be used to retrieve details if needed. That saves the time to retrieve details of the unselected members.
                Last edited by tomliotta; May 3, 2014, 09:03 PM. Reason: Add "most important"
                Tom

                There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                Comment


                • #9
                  Re: List source members from a source physical file

                  Thank you all for the replies

                  I managed to get what I needed thanks to your help, by using the QUSLMBR API. I forget to mention that I only needed the name of the member.

                  Where I work, in order to keep things organized, we have some rules to name our programs. The first 2/3 letters indicates the module. The following characters are numbers, which distinguishes the programs inside the module. Sometimes, programs aren't needed and therefore deleted, leaving spaces in the sequencing. So I was asked to write an application that shows the gaps between the programs. That's why I needed the search string (e.g. XYZ*, which points out the module). I used the DSPOBJD for the objects, and it went just fine, because it prints only the objects that I needed (the ones that start with XYZ). For the members, I couldn't accomplish the same with DSPFD, with DSPFD I got all the members, which sometimes was over 10000. So with QUSLMBR I can get the ones I need and faster.

                  Anyway, after reading your posts I found here in code400 a good example of what I needed, I changed it slightly:

                  Code:
                        *=====================================================
                        * PROGRAM - XXXXXX
                        * PURPOSE - List members in a file
                        *
                        * PROGRAM DESCRIPTION
                        *   This program will list all members in a file
                        *
                        *
                        *
                        * INPUT PARAMETERS
                        *   Description        Type  Size    How Used
                        *   -----------        ----  ----    --------
                        *   ApiLibrary         Char  10      input
                        *   ApiFile            Char  10      input
                        *
                        * INDICATOR USAGE
                        *   n/a
                        *
                        *=====================================================
                        *
                        * Program Info
                        *
                       Fmembers   uf a e             DISK
                        *
                        *  Field Definitions.
                        *
                       d ApiFile         s             10
                       d ApiLibrary      s             10
                       d ApiMember       s             10
                       d bOvr            s              1a   inz('0')
                       d FileLib         s             20a
                       d Format          s              8a
                       d MemberName      s             10a
                       d SpaceVal        s              1    inz(*BLANKS)
                       d SpaceAuth       s             10    inz('*CHANGE')
                       d SpaceText       s             50    inz(*BLANKS)
                       d SpaceRepl       s             10    inz('*YES')
                       d SpaceAttr       s             10    inz(*BLANKS)
                       d UseScreen       s               n
                       d UserSpaceOut    s             20
                        *
                        *
                        * Create userspace datastructure
                        *
                       d  stuff          DS
                       d  StartPosit                   10i 0
                       d  StartLen                     10i 0
                       d  SpaceLen                     10i 0
                       d  ReceiveLen                   10i 0
                       d  MessageKey                   10i 0
                       d  MsgDtaLen                    10i 0
                       d  MsgQueNbr                    10i 0
                        *
                        * Date structure for retriving userspace info
                        *
                       d InputDs         DS
                       d  UserSpace              1     20
                       d  SpaceName              1     10
                       d  SpaceLib              11     20
                       d  InpFileLib            29     48
                       d  InpFFilNam            29     38
                       d  InpFFilLib            39     48
                       d  InpRcdFmt             49     58
                        *
                        *  Data structure for the retrieve user space command
                        *
                       d GENDS           DS
                       d  Filler3                     116
                       d  OffsetHdr                    10i 0
                       d  SizeHeader                   10i 0
                       d  OffsetList                   10i 0
                       d  Filler4                       4
                       d  NbrInList                    10i 0
                       d  SizeEntry                    10i 0
                        *
                        * Datastructure for retrieving elements from userspace
                        *
                       d HeaderDs        DS
                       d  OutFileNam             1     10
                       d  OutLibName            11     20
                       d  OutType               21     25
                       d  OutFormat             31     40
                       d  RecordLen             41     44i 0
                        *
                        * List the members
                        *
                       d ListDs          DS
                       d  LmMember                     10
                       d  LmType                       10
                       d  LmCreationDt                  7
                       d  LmCreationTm                  6
                       d  LmLastChgDt                   7
                       d  LmLastChgTm                   6
                       d  LmDescription                50
                        *
                        * API Error Data Structure
                        *
                       d Errords         ds
                       d  BytesPrv               1      4I 0 inz(%size(errords))
                       d  BytesAvl               5      8I 0 inz(0)
                       d  MessageId              9     15
                       d  ERR###                16     16
                       d  MessageDta            17    256
                        *
                        *=====================================================
                        * MAIN LINE
                        *=====================================================
                        *
                        * Now List the members of this source file to a userspace
                        *
                       c                   exsr      $QUSCRTUS
                        *
                       c                   eval      Format  = 'MBRL0100'
                       c                   exsr      $QUSLMBR
                        *
                        *  Read back the members
                        *
                       c                   eval      StartPosit = 1
                       c                   eval      StartLen = 140
                        *
                        * First call to get data offsets(start)
                        *
                       c                   call(e)   'QUSRTVUS'
                       c                   parm                    UserSpaceOut
                       c                   parm                    StartPosit
                       c                   parm                    StartLen
                       c                   parm                    GENDS
                       c                   parm                    ErrorDs
                        *
                        * Then call to get number of entries
                        *
                       c                   eval      StartPosit = OffsetHdr + 1
                       c                   eval      StartLen = SizeHeader
                        *
                       c                   call(e)   'QUSRTVUS'
                       c                   parm                    UserSpaceOut
                       c                   parm                    StartPosit
                       c                   parm                    StartLen
                       c                   parm                    HeaderDs
                       c                   parm                    ErrorDs
                        *
                       c                   eval      StartPosit = OffsetList + 1
                       c                   eval      StartLen = SizeEntry
                        *
                        *  Do for number of members
                        *
                       c                   do        NbrInList
                       c                   call(e)   'QUSRTVUS'
                       c                   parm                    UserSpaceOut
                       c                   parm                    StartPosit
                       c                   parm                    StartLen
                       c                   parm                    ListDs
                       c                   parm                    ErrorDs
                        *
                       c                   eval      ApiMember = LmMember
                       c                   eval      name = LmMember
                       c                   write     rmembers1
                        *
                       c                   eval      StartPosit = StartPosit + SizeEntry
                       c                   enddo
                        *
                       c                   eval      *inlr = *on
                        *========================================================================
                        * $QUSCRTUS - API to create user space
                        *========================================================================
                       c     $QUSCRTUS     begsr
                        *
                        * Create a user space named ListMember in QTEMP.
                        *
                       c                   Eval      BytesPrv = 116
                       c                   movel(p)  'MEMBERS'     SpaceName
                       c                   movel(p)  'QTEMP'       SpaceLib
                        *
                        * Create the user space
                        *
                       c                   call(e)   'QUSCRTUS'
                       c                   parm      UserSpace     UserSpaceOut
                       c                   parm                    SpaceAttr
                       c                   parm      4096          SpaceLen
                       c                   parm                    SpaceVal
                       c                   parm                    SpaceAuth
                       c                   parm                    SpaceText
                       c                   parm                    SpaceRepl
                       c                   parm                    ErrorDs
                        *
                       c                   endsr
                        *========================================================================
                        * $QUSLMBR  - API List all members in a file
                        *========================================================================
                       c     $QUSLMBR      begsr
                        *
                        *
                       c                   call(e)   'QUSLMBR'
                       c                   parm                    UserSpaceOut
                       c                   parm                    Format
                       c                   parm                    FileLib
                       c                   parm                    MemberName
                       c                   parm                    bOvr
                       c                   parm                    ErrorDs
                        *
                       c                   endsr
                        *=====================================================
                        * Initialization
                        *=====================================================
                       c     *inzsr        begsr
                        *
                       c     *entry        plist
                       c                   parm                    ApiFile
                       c                   parm                    ApiLibrary
                       c                   parm                    MemberName
                        *
                       c                   eval      FileLib     = ApiFile  + ApiLibrary
                        *
                       c                   endsr
                  It has three input parameters: file, library, member name. In the member name I can put XYZ*, and it outputs the members that start with XYZ. I used MBRL0100 as format, just to get the member name, as pointed out by tomliotta. Finally I printed it to a file called members.

                  Comment

                  Working...
                  X