MONMSG MSGID(CPFð864 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 CLð3 (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'ðEð1') INT(M14ð1) IMD;
2. Define the internal entry point:
ENTRY M14ð1 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