Using Compaq COBOL in the Alpha Common Language Environment
13.5 Establishing and Removing User Condition Handlers (OpenVMS)
Example 13–1 (Cont.) User-Written Condition Handler
WORKING-STORAGE SECTION.
01
SS_HAND
PIC S9(9) COMP.
01
SS$_SSFAIL
PIC S9(9) COMP
VALUE EXTERNAL SS$_SSFAIL.
01
SS$_RESIGNAL
PIC S9(9) COMP
VALUE EXTERNAL SS$_RESIGNAL.
01
MSGLEN
PIC S9(4) COMP.
01
MSGID
PIC S9(9) COMP.
01
ERRMSG
PIC X(80).
01
STAT
PIC S9(9) COMP.
LINKAGE SECTION.
01
SIGNAL_ARRAY.
03
SIGNAL_ARGS
PIC 9(9) COMP.
03
SIGNAL
OCCURS 4 TO 10 TIMES
DEPENDING ON SIGNAL_ARGS.
05 SIGNAL_VALUE PIC S9(9) COMP.
01
MECHANISM_ARRAY.
03
MECH_ARGS
OCCURS 5 TIMES.
05 MECH
PIC 9(9) COMP.
PROCEDURE DIVISION USING SIGNAL_ARRAY MECHANISM_ARRAY
GIVING SS_HAND.
BEGIN.
*
*
Initialize the return result
*
MOVE SS$_RESIGNAL TO SS_HAND.
IF SIGNAL_VALUE(1) NOT EQUAL SS$_SSFAIL
THEN
MOVE SS$_RESIGNAL TO SS_HAND
ELSE
*
*
Disable system service failure mode
*
CALL "SYS$SETSFM" USING BY VALUE 0
MOVE SIGNAL(2) TO MSGID
CALL "SYS$GETMSG" USING BY VALUE MSGID
BY REFERENCE MSGLEN
BY DESCRIPTOR ERRMSG
BY VALUE 0 0
GIVING STAT
IF STAT IS FAILURE
THEN
CALL "LIB$STOP" USING BY VALUE STAT
END-IF
DISPLAY "System service call failed with error:"
DISPLAY ERRMSG(1:MSGLEN)
*
*
This is where the handler would perform
*
corrective measures
*
.
*
.
*
.
*
MOVE SS$_CONTINUE TO SS_HAND
*
END-IF.
EXIT PROGRAM.
END PROGRAM SSHAND.
13–18 Using Compaq COBOL in the Alpha Common Language Environment
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......