ᑍ
ᑍ Remove an exit program from the exit point and then deregister
ᑍ the exit point. It is not necessary to remove exit programs
ᑍ from an exit point before deregistering the exit point. It is
ᑍ done here only for illustrative purposes.
ᑍ
ᑍ 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 OF QUS-EC.
ᑍ
ᑍ Call the API to remove the exit program.
ᑍ
CALL PROCEDURE "QusRemoveExitProgram" USING
EXIT-POINT-NAME, FORMAT-NAME,
PGM-NBR, 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-EXIT-POINT,
WRITE LIST-LINE FROM BAD-EXIT-POINT,
STOP RUN.
ᑍ
ᑍ If the call to remove the exit program is successful,
ᑍ deregister the exit point.
ᑍ
ᑍ Call the API to deregister the exit point.
ᑍ
CALL PROCEDURE "QusDeregisterExitPoint" USING
EXIT-POINT-NAME, FORMAT-NAME, 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-EXIT-PGM,
WRITE LIST-LINE FROM BAD-EXIT-PGM,
STOP RUN.
ᑍ
STOP RUN.
ᑍ
ᑍ End of MAINLINE
ᑍ
Appendix B. Original Examples in Additional Languages B-89