Calling

the

CL05 Program

 

 

 

 

 

 

 

 

 

 

 

 

 

Now

the

program

will

call the CL05 program (CALLX

CL05)

and

pass

the

addres

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 opera

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

and

BINOFFSET@

are

passed

to

refer

to

MBR

and

BINOFFSET,

respectively).

 

This has the effect of having the CL05 program treat

the *USRSPC

storag

parameter:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CALLX CLð5, CLð5OL, \;

 

 

 

 

 

 

 

 

 

 

 

 

 

Finally,

as

the

program comes

to

an

end, this

is

the

return

external

i

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

be

of

the MI base with which to work (for example,

MICRTPG is

used

as

for

further compiler

enhancement).

 

 

 

Enhanced Version of the

MICRTPG

 

Program

 

 

 

 

 

 

 

 

Now

that

 

the

MICRTPG

program

provides

addressability (through

the

*USRSPC

a

parameter

 

to

the

CL05

program)

for

as many as 64KB of input source,

version of MICRTPG (named MICRTPG2) will

incorporate the functions of the

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 becau

tion

support

for

database

access is

beyond the scope of this chapt

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-18System API Programming V4R1

Page 158
Image 158
IBM Version 4 manual Understanding the MICRTPG2 Program by Sections of Code, Creating the Micrtpg Program, Calling, Mbr