1. Fall into a loop (the MORE label) until all source records are loaded as the
source physical file member position is overridden:
MORE: CALLX QCMDEXC, QCMDOVROL, \;
2. Instruct the CL06 program to load source records from the start of the input
buffer, which is actually the BINOFFSET into the space created earlier:
CPYNV OFFSET,1;
CALLX CLð6, CLð6OL, \;
3. Back out (subtract) the base-1 nature of CL using the short (the (S) extender)
form of the subtract numeric (SUBN) instruction:
SUBN(S) OFFSET, 1;
4. Add the number of MI source bytes processed by CL06 to the offset into the
space (for the next call):
ADDN(S) BINOFFSET, OFFSET;
SETSPPO USRSPC, BINOFFSET;
5. Update the Override with Database File (OVRDBF) position parameter for the
next call to CL06:
ADDN(S) RECNUM, 2ð;
6. Delete the previous OVRDBF:
CALLX QCMDEXC, QCMDDLTOL, \;
7. Check to see if all records were processed, and if not, branch to label MORE to
load more source records:
CMPNV(B) OFFSET, 16ðð /EQ(MORE);
Otherwise, assume that all source was loaded and prepare for calling the
QPRCRTPG API by setting the program name:
CPYBLA PGMNAM, MBR;
8. Reset the space pointer from the source of the input program to the start of the
space. This resetting of the static storage USRSPC is also assumed in the
branch to label SKIP earlier in the program:
SETSPPO USRSPC,ð;
9. Call the QPRCRTPG API to create the MI program:
CALLX QPRCRTPG, QPRCRTPGOL, \;
10. Indicate that the program is done:
RTX \;
PEND;
MICRTPG2 Complete Program—MI Code Example
In its consolidated state, this is the new MICRTPG2 program:
/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/
/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/
/\ \/
/\ Program Name: MICRTPG2 \/
/\ \/
/\ Programming Language: MI \/
/\ \/
/\ Description: Initial version of MI program MICRTPG2, \/
Chapter 7. Machine Interface Programming 7-23