The CL program retrieves the device name from the CPC3701 message (found in positions 126 through 135 of the message data) and uses the information to determine which device is used by the next save command.
SEQNBR *... ... 1 ... ... 2 ... ... 3 ... ... 4 ... ... 5 ... ... 6 ... ... 7 1.00 PGM 2.00 DCL &MSGDATA *CHAR LEN(250) 3.00 DCL &MSGID *CHAR LEN(7) 4.00 DCL &DEV *CHAR LEN(10) 5.00 DCL &DEV1 *CHAR LEN(10) VALUE(TAP01) 6.00 DCL &DEV2 *CHAR LEN(10) VALUE(TAP02) 7.00 SAVLIB LIB(LIB1) DEV(&DEV1 &DEV2) ENDOPT(*LEAVE) 8.00 L00P: RCVMSG RMV(*NO) MSGDTA(&MSGDATA) MSGID(&MSGID) 9.00 IF (&MSGID *NE CPC3701) GOTO L00P /* Compltn */ 10.00 CHGVAR &DEV %SST(&MSGDATA 126 10) /* Device name */ 11.00 IF (&DEV *EQ 'TAP01') DO /* Last was TAP01 */ 12.00 CHGVAR &DEV1 'TAP01' /* Set for first device */ 13.00 CHGVAR &DEV2 'TAP02' /* Set for second device */ 14.00 ENDDO /* Last was TAP01 */ 15.00 ELSE DO /* Last was not TAP01 */ 16.00 CHGVAR &DEV1 'TAP02' /* Set for first device */ 17.00 CHGVAR &DEV2 'TAP01' /* Set for second device */ 18.00 ENDDO /* Last was not TAP01 */ 19.00 SAVLIB LIB(LIB2) DEV(&DEV1 &DEV2) /* Save Lib 2 */ 20.00 ENDPGM
If any objects cannot be saved, the operation attempts to save remaining objects and sends an escape message (CPF3771 for single libraries, CPF3751/CPF3778 for more than one library, and CPF3701 for save operations to save files) stating how many objects were saved and how many were not. To continue with the next library, the Monitor Message (MONMSG) command must be used to handle the escape condition. The format of the message data for the CPF3771 message is similar to the CPC3701 message and also identifies the last device used.
The SAVCHGOBJ command operates in a similar manner, but uses CPC3704 as a completion message, CPF3774 as an escape message for single libraries, and CPC3721 or CPF3751 for multiple libraries. For save operations to save files, these messages are CPC3723 as a completion message and CPF3702 as an escape message. These messages also contain the last device or save file used in the message data.