1.Fall into a loop (the MORE label) until all source records are loa source physical file member position is overridden:

MORE: CALLX QCMDEXC, QCMDOVROL, \;

2.Instruct the CL06 program to load source records from the start buffer, which is actually the BINOFFSET into the space created e

CPYNV

OFFSET,1;

CALLX

CLð6, CLð6OL, \;

3. Back out

(subtract) the base-1 nature of CL using the short (th

form of the subtract numeric (SUBN) instruction: SUBN(S) OFFSET, 1;

4.Add the number of MI source bytes processed by CL06 to the of space (for the next call):

ADDN(S) BINOFFSET, OFFSET;

SETSPPO USRSPC, BINOFFSET;

5.Update the Override with Database File (OVRDBF) position paramete 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

load

more

source

records:

 

CMPNV(B) OFFSET,

16ðð /EQ(MORE);

Otherwise, assume that all source was loaded and prepare for ca QPRCRTPG API by setting the program name:

CPYBLA PGMNAM, MBR;

8.Reset the space pointer from the source of the input program t space. This resetting of the static storage USRSPC is also assumed 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

Programming7-23

Page 163
Image 163
IBM Version 4 MICRTPG2 Complete Program-MI Code Example, Delete the previous Ovrdbf, Indicate that the program is done