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.

Note: 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)
ENDPGM
The copy function sends one of the following completion messages for each from-file member/label successfully copied to the to-file: