On 30/10/2008, at 7:58 AM, Aaron Bartell wrote:
It's a worthy question. I reproduced an MCH error on purpose and
optimistically scoured the joblog for a status code - nothing found
that I
could see.
Status code won't be in the job log. It will be in the *STATUS field
in the PSDS and accessible via %STATUS. Test code follows that
behaves as expected:
H DFTACTGRP(*NO) OPTION(*SRCSTMT : *NODEBUGIO)
D explode PR
D p1 10 OPTIONS(*OMIT)
D status S 5P 0
C MONITOR
C CALLP explode( *OMIT )
C ON-ERROR
C 'Caught!' DSPLY
C EVAL status = %STATUS
C status DSPLY
C ENDMON
C SETON LR
C RETURN
P explode B
D explode PI
D p1 10 OPTIONS(*OMIT)
D kaboom S 10
C EVAL kaboom = p1
P explode E
Run interactively gives:
DSPLY Caught!
DSPLY 202
Run in batch gives:
MCH3601 Escape 40 30/10/08 08:02:24
ABARTELL1 SHC *STMT ABARTELL1 SHC
From module . . . . . . . . :
ABARTELL1
From procedure . . . . . . :
EXPLODE
Statement . . . . . . . . . :
2300
To module . . . . . . . . . :
ABARTELL1
To procedure . . . . . . . :
EXPLODE
Statement . . . . . . . . . :
2300
Message . . . . : Pointer not
set for location referenced.
Cause . . . . . : A pointer
was used, either directly or as a basing
pointer, that has not been
set to an address.
CPF1164 Completion 00 30/10/08 08:02:24
QWTMCEOJ QSYS 00BC *EXT
Message . . . . : Job 797760/
SHC/SHC ended on 30/10/08 at 08:02:24; 1
seconds used; end code 0 .
Note the normal completion indicating the exception was trapped.
Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists
http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.