DCL DD RC CHAR(1) BAS(RC@);
DCL EXCM DATAERROR EXCID(H'ðCð2') BP (M12ð2) IMD;
CMPNV(B) ARG1,ARG2 / LO(ITS2);
CPYNV RESULT,ARG1;
B RETURN;
ITS2: CPYNV RESULT,ARG2;
RETURN: CPYBLA RC,'ð';
RTX \;
M12ð2: CPYBLA RC,'1';
RTX \;
PEND;
The following example updates CL01 to support the new return code parameter:
/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/
/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/
/\ \/
/\ Program Name: CLð1 \/
/\ \/
/\ Programming Language: CL \/
/\ \/
/\ Description: Enhanced version of CL program CLð1 that \/
/\ demonstrates the use of enhanced MIð1. \/
/\ \/
/\ Header Files Included: None \/
/\ \/
/\ \/
/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/
PGM PARM(&ARG1 &ARG2)
DCL VAR(&ARG1) TYPE(\DEC) LEN(15 5)
DCL VAR(&ARG2) TYPE(\DEC) LEN(15 5)
DCL VAR(&RESULT) TYPE(\DEC) LEN(15 5)
DCL VAR(&RC) TYPE(\CHAR) LEN(1)
DCL VAR(&MSG) TYPE(\CHAR) LEN(2ð)
DCL VAR(&USR) TYPE(\CHAR) LEN(1ð)
RTVJOBA USER(&USR)
CALL PGM(MIð1) PARM(&ARG1 &ARG2 &RESULT &RC)
IF COND(&RC = 'ð') +
THEN(CHGVAR VAR(&MSG) VALUE(&RESULT))
ELSE +
CHGVAR VAR(&MSG) VALUE('ERROR FOUND')
SNDMSG MSG(&MSG) TOUSR(&USR)
ENDPGM
After recompiling the MI01 program and the CL01 program, CALL CL01 (abc 6)
now results in the following message (not the previous MCH1202):
ERROR FOUND
Creating an MI Version of CLCRTPG
The topics previous to this discuss how to create MI01 to be a reasonably complete
program. This topic discusses how to create an MI version of the CLCRTPG
program that can be used to create MI programs. This program is called
MICRTPG.
Chapter 7. Machine Interface Programming 7-11