MONMSG MSGID(CPFð864) EXEC(GOTO CMDLBL(CRTPGM))
CHGVAR VAR(%SST(&MIPGMSRC &OFFSET 8ð)) VALUE(&SRCDTA)
CHGVAR VAR(&OFFSET) VALUE(&OFFSET + 8ð)
GOTO CMDLBL(LOOP)
CRTPGM: CHGVAR VAR(%SST(&PGMNAM 1 1ð)) VALUE(&SRCMBR)
CHGVAR VAR(%BIN(&MIPGMSRCSZ)) VALUE(&OFFSET)
CALL PGM(QSYS/QPRCRTPG) PARM(&MIPGMSRC +
&MIPGMSRCSZ &PGMNAM &PGMTXT &PGMSRCF +
&PGMSRCM &PGMSRCCHG &PRTFNAM &PRTSTRPAG +
&PGMPUBAUT &PGMOPTS &NUMOPTS)
ENDPGM
Creating the MI Example Program
After creating the CL program (assumed to be called CLCRTPG), the following
statements create the previous MI program MI01:
DLTOVR MISRC
OVRDBF MISRC MBR(MIð1)
CALL CLCRTPG MIð1
Note: If the creation of MI01 fails, you should closely compare your source to that
shown in this chapter. In general, consider the QPRCRTPG error mes-
sages that refer to “probable compiler error” as referring to your input
source and not that the QPRCRTPG API itself is in error. (QPRCRTPG
assumes its input is probably from a high-level language (HLL) compiler.)
If the error message is CPF6399 (Identifier not declared), you can get an
object definition table (ODT) listing by adding *XREF to the option template
parameter (variable &PGMOPTS in the CLCRTPG program) when calling
the QPRCRTPG API. Add *XREF to the existing *LIST and *REPLACE
options, and change the number of option template entries parameter (vari-
able &NUMOPTS) to 3.

Testing MI01

In this topic, assume that MI01 was successfully created. Test the MI01 program
with the following CL01 CL program:
/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/
/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/
/\ \/
/\ Program Name: CLð1 \/
/\ \/
/\ Programming Language: CL \/
/\ \/
/\ Description: Test the MI program 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(&MSG) TYPE(\CHAR) LEN(2ð)
DCL VAR(&USR) TYPE(\CHAR) LEN(1ð)
7-6 System API Programming V4R1