-
Notifications
You must be signed in to change notification settings - Fork 9
/
cisp-error.cbl
67 lines (67 loc) · 2.6 KB
/
cisp-error.cbl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
******************************************************************
* Author:
* Date:
* Purpose:
* Tectonics: cobc
******************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. CISP-ERROR.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
*****************************************
* WS Shared with LOGGER SubRoutine
*****************************************
01 WS-LOG-OPERATION-FLAG PIC X(5).
01 WS-LOG-RECORD.
02 WS-LOG-RECORD-FUNCTION-NAME PIC X(40).
02 WS-LOG-RECORD-MESSAGE PIC X(100).
*****************************************
* WS Shared with RECUSRION SubRoutine
*****************************************
01 WS-RECURSION-FLAG PIC X(30).
LINKAGE SECTION.
01 LS-CISP-ERROR-FLAG PIC X(30).
01 LS-ERROR.
02 LS-ERROR-NAME PIC X(40).
02 LS-ERROR-FATAL PIC X.
88 LS-ERROR-FATAL-YES VALUE 'Y', FALSE 'N'.
02 LS-ERROR-MESSAGE PIC X(100).
PROCEDURE DIVISION USING LS-CISP-ERROR-FLAG, LS-ERROR.
MAIN-PROCEDURE.
EVALUATE LS-CISP-ERROR-FLAG
WHEN "THROW-ERROR"
PERFORM THROW-ERROR-PROCEDURE.
THROW-ERROR-PROCEDURE.
DISPLAY LS-ERROR-NAME.
DISPLAY LS-ERROR-MESSAGE.
IF LS-ERROR-FATAL-YES THEN
PERFORM END-CISP-PROCEDURE
END-IF.
END-CISP-PROCEDURE.
PERFORM LOG-ERROR-PROCEDURE.
PERFORM CLOSE-OPEN-FILES-PROCEDURE.
STOP RUN.
LOG-ERROR-PROCEDURE.
******log error
MOVE "ADD" TO WS-LOG-OPERATION-FLAG.
MOVE "CISP-ERROR" TO
WS-LOG-RECORD-FUNCTION-NAME.
STRING LS-ERROR-NAME DELIMITED BY SIZE
":" DELIMITED BY SIZE
LS-ERROR-MESSAGE DELIMITED BY SIZE
"Fatal:" DELIMITED BY SIZE
LS-ERROR-FATAL DELIMITED BY SIZE
INTO WS-LOG-RECORD-MESSAGE.
CALL 'LOGGER' USING WS-LOG-OPERATION-FLAG, WS-LOG-RECORD.
CLOSE-OPEN-FILES-PROCEDURE.
MOVE "STACK-FILE-STATUS" TO WS-RECURSION-FLAG.
CALL "RECURSION" USING WS-RECURSION-FLAG.
DISPLAY "RECURSION:" WS-RECURSION-FLAG.
IF WS-RECURSION-FLAG = "Y" THEN
MOVE "CLOSE" TO WS-RECURSION-FLAG
CALL "RECURSION" USING WS-RECURSION-FLAG
END-IF.
MOVE "CLOSE" TO WS-LOG-OPERATION-FLAG.
CALL 'LOGGER' USING WS-LOG-OPERATION-FLAG, WS-LOG-RECORD.
END PROGRAM CISP-ERROR.