-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILDING-INQUIRY.cbl
88 lines (81 loc) · 3.5 KB
/
BUILDING-INQUIRY.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
IDENTIFICATION DIVISION.
PROGRAM-ID. BUILDING-INQUIRY.
*-----------------------------------------------------------------
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 WS-BLD.
03 WS-BLD-ROOM PIC X(12).
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 'INQUIRY BUILDING'.
01 SCRN-BLD-ROOM.
03 SCRN-BLD-NAME.
05 LINE 8 COL 33 VALUE 'BUILDING NAME: '.
05 COL 50 PIC X(8) TO WS-BLD-NAME
AUTO REQUIRED.
03 SCRN-ROOM-NO.
05 LINE 10 COL 33 VALUE 'ROOM NUMBER : '.
05 COL 50 PIC X(4) TO WS-ROOM-NO
AUTO REQUIRED.
01 SCRN-DATA.
03 LINE 12 COL 33 VALUE 'MAX SEATS :'.
03 COL 50 PIC Z9 FROM WS-MAX-SEAT.
01 SCRN-ERR.
03 LINE 12 COL 38 VALUE 'ROOM NOT FOUND'.
*-----------------------------------------------------------------
PROCEDURE DIVISION.
000-MAIN.
OPEN INPUT 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-BLD-ROOM
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-ERR
DISPLAY SCRN-ANOTHER
ACCEPT SCRN-ANOTHER
NOT INVALID KEY
MOVE BLD-MAX-SEAT TO WS-MAX-SEAT
DISPLAY SCRN-DATA
DISPLAY SCRN-ANOTHER
ACCEPT SCRN-ANOTHER
END-READ
END-PERFORM.
CLOSE BLD-MASTER.
EXIT PROGRAM.