To continue reading for free, register below or login
To read more you must become a member of Search400.com
');
// -->

The following code will work for this problem:
Original code:
MONMSG MSGID(CPFBC28) EXEC(GOTO CMDLBL(NOCD1)) /*
temporary to make it work
/* MONMSG MSGID(OPT1660) EXEC(GOTO CMDLBL(NOCD1)) */
/* These are the three
/* MONMSG MSGID(CPDBC19) EXEC(GOTO CMDLBL(IMGFEXT1)) */
/* messages I want to
/* MONMSG MSGID(CPDBC29) EXEC(GOTO CMDLBL(IMGCEXT1)) */
/* check for
GOTO CMDLBL(CD1CONT)
Solution:
MONMSG MSGID(CPFBC28) EXEC(DO)
RCVMSG MSGTYPE(*DIAG) MSGID(&MGID)
IF COND(&MGID *EQ 'CPDBC19') THEN(GOTO
CMDLBL(IMGFEXT1))
IF COND(&MGID *EQ 'CPDBC29') THEN(GOTO
CMDLBL(IMGCEXT1))
GOTO CMDLBL(NOCD1)
ENDDO
GOTO CMDLBL(CD1CONT)
The CPD and OPT messages are diagnostic messages, not escape messages, so they cannot be monitored. When an error occurs on an IBM command, the diagnostic messages are sent first, then an escape message, which you can monitor.
So, you see the escape message, and then you use the RCVMSG command to get the last diagnostic message sent to your program. The variable &MGID is *CHAR 7, and will contain the message ID of the diagnostic message, or will be blank if there was no diagnostic message to receive.
Inside the DO group there is an unconditional GOTO to catch an error that did not return the diagnostic message you expected. There is no need to
check for the OPT1660 message because its destination is the same as the unconditional GOTO.
|