Calling the CL05 Program
Now the program will call the CL05 program (CALLX CL05) and pass the address
of the *USRSPC as a parameter (along with the member name, program name,
and the size of the source stream). When you call CL05 with the operand list
CL05OL, CL05 passes the actual space pointer USRSPC. CL05 does not pass a
space pointer that refers to the space pointer USRSPC (as opposed to how MBR@
and BINOFFSET@ are passed to refer to MBR and BINOFFSET, respectively).
This has the effect of having the CL05 program treat the *USRSPC storage as the
parameter:
CALLX CL5, CL5OL, ᑍ;
Finally, as the program comes to an end, this is the return external instruction and
pend directive for the initial version of MICRTPG:
RTX ᑍ;
PEND;
Creating the MICRTPG Program
To create MICRTPG, use the following CL commands:
DLTOVR MISRC
OVRDBF MISRC MBR(MICRTPG)
CALL CLCRTPG MICRTPG
Assuming a successful creation, the CLCRTPG program is not used again because
of the MI base with which to work (for example, MICRTPG is used as a boot-strap
for further compiler enhancement).
Enhanced Version of the MICRTPG Program
Now that the MICRTPG program provides addressability (through the *USRSPC as
a parameter to the CL05 program) for as many as 64KB of input source, a new
version of MICRTPG (named MICRTPG2) will incorporate the functions of the CL03
program and the CL05 program. A modified form of CL04 (renamed to CL06) is
used in these examples to read the MISRC source physical file because MI instruc-
tion support for database access is beyond the scope of this chapter.
The MICRTPG2 program demonstrates how to do the following:
Receive a variable number of parameters
Use static and automatic storage
Create a space object
Perform arithmetic operations
Understanding the MICRTPG2 Program (by Sections of Code)
Writing the program code for MICRTPG2:
1. Define the entry point and associated parameters:
ENTRY ᑍ (PARM_LIST) EXT;
DCL SPCPTR FIL@ PARM;
DCL SPCPTR MBR@ PARM;
DCL OL PARM_LIST (MBR@, FIL@) PARM EXT MIN(1);
DCL DD FIL CHAR(1) BAS(FIL@);
DCL DD MBR CHAR(1) BAS(MBR@);
DCL DD NUM_PARMS BIN(4);
7-18 System API Programming V4R1