IBM Version 4 manual Rpg

Models: Version 4

1 505
Download 505 pages 30.92 Kb
Page 332
Image 332

BY CONTENT LENGTH OF EXIT-PGM-DATA OF MISC, VARREC, QUS-EC.

\

\If an exception occurs, the API returns the exception in t￿he

\error code parameter. The bytes available field is set to

\zero if no exception occurs and greater than zero if an

\exception does occur.

\

IF BYTES-AVAILABLE OF QUS-EC > ð

OPEN OUTPUT LISTING,

MOVE EXCEPTION-ID OF QUS-EC

TO EXCEPTION-ID OF BAD-ADD, WRITE LIST-LINE FROM BAD-ADD, STOP RUN.

\

STOP RUN.

\

\End of MAINLINE

\Calculate 4-byte aligned offset for next variable length￿ record

CALCULATE-NEXT-OFFSET.

COMPUTE BINARY-NUMBER = LENGTH-DATA OF QUS-VLEN-REC-4 + 12.

DIVIDE BINARY-NUMBER BY 4 GIVING BINARY-NUMBER REMAINDER ￿X. IF X = ð COMPUTE LENGTH-VLEN-RECORD OF QUS-VLEN-REC-4 =

LENGTH-DATA OF QUS-VLEN-REC-4 + 12

ELSE COMPUTE LENGTH-VLEN-RECORD OF QUS-VLEN-REC-4 = LENGTH-DATA OF QUS-VLEN-REC-4 + 12 + ( 4 - X ).

MOVE QUS-VLEN-REC-4 TO VAR-RECORDS(VAR-OFFSET:12).

COMPUTE VAR-OFFSET = VAR-OFFSET + LENGTH-VLEN-RECORD OF

QUS-VLEN-REC-4.

Register Exit

Point

and

Add

Exit

Program—OPM

RPG

Example

 

 

Refer

to

“Register Exit

Point

and Add Exit Program—ILE C Example” on pag

 

 

for

the original

example.

 

 

 

 

 

F\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 

 

 

F\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 

 

 

F\

 

 

 

 

 

 

 

 

F\

Program:

Register an Exit Point

 

 

 

F\

 

 

Add an Exit Program

 

 

 

F\

 

 

 

 

 

 

 

 

F\

Language:

OPM RPG

 

 

 

 

 

F\

 

 

 

 

 

 

 

 

F\

Description:

This program registers an exit point with the

 

 

 

F\

 

 

registration facility. After the successful

 

 

 

F\

 

 

completion of the registration of the exit point,

 

 

 

F\

 

 

an exit program is added to the exit point.

 

 

 

F\

 

 

 

 

 

 

 

 

F\

APIs Used:

QUSRGPT - Register Exit Point

 

 

 

F\

 

 

QUSADDEP - Add Exit Program

 

 

 

F\

 

 

 

 

 

 

 

 

F\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 

 

 

F\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 

 

 

F\

 

 

 

 

 

B-54

System API

Programming V4R1

 

 

 

 

Page 332
Image 332
IBM Version 4 manual Rpg