-
Notifications
You must be signed in to change notification settings - Fork 0
/
REPORT-COURSE-BY-INST.cbl
120 lines (116 loc) · 4.98 KB
/
REPORT-COURSE-BY-INST.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
IDENTIFICATION DIVISION.
PROGRAM-ID. REPORT-COURSE-BY-INST.
*-----------------------------------------------------------------
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT IN-FILE ASSIGN TO
'../FILES/SCHEDULE-MASTER.DAT'
ORGANIZATION IS INDEXED
ACCESS IS SEQUENTIAL
RECORD KEY IS SCHEDULE-ID-I
FILE STATUS IS WS-STAT.
*-----------------------------------------------------------------
DATA DIVISION.
*-----------------------------------------------------------------
FD IN-FILE.
01 IN-REC.
03 SCHEDULE-ID-I.
05 SCHEDULE-YEAR PIC X(4).
05 FILLER PIC X.
05 SCHEDULE-SEM PIC XX.
05 FILLER PIC X.
05 SCHEDULE-CRN PIC X(4).
03 FILLER PIC X.
03 COURSE-ID-I.
05 COURSE-ID-DEPT PIC X(4).
05 FILLER PIC X.
05 COURSE-ID-REST PIC X(4).
03 FILLER PIC X.
03 TIMEDAY-I PIC X(20).
03 FILLER PIC X.
03 BUILDING-ID-I PIC X(11).
03 FILLER PIC X.
03 INSTRUCTOR-ID-I PIC X(4).
03 FILLER PIC X(3).
03 OPEN-SEATS-I PIC X(2).
WORKING-STORAGE SECTION.
COPY WS-COMMON.
03 WS-INST-ID PIC 9(4).
03 WS-YEAR PIC 9(4).
03 WS-SEM PIC 99.
01 WS-PG-BREAK.
03 FILLER PIC X(15) VALUE 'PRESS ENTER TO '.
03 FILLER PIC X(13) VALUE 'DISPLAY MORE '.
03 FILLER PIC X(49) VALUE 'RECORDS'.
01 WS-HEADER.
03 FILLER PIC X(13) VALUE 'YEAR SEM CRN '.
03 FILLER PIC X(10) VALUE 'COURSE ID'.
03 FILLER PIC X(21) VALUE 'TIME DAYS'.
03 FILLER PIC X(12) VALUE 'BLD/ROOM'.
03 FILLER PIC X(5) VALUE 'INST'.
03 FILLER PIC X(5) VALUE 'SEATS'.
SCREEN SECTION.
COPY SCR-COMMON.
01 SCRN-TITLE.
03 LINE 3 COL 36 VALUE 'SCHEDULE BY DEPARTMENT'.
01 SCRN-DISPLAY.
03 LINE 5 COL 30 VALUE 'YEAR:'.
03 COL 40 PIC 9999 USING WS-YEAR
AUTO REQUIRED.
03 LINE 6 COL 30 VALUE 'SEMESTER'.
03 COL 40 PIC 99 USING WS-SEM
AUTO REQUIRED.
03 LINE 7 COL 30 VALUE 'INST-ID'.
03 COL 40 PIC XXXX USING WS-INST-ID
AUTO REQUIRED.
*-----------------------------------------------------------------
PROCEDURE DIVISION.
000-MAIN.
MOVE 'Y' TO WS-ANOTHER.
PERFORM UNTIL ANOTHER
ACCEPT WS-DATE FROM DATE
ACCEPT WS-TIME FROM TIME
MOVE ZEROS TO WS-YEAR,WS-SEM,WS-INST-ID
DISPLAY HEADER,SCRN-DISPLAY
ACCEPT SCRN-DISPLAY
PERFORM 100-LIST
DISPLAY WS-BLNK-LN
DISPLAY 'PRESS ENTER TO GO BACK TO MENU'
ACCEPT WS-RESP
DISPLAY SCRN-ANOTHER
ACCEPT SCRN-ANOTHER
END-PERFORM.
DISPLAY 'PRESS ENTER TO GO BACK TO MENU'.
ACCEPT WS-RESP.
EXIT PROGRAM.
100-LIST.
OPEN INPUT IN-FILE
MOVE 'N' TO WS-EOF.
MOVE 0 TO WS-COUNTER.
DISPLAY WS-BLNK-LN.
DISPLAY WS-HEADER.
DISPLAY WS-BLNK-LN.
PERFORM UNTIL EOF
READ IN-FILE
AT END
MOVE 'Y' TO WS-EOF
NOT AT END
IF SCHEDULE-YEAR EQUALS WS-YEAR
AND SCHEDULE-SEM EQUALS WS-SEM
AND INSTRUCTOR-ID-I EQUALS WS-INST-ID
THEN
DISPLAY IN-REC
ADD 1 TO WS-COUNTER
IF WS-COUNTER = 15 THEN
DISPLAY WS-BLNK-LN
DISPLAY WS-PG-BREAK
ACCEPT WS-RESP
DISPLAY HEADER, WS-HEADER
DISPLAY WS-BLNK-LN
MOVE 0 TO WS-COUNTER
END-IF
END-IF
END-READ
END-PERFORM.
CLOSE IN-FILE.