MOVE 1 TO LENGTH-DATA OF QUS-VLEN-REC-4.
MOVE 1 TO VAR-RECORDS((VAR-OFFSET + 12):1).
PERFORM CALCULATE-NEXT-OFFSET.
MOVE 3 TO CONTROL-KEY OF QUS-VLEN-REC-4.
MOVE 4 TO LENGTH-DATA OF QUS-VLEN-REC-4.
MOVE 37 TO BINARY-NUMBER.
MOVE BINARY-CHAR TO VAR-RECORDS((VAR-OFFSET + 12):4).
PERFORM CALCULATE-NEXT-OFFSET.
ᑍ
ᑍ Call the API to register the exit program.
ᑍ
CALL "QUSADDEP" USING EXIT-POINT-NAME OF MISC,
FORMAT-NAME OF MISC,
EXIT-PGM-NBR OF MISC,
EXIT-PGM OF MISC,
EXIT-PGM-DATA OF MISC,
BY CONTENT LENGTH OF EXIT-PGM-DATA OF MISC,
VARREC, QUS-EC.
ᑍ
ᑍ If an exception occurs, the API returns the exception in the
ᑍ 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—ILE COBOL Example
Refer to “Register Exit Point and Add Exit Program—ILE C Example” on page 4-9
for the original example.
B-50 System API Programming V4R1