Sometimes there is a need to compile physical files in bulk. There are two ways to do that, either create a file containing all source member names (member list) and write a CL to read that file, or make a user option, which works on one member at a time with validations, such as existence of the object, if it is in error then write the name of the member to a physical file. First of all, you create a user option, CP in this case as follows:
CALL PGM(*LIBL/CMPPF) PARM(&l &f
PGM PARM(&SLIB &SRC &TLIB +
&FILNAM &TSRC)
DCL &SLIB *CHAR 10
DCL &TLIB *CHAR 10
DCL &SRC *CHAR 10
DCL &TSRC *CHAR 10
DCL &FILNAM *CHAR 10
CHKOBJ *LIBL/&FILNAM *FILE
MONMSG CPF9801 EXEC(DO)
/*The parameters of CRTPF can be changed as required */
CRTPF &TLIB/&FILNAM &SLIB/&SRC
MONMSG CPF7302 EXEC(CPYSRCF +
FROMFILE(&SLIB/&SRC) +
TOFILE(*LIBL/&TSRC) FROMMBR(&FILNAM))
ENDDO
EXIT: ENDPGM
This was first published in August 2001