RTVJOBA USER(&USR)
CALL PGM(MI1) PARM(&ARG1 &ARG2 &RESULT)
CHGVAR VAR(&MSG) VALUE(&RESULT)
SNDMSG MSG(&MSG) TOUSR(&USR)
ENDPGM
The following statement calls the CL01 program:
CALL CL1 (-5 6)
This test should cause a message to be sent to your user message queue with the
following value:
6.
Debugging the MI Program
The MI program (MI01) that you created is a standard *PGM object on the AS/400
system. As you would expect, you can call MI01 from other high-level languages.
You can delete MI01 with the Delete Program (DLTPGM) command, save and
restore MI01 using the standard save (SAV) and restore (RST) commands, and so
on.
You can also debug it using the standard debugger on the AS/400 system. To
debug it, you need to look at the listing produced by the QPRCRTPG API to deter-
mine the MI instruction number. Then use that number with the Add Breakpoint
(ADDBKP) CL command. For example, when creating MI01 in the previous exer-
cise, the following listing was generated by QPRCRTPG:
5763SS1 V3R1M 9499 Generated Output 8/8/94 9:46:36 Page 1
SEQ1INST Offset Generated Code ᑍ... ... 1 ... ... 2 ... ... 3 ... ... 4 ... ... 5 ... ... 6 ... ... 7 ... ... 8
1 ENTRY ᑍ (PARM_LIST) EXT ;
2 DCL SPCPTR ARG1@ PARM ;
3 DCL SPCPTR ARG2@ PARM ;
4 DCL SPCPTR RESULT@ PARM ;
5 DCL OL PARM_LIST (ARG1@, ARG2@, RESULT@) PARM EXT ;
6 DCL DD ARG1 PKD(15,5) BAS(ARG1@) ;
7 DCL DD ARG2 PKD(15,5) BAS(ARG2@) ;
8 DCL DD RESULT PKD(15,5) BAS(RESULT@) ;
9 1 4 3C46 2 6 7 CMPNV(B) ARG1,ARG2 / LO(ITS2) ;
9
1 2 E 142 8 6 CPYNV RESULT,ARG1 ;
11 3 14 111 A B RETURN ;
12 4 18 342 8 7 ITS2: CPYNV RESULT,ARG2 ;
13 5 1E 22A1 2 RETURN: RTX ᑍ ;
14 6 22 26 PEND ;
5763SS1 V3R1M 9499 Generated Output 8/8/94 9:46:36 Page 2
MSGID ODT ODT Name Semantics and ODT Syntax Diagnostics
5763SS1 V3R1M 9499 Generated Output 8/8/94 9:46:36 Page 3
MSGID MI Instruction Stream Semantic Diagnostics
Setting Breakpoints in the MI Program
To view the value of RESULT at label RETURN, you first determine that RETURN
corresponds to MI instruction (1) 0005 (2) and enter the following CL com-
mands:
STRDBG PGM(MI1)
ADDBKP STMT('/5') PGMVAR((RESULT ()))
CALL CL1 (-5 6)
The following display is shown:
Chapter 7. Machine Interface Programming 7-7