Example: List database file members with a CL program

This program generates a list of members that start with M, and places the list into a user space named example in Library QGPL.

Note: Read the Code license and disclaimer information for important legal information.

To generate a list of members that start with M and are in file QCLSRC in library QGPL, specify the following:

/****************************************************************/
 /*                                                              */
 /* PROGRAM:  LSTMBR2                                            */
 /*                                                              */
 /* LANGUAGE:  CL                                                */
 /*                                                              */
 /* DESCRIPTION:  THIS PROGRAM WILL GENERATE A LIST OF MEMBERS,  */
 /*               THAT START WITH M, AND PLACE THE LIST INTO A   */
 /*               USER SPACE NAMED EXAMPLE IN LIBRARY QGPL.      */
 /*                                                              */
 /* APIs USED:  QUSCRTUS, QUSLMBR                                */
 /*                                                              */
 /****************************************************************/
 PGM
 /****************************************************************/
 /*   CREATE A *USRSPC OBJECT TO PUT THE LIST INFORMATION INTO.  */
 /****************************************************************/
   CALL QUSCRTUS                                                    +
        ('EXAMPLE   QGPL      ' /* USER SPACE NAME AND LIB       */ +
         'EXAMPLE   '           /* EXTENDED ATTRIBUTE            */ +
         X'0000012C'            /* SIZE OF USER SPACE            */ +
         ' '                    /* INITIALIZATION VALUE          */ +
         '*CHANGE   '           /* AUTHORITY                     */ +
         'USER SPACE FOR QUSLMBR EXAMPLE                    ')
 /****************************************************************/
 /*   LIST THE MEMBERS BEGINNING WITH "M" OF A FILE CALLED       */
 /*   QCLSRC FROM LIBRARY QGPL USING THE OUTPUT FORMAT MBRL0200. */
 /*   OVERRIDE PROCESSING SHOULD OCCUR.                          */
 /****************************************************************/
      CALL QUSLMBR                                                  +
           ('EXAMPLE   QGPL      ' /* USER SPACE NAME AND LIB    */ +
            'MBRL0200'             /* FORMAT NAME                */ +
            'QCLSRC    QGPL      ' /* DATABASE FILE AND LIBRARY  */ +
            'M*        '           /* MEMBER NAME                */ +
            '1')                   /* OVERRIDE PROCESSING        */
ENDPGM