MONMSG MSGID(CPF864) 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(MI1)
CALL CLCRTPG MI1
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: CL1 ᑍ/
/ᑍ ᑍ/
/ᑍ Programming Language: CL ᑍ/
/ᑍ ᑍ/
/ᑍ Description: Test the MI program MI1. ᑍ/
/ᑍ ᑍ/
/ᑍ ᑍ/
/ᑍ 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