-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathctlmnt01.cbl
208 lines (163 loc) · 5.75 KB
/
ctlmnt01.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
IDENTIFICATION DIVISION.
PROGRAM-ID. CTLMNT01.
*--------------------------------
* Change and Inquire only
* for the bills system control
* file.
*--------------------------------
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
COPY "slcontrl.cbl".
DATA DIVISION.
FILE SECTION.
COPY "fdcontrl.cbl".
WORKING-STORAGE SECTION.
77 MENU-PICK PIC 9.
88 MENU-PICK-IS-VALID VALUES 0 THRU 2.
77 THE-MODE PIC X(7).
77 RECORD-FOUND PIC X.
77 WHICH-FIELD PIC 9.
77 A-DUMMY PIC X.
PROCEDURE DIVISION.
PROGRAM-BEGIN.
PERFORM OPENING-PROCEDURE.
PERFORM MAIN-PROCESS.
PERFORM CLOSING-PROCEDURE.
PROGRAM-EXIT.
EXIT PROGRAM.
PROGRAM-DONE.
STOP RUN.
OPENING-PROCEDURE.
OPEN I-O CONTROL-FILE.
CLOSING-PROCEDURE.
CLOSE CONTROL-FILE.
MAIN-PROCESS.
PERFORM GET-MENU-PICK.
PERFORM MAINTAIN-THE-FILE
UNTIL MENU-PICK = 0.
*--------------------------------
* MENU
*--------------------------------
GET-MENU-PICK.
PERFORM DISPLAY-THE-MENU.
PERFORM ACCEPT-MENU-PICK.
PERFORM RE-ACCEPT-MENU-PICK
UNTIL MENU-PICK-IS-VALID.
DISPLAY-THE-MENU.
PERFORM CLEAR-SCREEN.
DISPLAY " PLEASE SELECT:".
DISPLAY " ".
DISPLAY " 1. CHANGE CONTROL INFORMATION".
DISPLAY " 2. DISPLAY CONTROL INFORMATION".
DISPLAY " ".
DISPLAY " 0. EXIT".
PERFORM SCROLL-LINE 8 TIMES.
ACCEPT-MENU-PICK.
DISPLAY "YOUR CHOICE (0-2)?".
ACCEPT MENU-PICK.
RE-ACCEPT-MENU-PICK.
DISPLAY "INVALID SELECTION - PLEASE RE-TRY.".
PERFORM ACCEPT-MENU-PICK.
CLEAR-SCREEN.
PERFORM SCROLL-LINE 25 TIMES.
SCROLL-LINE.
DISPLAY " ".
MAINTAIN-THE-FILE.
PERFORM DO-THE-PICK.
PERFORM GET-MENU-PICK.
DO-THE-PICK.
IF MENU-PICK = 1
PERFORM CHANGE-MODE
ELSE
IF MENU-PICK = 2
PERFORM INQUIRE-MODE.
*--------------------------------
* CHANGE
*--------------------------------
CHANGE-MODE.
MOVE "CHANGE" TO THE-MODE.
PERFORM GET-CONTROL-RECORD.
IF RECORD-FOUND = "Y"
PERFORM CHANGE-RECORDS.
CHANGE-RECORDS.
PERFORM GET-FIELD-TO-CHANGE.
PERFORM CHANGE-ONE-FIELD.
PERFORM GET-CONTROL-RECORD.
GET-FIELD-TO-CHANGE.
PERFORM DISPLAY-ALL-FIELDS.
PERFORM ASK-WHICH-FIELD.
ASK-WHICH-FIELD.
MOVE 1 TO WHICH-FIELD.
CHANGE-ONE-FIELD.
PERFORM CHANGE-THIS-FIELD.
CHANGE-THIS-FIELD.
IF WHICH-FIELD = 1
PERFORM ENTER-CONTROL-LAST-VOUCHER.
PERFORM REWRITE-CONTROL-RECORD.
*--------------------------------
* INQUIRE
*--------------------------------
INQUIRE-MODE.
MOVE "DISPLAY" TO THE-MODE.
PERFORM GET-CONTROL-RECORD.
IF RECORD-FOUND = "Y"
PERFORM INQUIRE-RECORDS.
INQUIRE-RECORDS.
PERFORM DISPLAY-ALL-FIELDS.
PERFORM PRESS-ENTER.
PRESS-ENTER.
DISPLAY " ".
DISPLAY "PRESS ENTER TO CONTINUE".
ACCEPT A-DUMMY.
*--------------------------------
* Routines for Change
*--------------------------------
ENTER-CONTROL-LAST-VOUCHER.
PERFORM ACCEPT-CONTROL-LAST-VOUCHER.
ACCEPT-CONTROL-LAST-VOUCHER.
DISPLAY "ENTER LAST VOUCHER NUMBER".
ACCEPT CONTROL-LAST-VOUCHER.
*--------------------------------
* Routines shared by Change and Inquire
*--------------------------------
INIT-CONTROL-RECORD.
MOVE ZEROES TO CONTROL-RECORD.
ENTER-CONTROL-KEY.
MOVE 1 TO CONTROL-KEY.
GET-CONTROL-RECORD.
PERFORM INIT-CONTROL-RECORD.
PERFORM ENTER-CONTROL-KEY.
MOVE "N" TO RECORD-FOUND.
PERFORM FIND-CONTROL-RECORD.
FIND-CONTROL-RECORD.
PERFORM READ-CONTROL-RECORD.
IF RECORD-FOUND = "N"
DISPLAY "RECORD NOT FOUND"
DISPLAY "YOU MUST RUN CTLBLD01"
DISPLAY "TO CREATE THIS FILE".
DISPLAY-ALL-FIELDS.
DISPLAY " ".
PERFORM DISPLAY-CONTROL-LAST-VOUCHER.
DISPLAY " ".
DISPLAY-CONTROL-LAST-VOUCHER.
DISPLAY "1. LAST VOUCHER NUMBER: "
CONTROL-LAST-VOUCHER.
*--------------------------------
* File I-O Routines
*--------------------------------
READ-CONTROL-RECORD.
MOVE "Y" TO RECORD-FOUND.
READ CONTROL-FILE RECORD
INVALID KEY
MOVE "N" TO RECORD-FOUND.
*or READ CONTROL-FILE RECORD WITH LOCK
* INVALID KEY
* MOVE "N" TO RECORD-FOUND.
*or READ CONTROL-FILE RECORD WITH HOLD
* INVALID KEY
* MOVE "N" TO RECORD-FOUND.
REWRITE-CONTROL-RECORD.
REWRITE CONTROL-RECORD
INVALID KEY
DISPLAY "ERROR REWRITING CONTROL RECORD".