Beginning the Instruction Stream

Begin the instruction stream definition by doing the following:

1.Use the store parameter list length (STPLLEN) instruction to determine number of parameters that were passed to the program:

STPLLEN NUM_PARMS;

2.If the number of parameters is 1, assign FILNAM to the value MISR default that this program supports for the source physical file) an label PARM1 to set the source member name:

CMPNV(B) NUM_PARMS, 2 / EQ(PARM2);

CPYBLAP FILNAM, 'MISRC', ' ';

BPARM1;

3.If the number of parameters is 2, assign FILNAM to the value of parameter:

PARM2: CPYBLA FILNAM, FIL;

4.Assign the source member name:

PARM1: CPYBLA MBRNAM, MBR;

5.Assign the proper context for the space:

CPYBWP CONTEXT, QTEMP@;

6. After establishing the context of the space, now create the space

CRTS USRSPC@, CRTSTMPLT@;

7.Assign the space pointer USRSPC to address the first byte of the

SETSPPFP USRSPC, USRSPC@;

8.Set the OVRDBF CL command to start with POSITION(1):

CPYNV RECNUM, 1;

Using

Static

Storage

to Your Advantage

In

“Beginning

the

Instruction Stream,” the instructions in steps 5, 6, and

done once and the space reused on subsequent invocations of the prog

performance enhancement, add a check to see if

this

program has

been

invoked. To do

the

check,

add

a

control

field,

and conditionally

branch

CRTS-oriented

instructions if this call is

not

the

initial

call:

 

 

 

STPLLEN NUM_PARMS;

 

 

 

 

 

 

 

 

 

 

CMPNV(B) NUM_PARMS, 2 / EQ(PARM2);

 

 

 

 

 

 

 

 

CPYBLAP FILNAM, 'MISRC', ' ';

 

 

 

 

 

 

 

 

 

B PARM1;

 

 

 

 

 

 

 

 

 

 

 

 

PARM2: CPYBLA FILNAM, FIL;

 

 

 

 

 

 

 

 

 

PARM1: CPYBLA MBRNAM,MBR;

 

 

 

 

 

 

 

 

 

 

CMPBLA(B) READY, '1' / EQ(SKIP);

 

 

 

 

 

 

 

 

 

CPYBWP CONTEXT, QTEMP@;

 

 

 

 

 

 

 

 

 

 

CRTS USRSPC@, CRTSTMPLT@;

 

 

 

 

 

 

 

 

 

 

SETSPPFP USRSPC,USRSPC@;

 

 

 

 

 

 

 

 

 

 

CPYBLA READY, '1';

 

 

 

 

 

 

 

 

 

SKIP:

CPYNV RECNUM, 1;

 

 

 

 

 

 

 

 

 

 

Resuming the

program

flow

of the

MICRTPG2

program

from

“Beginning

the

Ins

tion

Stream”

on

page 7-22,

you

should have

the program

perform

the

foll

7-22System API Programming V4R1

Page 162
Image 162
IBM Version 4 manual Beginning the Instruction Stream, To Your Advantage, Storage