Resending copy file completion message
If you run a COPY command from a CL program, the completion message indicating the number of records that are copied is not sent directly to the system operator. You can direct this message to the system operator by resending it.
The following example is a sample CL program that resends the COPY command using the SNDPGMMSG command.
By using the code example, you agree to the terms of the Code license and disclaimer information.
PGM DCL &MSGID TYPE(*CHAR) LEN(7) DCL &MSGDTA TYPE(*CHAR) LEN(82) CPYF FROMFILE(LIB1/XXX) TOFILE(LIB2/XXX) + MBROPT(*ADD) RCVMSG MSGID(&MSGID) MSGDTA(&MSGDTA) + MSGTYPE(*COMP) RMV(*NO) SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) + MSGTYPE(*INFO) TOMSGQ(QSYSOPR) + MSGDTA(&MSGDTA) ENDPGMThe copy function sends one of the following completion messages for each from-file member/label successfully copied to the to-file:
- CPC2955 is the normal copy completion message.
- CPC2956 is used when COMPRESS(*NO) is specified.
- CPC2957 indicates that no records were copied.
- CPC2954 is sent as a second completion message after the CPC2955, CPC2956, or CPC2957 completion message is sent, when you have specified MBROPT(*UPDADD). It will indicate the number of records that were updated.
Parent topic:
Copying files: Basic functions