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 CL6, CL6OL, ᑍ;
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