Typical DCL Command Procedure to run the program :
$ DEFINE FOC$DIR1 SI$DATA $ DEL SI$FOCUS:*.FTM;*/LOG $ DEL SI$FOCUS:*.MAS;*/LOG $ SET DEFAULT SI$FOCUS $ FOCUS EXEC (FOCEXEC name) IENRTRM=(enrollment term) FIN $ ASSIGN PLAY.FTM COUSTA $ ASSIGN Z$PRT:(FOCEXEC name).PRT OUTFIL $ RUN (COBOL program name) $ EXIT
FOCUS program :
-* THIS FOCEXEC PRODUCES THE OUTPUT FILE OF COURSES THAT WILL BE -* FEED INTO A PROCEDURE THAT PRODUCES THE COURSE STATUS SHEETS -* VARIABLES USED : -* IENRTRM : ENROLLMENT TERM TO SELECT VALUES FROM -* JOIN CLEAR * SET LINES = 999999 SET PAGE = NOPAGE DEFINE FILE RCFILE SCND_FLD/A03 = EDIT(MAX_ENRL_RC,'$999'); TRD_FLD/A03 = EDIT(ENRL_CNT_RC,'$999'); DIFF_NUM/I4 = MAX_ENRL_RC - ENRL_CNT_RC; FULL_IND/A1 = IF DIFF_NUM LE 0 THEN '#' ELSE ' '; END TABLE FILE RCFILE PRINT CRS_ID_RC AS '' SCND_FLD AS '' TRD_FLD AS '' FULL_IND AS '' TERM_RC AS '' BY SITE_CODE_RC AS '' ON TABLE SAVE AS PLAY IF TERM_RC EQ '&IENRTRM' IF SECT_STAT_RC NE 'X' IF DEPT_REC_RC NE 'LSCE' OR 'LSCM' OR 'LSCR' IF CRS_COLL_RC NE 'CE' END JOIN CLEAR *
COBOL Program :
IDENTIFICATION DIVISION. PROGRAM-ID. COURSE-STATUS. AUTHOR. ME. DATE-COMPILED. ** ***************************************************************** ** * ** THIS PROGRAM WILL TAKE THE EXTRACT PRODUCED IN * ** SI$FOCUS:(FOCEXEC name).COM AND PRODUCE THE COURSE STATUS * ** SHEETS. * ** * ***************************************************************** ** ENVIRONMENT DIVISION. CONFIGURATION SECTION. ** INPUT-OUTPUT SECTION. FILE-CONTROL. ** SELECT EXTRACT-FILE ASSIGN TO COUSTA. ** ** SELECT OUTPUT-FILE ASSIGN TO OUTFIL. / DATA DIVISION. FILE SECTION. ** FD EXTRACT-FILE LABEL RECORDS ARE OMITTED DATA RECORD IS EXTRACT-REC. 01 EXTRACT-REC. 03 EXTRACT-CAMPUS PIC X(02). 03 EXTRACT-COURSE. 05 EXTRACT-COURSE-1 PIC X(07). 05 EXTRACT-COURSE-2 PIC X(02). 03 FILLER PIC X(02). 03 EXTRACT-LIMIT PIC 9(03). 03 EXTRACT-ENROLL PIC 9(03). 03 EXTRACT-IND PIC X(01). 03 EXTRACT-TERM. 05 EXTRACT-TERM-1 PIC X(02). 05 EXTRACT-TERM-2 PIC X(01). ** ** FD OUTPUT-FILE LABEL RECORDS ARE OMITTED DATA RECORD IS OUTPUT-REC. 01 OUTPUT-REC. * 03 FILLER PIC X(132). ** / WORKING-STORAGE SECTION. * 01 WS-DATE-IN. 05 WS-YEAR-IN PIC X(02) VALUE SPACE. 05 WS-MONTH-IN PIC X(02) VALUE SPACE. 05 WS-DAY-IN PIC X(02) VALUE SPACE. * 01 WS-TIME-IN. 05 WS-HRS-IN PIC X(02) VALUE SPACE. 05 WS-MIN-IN PIC X(02) VALUE SPACE. 05 WS-SEC-IN PIC X(02) VALUE SPACE. * 01 FIRST-HEADING. 05 FILLER PIC X(47) VALUE SPACE. 05 FILLER PIC X(36) VALUE "CURRICULUM COURSE ENROLLMENT SUMMARY". 05 FILLER PIC X(35) VALUE SPACE. 05 WS-MO-DATE PIC X(02) VALUE SPACE. 05 FILLER PIC X(01) VALUE "/". 05 WS-DAY-DATE PIC X(02) VALUE SPACE. 05 FILLER PIC X(01) VALUE "/". 05 WS-YR-DATE PIC X(02) VALUE SPACE. 05 FILLER PIC X(06) VALUE SPACE. * 01 SECOND-HEADING. 05 FILLER PIC X(48) VALUE SPACE. 05 FILLER PIC X(34) VALUE " Some College ". 05 FILLER PIC X(36) VALUE SPACE. 05 FILLER PIC X(06) VALUE "Page 1". 05 FILLER PIC X(08) VALUE SPACE. * 01 THIRD-HEADING. 05 FILLER PIC X(07) VALUE "Term: ". 05 WS-TERM-OUT. 10 WS-TERM-OUT-1 PIC X(02) VALUE SPACE. 10 FILLER PIC X(01) VALUE "-". 10 WS-TERM-OUT-2 PIC X(01) VALUE SPACE. 05 FILLER PIC X(78) VALUE SPACE. 05 FILLER PIC X(29) VALUE "ID:(COBOL program) Run Time: ". 05 WS-HRS-OUT PIC X(02) VALUE SPACE. 05 FILLER PIC X(01) VALUE ":". 05 WS-MIN-OUT PIC X(02) VALUE SPACE. 05 FILLER PIC X(09) VALUE SPACE. * 01 FOURTH-HEADING. 05 FILLER PIC X(03) VALUE SPACE. 05 FILLER PIC X(17) VALUE "Course Max Act". 05 FILLER PIC X(05) VALUE SPACE. 05 FILLER PIC X(17) VALUE "Course Max Act". 05 FILLER PIC X(05) VALUE SPACE. 05 FILLER PIC X(17) VALUE "Course Max Act". 05 FILLER PIC X(05) VALUE SPACE. 05 FILLER PIC X(17) VALUE "Course Max Act". 05 FILLER PIC X(05) VALUE SPACE. 05 FILLER PIC X(17) VALUE "Course Max Act". 05 FILLER PIC X(05) VALUE SPACE. 05 FILLER PIC X(19) VALUE "Course Max Act ". * 01 COURSE-DETAIL-LINE. 05 COURSE-DETAIL-LINE-1. 10 COURSE-DETAIL-LINE-1-IND PIC X(01) VALUE SPACE. 10 COURSE-DETAIL-LINE-1-COURSE PIC X(10) VALUE SPACE. 10 FILLER PIC X(02) VALUE SPACE. 10 COURSE-DETAIL-LINE-1-MAX PIC ZZ9 VALUE ZERO. 10 FILLER PIC X(01) VALUE SPACE. 10 COURSE-DETAIL-LINE-1-ENROLL PIC ZZ9 VALUE ZERO. 05 FILLER PIC X(02) VALUE SPACE. 05 COURSE-DETAIL-LINE-2. 10 COURSE-DETAIL-LINE-2-IND PIC X(01) VALUE SPACE. 10 COURSE-DETAIL-LINE-2-COURSE PIC X(10) VALUE SPACE. 10 FILLER PIC X(02) VALUE SPACE. 10 COURSE-DETAIL-LINE-2-MAX PIC ZZ9 VALUE ZERO. 10 FILLER PIC X(01) VALUE SPACE. 10 COURSE-DETAIL-LINE-2-ENROLL PIC ZZ9 VALUE ZERO. 05 FILLER PIC X(02) VALUE SPACE. 05 COURSE-DETAIL-LINE-3. 10 COURSE-DETAIL-LINE-3-IND PIC X(01) VALUE SPACE. 10 COURSE-DETAIL-LINE-3-COURSE PIC X(10) VALUE SPACE. 10 FILLER PIC X(02) VALUE SPACE. 10 COURSE-DETAIL-LINE-3-MAX PIC ZZ9 VALUE ZERO. 10 FILLER PIC X(01) VALUE SPACE. 10 COURSE-DETAIL-LINE-3-ENROLL PIC ZZ9 VALUE ZERO. 05 FILLER PIC X(02) VALUE SPACE. 05 COURSE-DETAIL-LINE-4. 10 COURSE-DETAIL-LINE-4-IND PIC X(01) VALUE SPACE. 10 COURSE-DETAIL-LINE-4-COURSE PIC X(10) VALUE SPACE. 10 FILLER PIC X(02) VALUE SPACE. 10 COURSE-DETAIL-LINE-4-MAX PIC ZZ9 VALUE ZERO. 10 FILLER PIC X(01) VALUE SPACE. 10 COURSE-DETAIL-LINE-4-ENROLL PIC ZZ9 VALUE ZERO. 05 FILLER PIC X(02) VALUE SPACE. 05 COURSE-DETAIL-LINE-5. 10 COURSE-DETAIL-LINE-5-IND PIC X(01) VALUE SPACE. 10 COURSE-DETAIL-LINE-5-COURSE PIC X(10) VALUE SPACE. 10 FILLER PIC X(02) VALUE SPACE. 10 COURSE-DETAIL-LINE-5-MAX PIC ZZ9 VALUE ZERO. 10 FILLER PIC X(01) VALUE SPACE. 10 COURSE-DETAIL-LINE-5-ENROLL PIC ZZ9 VALUE ZERO. 05 FILLER PIC X(02) VALUE SPACE. 05 COURSE-DETAIL-LINE-6. 10 COURSE-DETAIL-LINE-6-IND PIC X(01) VALUE SPACE. 10 COURSE-DETAIL-LINE-6-COURSE PIC X(10) VALUE SPACE. 10 FILLER PIC X(02) VALUE SPACE. 10 COURSE-DETAIL-LINE-6-MAX PIC ZZ9 VALUE ZERO. 10 FILLER PIC X(01) VALUE SPACE. 10 COURSE-DETAIL-LINE-6-ENROLL PIC ZZ9 VALUE ZERO. * 01 FOOTER-LINE. 05 FILLER PIC X(27) VALUE "# Indicates course is full". 05 FILLER PIC X(105) VALUE SPACE. * 01 FILE-STAT PIC X(03) VALUE SPACE. * 01 RECORD-COUNT PIC 9(04) VALUE ZERO. 01 NUM-OF-ROWS PIC 9(04) VALUE ZERO. 01 CHECK-COUNT PIC 9(04) VALUE ZERO. 01 WS-INDEX-1 PIC 9(04) VALUE ZERO. 01 WS-INDEX-2 PIC 9(04) VALUE ZERO. * 01 WS-ARRAY-LIST. 05 WS-ARRAY-COLUMN OCCURS 80 TIMES. 10 WS-ARRAY-ROW OCCURS 6 TIMES. 20 WS-ARRAY-ELEMENT. 30 FILLER PIC X(02) VALUE SPACE. 30 WS-ARRAY-IND PIC X(01) VALUE SPACE. 30 WS-ARRAY-COURSE. 40 WS-ARRAY-COURSE-1 PIC X(07) VALUE SPACE. 40 FILLER PIC X(01) VALUE "-". 40 WS-ARRAY-COURSE-2 PIC X(02) VALUE SPACE. 30 FILLER PIC X(02) VALUE SPACE. 30 WS-ARRAY-MAX PIC ZZ9 VALUE ZERO. 30 FILLER PIC X(01) VALUE SPACE. 30 WS-ARRAY-ENROLL PIC ZZ9 VALUE ZERO. / ** / PROCEDURE DIVISION. 100-READ-EXTRACT. OPEN INPUT EXTRACT-FILE. OPEN OUTPUT OUTPUT-FILE. PERFORM 200-PRODUCE-HEADING. MOVE ZERO TO RECORD-COUNT. PERFORM 300-COUNT-RECORDS UNTIL FILE-STAT IS EQUAL TO "END". CLOSE EXTRACT-FILE. OPEN INPUT EXTRACT-FILE. MOVE SPACES TO FILE-STAT. PERFORM 400-DETER-COLUMNS. READ EXTRACT-FILE AT END MOVE "END" TO FILE-STAT. PERFORM 500-LOAD-ARRAY VARYING WS-INDEX-2 FROM 1 BY 1 UNTIL WS-INDEX-2 IS GREATER THAN 6 OR FILE-STAT IS EQUAL TO "END". PERFORM 700-WRITE-OUT-ARRAY VARYING WS-INDEX-1 FROM 1 BY 1 UNTIL WS-INDEX-1 IS GREATER THAN NUM-OF-ROWS. MOVE SPACE TO OUTPUT-REC. MOVE FOOTER-LINE TO OUTPUT-REC. WRITE OUTPUT-REC AFTER ADVANCING 2 LINES. CLOSE EXTRACT-FILE. CLOSE OUTPUT-FILE. STOP RUN. ** 200-PRODUCE-HEADING. ACCEPT WS-DATE-IN FROM DATE. MOVE WS-YEAR-IN TO WS-YR-DATE. MOVE WS-MONTH-IN TO WS-MO-DATE. MOVE WS-DAY-IN TO WS-DAY-DATE. MOVE SPACE TO OUTPUT-REC. MOVE FIRST-HEADING TO OUTPUT-REC. WRITE OUTPUT-REC. MOVE SPACE TO OUTPUT-REC. MOVE SECOND-HEADING TO OUTPUT-REC. WRITE OUTPUT-REC. READ EXTRACT-FILE AT END MOVE "END" TO FILE-STAT. MOVE EXTRACT-TERM-1 TO WS-TERM-OUT-1. MOVE EXTRACT-TERM-2 TO WS-TERM-OUT-2. ACCEPT WS-TIME-IN FROM TIME. MOVE WS-HRS-IN TO WS-HRS-OUT. MOVE WS-MIN-IN TO WS-MIN-OUT. MOVE SPACE TO OUTPUT-REC. MOVE THIRD-HEADING TO OUTPUT-REC. WRITE OUTPUT-REC. MOVE SPACE TO OUTPUT-REC. MOVE FOURTH-HEADING TO OUTPUT-REC. WRITE OUTPUT-REC AFTER ADVANCING 2 LINES. ** 300-COUNT-RECORDS. READ EXTRACT-FILE AT END MOVE "END" TO FILE-STAT. ADD 1 TO RECORD-COUNT. ** 400-DETER-COLUMNS. DIVIDE 6 INTO RECORD-COUNT GIVING NUM-OF-ROWS. MULTIPLY 6 BY NUM-OF-ROWS GIVING CHECK-COUNT. IF CHECK-COUNT IS NOT EQUAL TO RECORD-COUNT THEN ADD 1 TO NUM-OF-ROWS. ** 500-LOAD-ARRAY. PERFORM 600-LOAD-ELEMENTS VARYING WS-INDEX-1 FROM 1 BY 1 UNTIL WS-INDEX-1 IS GREATER THAN NUM-OF-ROWS OR FILE-STAT IS EQUAL TO "END". ** 600-LOAD-ELEMENTS. MOVE EXTRACT-IND TO WS-ARRAY-IND (WS-INDEX-1, WS-INDEX-2). MOVE EXTRACT-COURSE-1 TO WS-ARRAY-COURSE-1 (WS-INDEX-1, WS-INDEX-2). MOVE EXTRACT-COURSE-2 TO WS-ARRAY-COURSE-2 (WS-INDEX-1, WS-INDEX-2). MOVE EXTRACT-LIMIT TO WS-ARRAY-MAX (WS-INDEX-1, WS-INDEX-2). MOVE EXTRACT-ENROLL TO WS-ARRAY-ENROLL (WS-INDEX-1, WS-INDEX-2). READ EXTRACT-FILE AT END MOVE "END" TO FILE-STAT. ** 700-WRITE-OUT-ARRAY. MOVE WS-ARRAY-IND (WS-INDEX-1, 1) TO COURSE-DETAIL-LINE-1-IND. MOVE WS-ARRAY-COURSE (WS-INDEX-1, 1) TO COURSE-DETAIL-LINE-1-COURSE. MOVE WS-ARRAY-MAX (WS-INDEX-1, 1) TO COURSE-DETAIL-LINE-1-MAX. MOVE WS-ARRAY-ENROLL (WS-INDEX-1, 1) TO COURSE-DETAIL-LINE-1-ENROLL. MOVE WS-ARRAY-IND (WS-INDEX-1, 2) TO COURSE-DETAIL-LINE-2-IND. MOVE WS-ARRAY-COURSE (WS-INDEX-1, 2) TO COURSE-DETAIL-LINE-2-COURSE. MOVE WS-ARRAY-MAX (WS-INDEX-1, 2) TO COURSE-DETAIL-LINE-2-MAX. MOVE WS-ARRAY-ENROLL (WS-INDEX-1, 2) TO COURSE-DETAIL-LINE-2-ENROLL. MOVE WS-ARRAY-IND (WS-INDEX-1, 3) TO COURSE-DETAIL-LINE-3-IND. MOVE WS-ARRAY-COURSE (WS-INDEX-1, 3) TO COURSE-DETAIL-LINE-3-COURSE. MOVE WS-ARRAY-MAX (WS-INDEX-1, 3) TO COURSE-DETAIL-LINE-3-MAX. MOVE WS-ARRAY-ENROLL (WS-INDEX-1, 3) TO COURSE-DETAIL-LINE-3-ENROLL. MOVE WS-ARRAY-IND (WS-INDEX-1, 4) TO COURSE-DETAIL-LINE-4-IND. MOVE WS-ARRAY-COURSE (WS-INDEX-1, 4) TO COURSE-DETAIL-LINE-4-COURSE. MOVE WS-ARRAY-MAX (WS-INDEX-1, 4) TO COURSE-DETAIL-LINE-4-MAX. MOVE WS-ARRAY-ENROLL (WS-INDEX-1, 4) TO COURSE-DETAIL-LINE-4-ENROLL. MOVE WS-ARRAY-IND (WS-INDEX-1,5) TO COURSE-DETAIL-LINE-5-IND. MOVE WS-ARRAY-COURSE (WS-INDEX-1, 5) TO COURSE-DETAIL-LINE-5-COURSE. MOVE WS-ARRAY-MAX (WS-INDEX-1, 5) TO COURSE-DETAIL-LINE-5-MAX. MOVE WS-ARRAY-ENROLL (WS-INDEX-1, 5) TO COURSE-DETAIL-LINE-5-ENROLL. MOVE WS-ARRAY-IND (WS-INDEX-1, 6) TO COURSE-DETAIL-LINE-6-IND. MOVE WS-ARRAY-COURSE (WS-INDEX-1, 6) TO COURSE-DETAIL-LINE-6-COURSE. MOVE WS-ARRAY-MAX (WS-INDEX-1, 6) TO COURSE-DETAIL-LINE-6-MAX. MOVE WS-ARRAY-ENROLL (WS-INDEX-1, 6) TO COURSE-DETAIL-LINE-6-ENROLL. MOVE SPACE TO OUTPUT-REC. MOVE COURSE-DETAIL-LINE TO OUTPUT-REC. WRITE OUTPUT-REC.
This page hosted by Get your own Free Homepage