DCL PTR INV_PTR2 DEF(RTNTMPLT) POS(1);
DCL DD ᑍ CHAR(1) DEF(RTNTMPLT) POS(17) INIT(X'');
DCL DD ACTION CHAR(2) DEF(RTNTMPLT) POS(18);
DCL SPCPTR RTNTMPLT@ INIT(RTNTMPLT);
4. Retrieve the exception data associated with the MCH1401 exception:
RETEXCPD EXCPDBUF@, X'1';
5. Compare the exception data object identifier to the space identifier you create.
If they are the same, branch to label SAME:
CMPBLA(B) EXC_OBJ, OBJID / EQ(SAME);
a. If the exception data object identifier and the space identifier are not the
same, the program is truly in an unexpected error condition and the excep-
tion description needs to be disabled:
MODEXCPD DUPERROR, X'2', X'1';
Retry the failing instruction. As the exception description is disabled, the
exception is sent to the caller of the program:
CPYBLA ACTION, X'';
B E141;
b. If the exception data object identifier and the space identifier are the same,
the static storage must have been effectively reset. The program reassigns
USRSPC@ by using the returned system pointer in the exception data and
continues with the next instruction following the failed CRTS:
SAME: CPYBWP USRSPC@, EXC_OBJ@;
CPYBLA ACTION, X'1';
E141: CPYBWP INV_PTR2, INV_PTR;
RTNEXCP RTNTMPLT@;
PEND;
MICRTPG2 Complete Program (Enhanced)—MI Code Example
In its consolidated state, this is the new MICRTPG2 program:
/ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ/
/ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ/
/ᑍ ᑍ/
/ᑍ Program Name: MICRTPG2 ᑍ/
/ᑍ ᑍ/
/ᑍ Programming Language: MI ᑍ/
/ᑍ ᑍ/
/ᑍ Description: Enhanced version of MI program MICRTPG2, ᑍ/
/ᑍ which provides for exception handling. ᑍ/
/ᑍ ᑍ/
/ᑍ ᑍ/
/ᑍ Header Files Included: None ᑍ/
/ᑍ ᑍ/
/ᑍ ᑍ/
/ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ/
/ᑍ Entry point and associated parameters ᑍ/
ENTRY ᑍ (ᑍENTRY) EXT;
DCL SPCPTR FIL@ PARM;
DCL SPCPTR MBR@ PARM;
DCL OL ᑍENTRY (MBR@, FIL@) PARM EXT MIN(1);
DCL DD FIL CHAR(1) BAS(FIL@);
7-28 System API Programming V4R1