The following is an example of how a COBOL74 program could detect errors by using the result returned by the CRCR and STOQ functions.
WORKING-STORAGE SECTION.
77 RESULT-STATUS REAL.
77 CRCR-PGM-NAME-LEN PIC S9(11) BINARY.
77 CRCR-FLAGS REAL.
01 CRCR-PGM-NAME PIC X(256) WITH LOWER-BOUNDS.
01 CRCR-DATA PIC X(20000).
77 ERRBOOL REAL.
77 ERRTYPE REAL.
PROCEDURE DIVISION.
BEGIN-PARA.
CHANGE ATTRIBUTE LIBACCESS OF “EVASUPPORT”
TO BYFUNCTION.
CALL “CRCR_RECV OF EVASUPPORT”
USING CRCR-PGM-NAME, CRCR-PGM-NAME-LEN,
CRCR-DATA, CRCR-FLAGS
GIVING RESULT-STATUS.
MOVE RESULT-STATUS TO ERRBOOL [00:00:01].
MOVE RESULT-STATUS TO ERRTYPE [10:00:01].
IF ERRBOOL = 1
IF ERRTYPE = 1
GO TO CRCR-ERROR
ELSE
GO TO STOQ-ERROR.In the preceding example, CRCR-ERROR and STOQ-ERROR are names of error-handling sections located elsewhere in the program.
Because fatal errors cause the program to be terminated, the program does not need to check whether the error returned is fatal or nonfatal.

