Monitoring CL Program Messages

After issuing Sterling Connect:Direct® for i5/OS commands such as, CDSND, CDRCV, CDRUNTASK, and CDRUNJOB, use the MONMSG command to monitor the following categories of error messages using a CL program.

Message Category Message ID Severity Other
Warning CDE0107 10 *ESCAPE
Unrecoverable error CDE0108 30 *ESCAPE
Unexpected error CDE0000 (for example, CDE0301)    
Note: You cannot use MONMSG to monitor CDS0108 (Process execution ended) because it is not sent as an error message; it is an informational message.
To capture the Sterling Connect:Direct error message after the MONMSG code, add the following after the MONMSG command:
RCVMSG MSGTYPE(*LAST) WAIT(1) RMV(*NO) MSGID(&MSGID)MSGDATA(&MSGDTA) SNDMSG
MSG(&MSGID || '' || &MSGDATA) TOUSR(*SYSOPR)
&MSGID is the CDE* error message. The first 8 characters of the &MSGDATA are the application error message that you can look up interactively with the following command:
DSPCDMSGD <msgid>
Note:

The &MSGID and &MSGDATA variables must be defined in the CL program. Specify the &MSGID character length as 7 characters and &MSGDATA as 8 characters to capture the error message.