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

and the messages may direct

you

to

see

the previously listed messag

log. If your application program needs

to determine the cause of the

message, you can use the Receive Message

(RCVMSG) command or the Rece

Message APIs to receive the

messages that explain the reason for the

some

cases,

you can write

an

application program to use the diagnostic

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, specif 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(CPF3Cð1) 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 CPF3Cð1

\/

/\ WAS RECEIVED INDICATING THAT THE SPACE WAS NOT CREATED.

\/

/\ THERE WILL BE ONE OR MORE DIAGNOSTICS THAT WE WILL RECEIV￿E

\/

/\ 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-10System API Programming V4R1

Page 30
Image 30
IBM Version 4 manual Errors, From