Field INPUT OUTPUT
Exception ID Ignored CPF7B03
Reserved Ignored 0
Exception data Ignored USRMSG QGPL
Using the Job Log to Diagnose API Errors
Sometimes an API may issue one or more messages that state that the API failed,
and the messages may direct you to see the previously listed messages in the job
log. If your application program needs to determine the cause of the error
message, you can use the Receive Message (RCVMSG) command or the Receive
Message APIs to receive the messages that explain the reason for the error. In
some cases, you can write an application program to use the diagnostic message
to identify and correct the parameter values that caused the error.
Receiving Error Messages from the Job Log—Example
To receive error messages from the job log using a CL program, specify the fol-
lowing:
/ᑍ ᑍ/
/ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ/
/ᑍ ᑍ/
/ᑍ PROGRAM: CLRCVMSG ᑍ/
/ᑍ ᑍ/
/ᑍ LANGUAGE: CL ᑍ/
/ᑍ ᑍ/
/ᑍ DESCRIPTION: THIS PROGRAM DEMONSTRATES HOW TO RECEIVE ᑍ/
/ᑍ DIAGNOSTIC MESSAGES FROM THE JOB LOG ᑍ/
/ᑍ ᑍ/
/ᑍ APIs USED: QUSCRTUS ᑍ/
/ᑍ ᑍ/
/ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ/
/ᑍ ᑍ/
CLRCVMSG: PGM
DCL VAR(&MSGDATA) TYPE(ᑍCHAR) LEN(8)
DCL VAR(&MSGID) TYPE(ᑍCHAR) LEN(7)
DCL VAR(&MSGLEN) TYPE(ᑍDEC) LEN(5 )
MONMSG MSGID(CPF3C1) EXEC(GOTO CMDLBL(GETDIAGS))
CALL PGM(QUSCRTUS) PARM('!BADNAME !BADLIB ' +
'!BADEXATTR' -1 '@' 'ᑍBADAUTH ' 'Text +
Description')
/ᑍ IF WE MAKE IT HERE, THE SPACE WAS CREATED OK ᑍ/
GOTO CMDLBL(ALLDONE)
/ᑍ IF THIS PART OF THE PROGRAM RECEIVES CONTROL, A CPF3C1 ᑍ/
/ᑍ WAS RECEIVED INDICATING THAT THE SPACE WAS NOT CREATED. ᑍ/
/ᑍ THERE WILL BE ONE OR MORE DIAGNOSTICS THAT WE WILL RECEIVE ᑍ/
/ᑍ TO DETERMINE WHAT WENT WRONG. FOR THIS EXAMPLE WE WILL ᑍ/
/ᑍ JUST USE SNDPGMMSG TO SEND THE ID'S OF THE MESSAGES ᑍ/
/ᑍ RECEIVED. ᑍ/
GETDIAGS: RCVMSG PGMQ(ᑍSAME) MSGQ(ᑍPGMQ) MSGTYPE(ᑍDIAG) +
WAIT(3) RMV(ᑍNO) MSGDTA(&MSGDATA) +
MSGDTALEN(&MSGLEN) MSGID(&MSGID)
IF COND(&MSGID = ' ') THEN(GOTO +
CMDLBL(ALLDONE))
ELSE CMD(DO)
SNDPGMMSG MSG(&MSGID)
GOTO CMDLBL(GETDIAGS)
ENDDO
2-10 System API Programming V4R1