IBM Version 4 Universal Remote User Manual


 
5 TEXT1 PIC X(36)
VALUE "Attempt to add exit program failed: ".
5 EXCEPTION-ID PIC X(7).
ᑍ Miscellaneous elements
1 VARREC.
5 NBR-RECORDS PIC S9(9) BINARY.
5 VAR-RECORDS PIC X(1).
1 MISC.
5 VAR-OFFSET PIC S9(9) VALUE 1.
5 BINARY-NUMBER PIC S9(9) BINARY.
5 BINARY-CHAR REDEFINES BINARY-NUMBER PIC X(4).
5 X PIC S9(9) BINARY.
5 EXIT-POINT-NAME PIC X(2) VALUE "EXAMPLE_EXIT_POINT".
5 EXIT-PGM PIC X(2) VALUE "EXAMPLEPGMEXAMPLELIB".
5 EXIT-PGM-NBR PIC S9(9) VALUE 1 BINARY.
5 EXIT-PGM-DATA PIC X(25)
VALUE "EXAMPLE EXIT PROGRAM DATA".
5 FORMAT-NAME PIC X(8) VALUE "EXMP1".
ᑍ Beginning of mainline
PROCEDURE DIVISION.
MAIN-LINE.
ᑍ Register the exit point with the registration facility. If the
ᑍ registration of the exit point is successful, add an exit
ᑍ program to the exit point.
ᑍ Initialize the error code parameter. To signal exceptions to
ᑍ this program by the API, you need to set the bytes provided
ᑍ field of the error code to zero. Because this program has
ᑍ exceptions sent back through the error code parameter, it sets
ᑍ the bytes provided field to the number of bytes it gives the
ᑍ API for the parameter.
MOVE 16 TO BYTES-PROVIDED.
ᑍ Set the exit point controls. Each control field is passed to
ᑍ the API using a variable length record. Each record must
ᑍ start on a 4-byte boundary.
ᑍ Set the total number of controls that are being specified on
ᑍ the call. This program lets the API take the default for the
ᑍ controls that are not specified.
MOVE 2 TO NBR-RECORDS.
ᑍ Set the values for the two controls that are specified:
Maximum number of exit programs = 1
Exit point description = 'EXIT POINT EXAMPLE'
MOVE 3 TO CONTROL-KEY OF QUS-VLEN-REC-4.
MOVE 4 TO LENGTH-DATA OF QUS-VLEN-REC-4.
MOVE 1 TO BINARY-NUMBER.
MOVE BINARY-CHAR TO VAR-RECORDS((VAR-OFFSET + 12):4).
PERFORM CALCULATE-NEXT-OFFSET.
B-52 System API Programming V4R1