How do I use Source Statement Retrievals to catalog definitions to a new COMLIB / M4LIB?

Document ID : KB000031059
Last Modified Date : 14/02/2018
Show Technical Document Details

Question:

How do I use Source Statement Retrievals to catalog definitions to a new COMLIB / M4LIB?

 

Answer:

SSR is a useful tool to copy selected items to a different M4LIB.
This is documented in the Environment Manual chapter 19.

First, see what you have and list the item names in each M4LIB library by item type:

//LIST EXEC PGM=MARKIV
//STEPLIB DD DISP=SHR,DSN=visionBuilder.loadlib
//M4LIB   DD DISP=SHR,DSN=your.m4lib
//M4LIST  DD SYSOUT=whatever.you.use
//M4INPUT DD *
LISTMLIBRC
        CTLIN                    <<<< CT starts in column 9
/*
//

Now retrieve the source for file definitions:

//RETRIEVE EXEC PGM=MARKIV
//STEPLIB DD DISP=SHR,DSN=builder.loadlib
//M4LIB   DD DISP=SHR,DSN=your.m4lib
//M4LIST  DD SYSOUT=whatever.you.use
//M4SSOUT DD DSN=sysout.file,DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
//              SPACE=(TRK,n,n),RLSE)
//M4INPUT DD *
RETRIEVERC                           S    <<<<< S is in column 38
        CTRFD                             <<<<< CT starts in col 9
/*
//

To retrieve the source for definitions of tables, arrays and logical dataview’s, transaction groups, and, requests and request groups, substitute RTD, RAD, RDB, RGD and RRG, respectively, for RFD on the second M4INPUT statement.

After you initialize a new M4LIB you can catalog all definitions into a new M4LIB by simply adding the following to the top of the source datasets you have created:
CATALOG1RC and point M4INPUT to the dataset and execute the first JCL example above.

Cataloging requests cannot be done en masse because they must be associated with a file definition. You can use a CTLST for each FD to see which requests are associated, then recatalog.