Joel,
The message you want is the diagnostic which precedes the escape message.
You should monitor for CPF0000 and receive the diagnostic message.
The example below will return the response you desire for CPD3202 in &MSG if you lock the file using ALCOBJ in another job.
PGM
DCL VAR(&MSGID) TYPE(*CHAR) LEN(7)
DCL VAR(&MSG) TYPE(*CHAR) LEN(80)
DCLF FILE(QIWS/QCUSTCDT)
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ABENDPGM))
CHGPF FILE(QIWS/QCUSTCDT)
RETURN
ABENDPGM:
RCVMSG MSGTYPE(*DIAG) RMV(*NO) MSG(&MSG) MSGID(&MSGID)
ENDPGM
Cheers, Peter
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Stone, Joel
Sent: Wednesday, 16 January 2013 6:56 a.m.
To: midrange-l@xxxxxxxxxxxx
Subject: get MSGID of error that caused abend (instead of CPF9999 errorID)
I have a CL with MONMSG(CPF9999) as the first line.
MONMSG MSGID(CPF9999) EXEC(GOTO CMDLBL(ABENDPGM))
At the end of the CL, I would like to retrieve the actual MSGID which caused the problem (NOT the CPF9999 ID, but the msg previous to that).
ABENDPGM:
RCVMSG MSGID(&RTNCODE)
I tried the obvious *PREV to get the previous msgID, but no luck.
For example, I want to retrieve CPF3202 "File CUSTFILE in library TESTLIB in use".
Any ideas?
Thanks
______________________________________________________________________
This outbound email has been scanned for all viruses by the MessageLabs Skyscan service.
For more information please visit
http://www.symanteccloud.com ______________________________________________________________________
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-l.
#####################################################################################
This correspondence is for the named person's use only. It may contain confidential
or legally privileged information, or both. No confidentiality or privilege is waived
or lost by any mistransmission. If you receive this correspondence in error, please
immediately delete it from your system and notify the sender. You must not disclose,
copy or rely on any part of this correspondence if you are not the intended recipient.
Any views expressed in this message are those of the individual sender, except where
the sender expressly, and with authority, states them to be the views of Veda.
If you need assistance, please contact Veda on either :-
Australia 1300-762-207 or New Zealand +64 9 367 6200
As an Amazon Associate we earn from qualifying purchases.