-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILDING-UPDATE.cbl
105 lines (97 loc) · 4.42 KB
/
BUILDING-UPDATE.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
IDENTIFICATION DIVISION.
PROGRAM-ID. BUILDING-UPDATE.
*-----------------------------------------------------------------
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT BLD-MASTER ASSIGN TO
'../FILES/BUILDING-MASTER.DAT'
ORGANIZATION IS INDEXED
ACCESS IS RANDOM
RECORD KEY IS BLD-BUILDING-ROOM
FILE STATUS IS WS-STAT.
*-----------------------------------------------------------------
DATA DIVISION.
*-----------------------------------------------------------------
FILE SECTION.
FD BLD-MASTER.
01 BLD-REC.
03 BLD-BUILDING-ROOM PIC X(12).
03 BLD-MAX-SEAT PIC 99.
WORKING-STORAGE SECTION.
COPY WS-COMMON.
01 MISC-VARS.
03 WS-BLD-ROOM PIC X(12).
03 WS-OLD-MAX-SEAT PIC 99.
01 WS-DTL-LN.
03 WS-BLD-NAME PIC X(8).
03 WS-SPACE PIC X VALUE SPACE.
03 WS-ROOM-NO PIC X(4).
03 WS-MAX-SEAT PIC 99.
*-----------------------------------------------------------------
SCREEN SECTION.
COPY SCR-COMMON.
01 SCRN-TITLE.
03 LINE 3 COL 37 VALUE 'UPDATE BUILDING'.
01 SCRN-DATA.
03 SCRN-BLD-NAME.
05 LINE 7 COL 30 VALUE 'BUILDING NAME: '.
05 COL 45 PIC X(8) TO WS-BLD-NAME
AUTO REQUIRED.
03 SCRN-ROOM-NO.
05 LINE 9 COL 30 VALUE 'ROOM NUMBER : '.
05 COL 45 PIC X(4) TO WS-ROOM-NO
AUTO REQUIRED.
01 SCRN-SEAT.
03 SCRN-NEW-MAX-SEAT.
05 LINE 11 COL 30 VALUE 'MAX SEAT : '.
05 COL 45 PIC Z9 USING WS-MAX-SEAT.
*-----------------------------------------------------------------
PROCEDURE DIVISION.
000-MAIN.
OPEN I-O BLD-MASTER.
MOVE 'Y' TO WS-ANOTHER.
PERFORM UNTIL ANOTHER
ACCEPT WS-DATE FROM DATE
ACCEPT WS-TIME FROM TIME
DISPLAY HEADER
DISPLAY SCRN-TITLE
DISPLAY SCRN-DATA
ACCEPT SCRN-BLD-NAME
ACCEPT SCRN-ROOM-NO
STRING
WS-BLD-NAME DELIMITED BY SPACE
WS-SPACE DELIMITED BY SIZE
WS-ROOM-NO DELIMITED BY SPACE
INTO WS-BLD-ROOM
MOVE WS-BLD-ROOM TO BLD-BUILDING-ROOM
READ BLD-MASTER
INVALID KEY
DISPLAY SCRN-SAVE-ERROR
DISPLAY SCRN-ANOTHER
ACCEPT SCRN-ANOTHER
NOT INVALID KEY
MOVE BLD-MAX-SEAT TO WS-MAX-SEAT
MOVE SPACE TO WS-SAVE
PERFORM UNTIL WS-SAVE = 'Y' OR WS-SAVE = 'N'
DISPLAY SCRN-SEAT
ACCEPT SCRN-NEW-MAX-SEAT
DISPLAY SCRN-SAVE
ACCEPT SCRN-SAVE
END-PERFORM
IF SAVE
THEN
MOVE WS-MAX-SEAT TO BLD-MAX-SEAT
REWRITE BLD-REC
DISPLAY SCRN-SAVED
DISPLAY SCRN-ANOTHER
ACCEPT SCRN-ANOTHER
ELSE
DISPLAY SCRN-CANCEL
DISPLAY SCRN-ANOTHER
ACCEPT SCRN-ANOTHER
END-IF
END-READ
END-PERFORM.
CLOSE BLD-MASTER.
EXIT PROGRAM.