You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Resending copy file completion message<br />
If you run a COPY command from a CL program, the completion message<br />
indicating the number of records that are copied is not sent directly to the system<br />
operator. You can direct this message to the system operator by resending it<br />
(SNDPGMMSG command) from the CL program, using the following CL program<br />
as an example:<br />
PGM<br />
DCL&MSGID TYPE(*CHAR) LEN(7)<br />
DCL&MSGDTA TYPE(*CHAR) LEN(82)<br />
CPYF FROMFILE(LIB1/XXX) TOFILE(LIB2/XXX) +<br />
MBROPT(*ADD)<br />
RCVMSG MSGID(&MSGID) MSGDTA(&MSGDTA) +<br />
MSGTYPE(*COMP) RMV(*NO)<br />
SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) +<br />
MSGTYPE(*INFO) TOMSGQ(QSYSOPR) +<br />
MSGDTA(&MSGDTA)<br />
ENDPGM<br />
The copy function sends one of the following completion messages for each<br />
from-file member/label successfully copied to the to-file:<br />
v CPC2955 is the normal copy completion message.<br />
v CPC2956 is used when COMPRESS(*NO) is specified.<br />
v CPC2957 indicates that no records were copied.<br />
v CPC2954 is sent as a second completion message after the CPC2955, CPC2956, or<br />
CPC2957 completion message is sent, when you have specified<br />
MBROPT(*UPDADD). It will indicate the number of records that were updated.<br />
Monitoring for copy errors<br />
The escape message CPF2817 is sent to indicate many different error conditions.<br />
Except for the empty from-file member case which is described later, when this<br />
message is sent:<br />
v A physical file is not created (even if CRTFILE(*YES) was specified on a copy<br />
command).<br />
v No members are added to a to-file that is a physical file.<br />
v No to-file member is cleared (even if MBROPT(*REPLACE) was specified).<br />
v The to-file is not opened, so no file is created on a diskette or tape volume. If the<br />
to-file is spooled, no spooled file is created.<br />
v No records are copied.<br />
The CPF2817 escape message is always preceded by at least one diagnostic<br />
message that indicates the specific error condition. The message identifier of the<br />
diagnostic message which immediately precedes the CPF2817 escape is used as<br />
message replacement data (MSGDTA parameter on the SNDPGMMSG command)<br />
for the CPF2817 escape message. This allows you to monitor for specific error cases<br />
from the CPF2817 escape message by using the CMPDTA parameter on the<br />
MONMSG command.<br />
For example, message CPF2802 is a diagnostic message. It indicates that the<br />
from-file cannot be found. You can monitor for just the from-file not found<br />
condition as follows:<br />
PGM<br />
78 <strong>File</strong> <strong>Management</strong> V4R5<br />
/* The replacement text of escape<br />
CPF2817 contains the msg ID<br />
CPF2802 for the 'from-file not