MONMSG MSGID(CPF864 CPF4137) EXEC(GOTO CMDLBL(DONE))
CHGVAR VAR(%SST(&BUFFER &OFFSET 8)) VALUE(&SRCDTA)
CHGVAR VAR(&OFFSET) VALUE(&OFFSET + 8)
IF COND(&OFFSET ᑍGT 16) THEN(GOTO CMDLBL(DONE))
GOTO CMDLBL(LOOP)
DONE: ENDPGM
Creating the MICRTPG2 Program
To create the MICRTPG2 program, use:
DLTOVR MISRC
CALL CL3 (MISRC MICRTPG2)
After the successful creation of MICRTPG2, you can create any new MI programs
by entering the following, where SourceFileName is an optional parameter:
CALL MICRTPG2 (MemberName SourceFileName)
Handling Exceptions in the MICRTPG2 Program
Some exceptions that are not being handled by the MICRTPG2 program may
occur. For example, if you used MICRTPG2 to compile MICRTPG2 two times in
succession, the exception MCH1401 occurs. This occurs because the most recent
activation of the MICRTPG2 program has its own static storage and is not aware of
the earlier instances of MICRTPG2 creating the space named MICRTPG2 in
QTEMP.
To correct this problem do the following:
1. Define an exception description that passes control to an internal exception
handler:
DCL EXCM DUPERROR EXCID(H'E1') INT(M141) IMD;
2. Define the internal entry point:
ENTRY M141 INT;
3. Define related data elements for the M1401 exception:
/ᑍ Exception description template for RETEXCPD ᑍ/
DCL DD EXCPDBUF CHAR(2) BDRY(16);
DCL DD BYTPRV BIN(4) DEF(EXCPDBUF) POS(1) INIT(2);
DCL DD BYTAVL BIN(4) DEF(EXCPDBUF) POS(5);
DCL DD EXCPID CHAR(2) DEF(EXCPDBUF) POS(9);
DCL DD CMPLEN BIN(2) DEF(EXCPDBUF) POS(11);
DCL DD CMPDTA CHAR(32) DEF(EXCPDBUF) POS(13);
DCL DD MSGKEY CHAR(4) DEF(EXCPDBUF) POS(45);
DCL DD EXCDTA CHAR(5) DEF(EXCPDBUF) POS(49);
DCL SYSPTR EXC_OBJ@ DEF(EXCDTA) POS(1);
DCL DD EXC_OBJ CHAR(32) DEF(EXCDTA) POS(17);
DCL PTR INV_PTR DEF(EXCPDBUF) POS(97);
DCL DD ᑍ CHAR(87) DEF(EXCPDBUF) POS(113);
DCL SPCPTR EXCPDBUF@ INIT(EXCPDBUF);
/ᑍ Template for RTNEXCP ᑍ/
DCL DD RTNTMPLT CHAR(19) BDRY(16);
Chapter 7. Machine Interface Programming 7-27