IDENTIFICATION DIVISION.
PROGRAM-ID. RECRUIT.
AUTHOR. TORU SAKAGUCHI.
* ASSIGNMENT 4 - RECRUITING ACTIVITY REPORT
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT RECRUITING-ACTIVITY-FILE
ASSIGN TO "DRA2:[SAKAGUCH]RECRUITING.DATA".
SELECT RECRUITING-REPORT-FILE
ASSIGN TO "RECRUITING.REPORT".
DATA DIVISION.
FILE SECTION.
FD RECRUITING-ACTIVITY-FILE.
01 RECRUIT-RECORD PIC X(59).
FD RECRUITING-REPORT-FILE.
01 REPORT-LINE PIC X(80).
WORKING-STORAGE SECTION.
01 WS-RECRUIT-RECORD.
05 PIC XX.
05 PIC XX.
05 IN-COUNTY PIC X(9).
05 IN-HIGH-SCHOOL PIC X(20).
05 IN-RECRUITER-NAME PIC X(7).
05 PIC X(10).
05 IN-NBR-OF-PROSPECTS PIC 999.
05 IN-ACTIVITY-DATE PIC X(6).
01 WS-WORK-FIELDS.
05 RECRUITING-EOF-SWITCH PIC XXX VALUE "NO".
88 END-OF-FILE VALUE "YES".
05 WS-FIRST-TIME-THROUGH PIC XXX VALUE "YES".
88 FIRST-TIME-THROUGH VALUE "YES".
05 WS-RUN-DATE PIC 9(6).
05 WS-RUN-DATE-X REDEFINES WS-RUN-DATE.
10 WS-RUN-YY PIC XX.
10 WS-RUN-MM PIC XX.
10 WS-RUN-DD PIC XX.
05 WS-PAGE-NBR PIC 999.
05 WS-LINE-COUNT PIC 99.
05 WS-BLANK-LINES-NEEDED PIC 99.
05 WS-HOLD-RECRUITER-NAME PIC X(7).
05 WS-HOLD-COUNTY PIC X(9).
05 WS-EVENTS-FOR-COUNTY PIC 99 VALUE ZERO.
(omitted rest of Data Division)
PROCEDURE DIVISION.
0000-CREATE-NEW-MASTER-FILE.
OPEN INPUT RECRUITING-ACTIVITY-FILE
OUTPUT RECRUITING-REPORT-FILE
PERFORM 100-INITIALIZE
PERFORM UNTIL END-OF-FILE
READ RECRUITING-ACTIVITY-FILE INTO WS-RECRUIT-RECORD
AT END
MOVE "YES" TO RECRUITING-EOF-SWITCH
NOT AT END
PERFORM 200-PROCESS-RECORD
END-READ
END-PERFORM
PERFORM 880-WRITE-COUNTY-SUMMARY
PERFORM 885-WRITE-RECRUITER-SUMMARY
PERFORM 890-PRINT-FOOTER
PERFORM 895-PRINT-GRAND-TOTALS
CLOSE RECRUITING-ACTIVITY-FILE
RECRUITING-REPORT-FILE
STOP RUN
.
100-INITIALIZE.
ACCEPT WS-RUN-DATE FROM DATE
MOVE WS-RUN-YY TO HDR1-RUN-YY
MOVE WS-RUN-MM TO HDR1-RUN-MM
MOVE WS-RUN-DD TO HDR1-RUN-DD
MOVE ZERO TO WS-PAGE-NBR
MOVE LOW-VALUES TO WS-HOLD-RECRUITER-NAME
MOVE LOW-VALUES TO WS-HOLD-COUNTY
.
200-PROCESS-RECORD.
IF FIRST-TIME-THROUGH
PERFORM 870-PRINT-HEADINGS
MOVE 1 TO WS-TOTAL-RECRUITERS
MOVE 1 TO WS-TOTAL-COUNTIES
MOVE IN-RECRUITER-NAME TO WS-HOLD-RECRUITER-NAME
MOVE IN-COUNTY TO WS-HOLD-COUNTY
MOVE IN-COUNTY TO OUT-COUNTY
MOVE "NO" TO WS-FIRST-TIME-THROUGH
ELSE
IF WS-HOLD-RECRUITER-NAME NOT EQUAL IN-RECRUITER-NAME
PERFORM 880-WRITE-COUNTY-SUMMARY
PERFORM 885-WRITE-RECRUITER-SUMMARY
PERFORM 870-PRINT-HEADINGS
ADD 1 TO WS-TOTAL-RECRUITERS
ADD 1 TO WS-TOTAL-COUNTIES
MOVE IN-RECRUITER-NAME TO WS-HOLD-RECRUITER-NAME
MOVE IN-COUNTY TO WS-HOLD-COUNTY
MOVE IN-COUNTY TO OUT-COUNTY
ELSE
IF WS-HOLD-COUNTY NOT EQUAL IN-COUNTY
PERFORM 880-WRITE-COUNTY-SUMMARY
ADD 1 TO WS-TOTAL-COUNTIES
MOVE IN-COUNTY TO WS-HOLD-COUNTY
MOVE IN-COUNTY TO OUT-COUNTY
ELSE
MOVE SPACES TO OUT-COUNTY
END-IF
END-IF
END-IF
MOVE IN-HIGH-SCHOOL TO OUT-EVENT
MOVE IN-ACTIVITY-DATE TO OUT-DATE
MOVE IN-NBR-OF-PROSPECTS TO OUT-PROSPECTS
WRITE REPORT-LINE FROM RPT-DETAIL-LINE AFTER ADVANCING 3 LINES
ADD 3 TO WS-LINE-COUNT
ADD 1 TO WS-EVENTS-FOR-COUNTY
ADD 1 TO WS-EVENTS-FOR-RECRUITER
ADD IN-NBR-OF-PROSPECTS TO WS-PROSPECTS-FOR-COUNTY
ADD IN-NBR-OF-PROSPECTS TO WS-PROSPECTS-FOR-RECRUITER
ADD IN-NBR-OF-PROSPECTS TO WS-TOTAL-PROSPECTS
.
870-PRINT-HEADINGS.
ADD 1 TO WS-PAGE-NBR
MOVE WS-PAGE-NBR TO RPT-HDR2-PAGE-NBR
MOVE IN-RECRUITER-NAME TO RPT-HDR3-RECRUITER
WRITE REPORT-LINE FROM RPT-BLANK-LINE AFTER ADVANCING PAGE
WRITE REPORT-LINE FROM RPT-HDR1 AFTER ADVANCING 3 LINES
WRITE REPORT-LINE FROM RPT-HDR2 AFTER ADVANCING 1 LINE
WRITE REPORT-LINE FROM RPT-HDR3 AFTER ADVANCING 4 LINES
WRITE REPORT-LINE FROM RPT-HDR4 AFTER ADVANCING 3 LINES
WRITE REPORT-LINE FROM RPT-HDR5 AFTER ADVANCING 1 LINE
WRITE REPORT-LINE FROM RPT-HDR6 AFTER ADVANCING 1 LINE
MOVE 14 TO WS-LINE-COUNT
.
880-WRITE-COUNTY-SUMMARY.
IF WS-LINE-COUNT IS GREATER THAN 54
PERFORM 890-PRINT-FOOTER
PERFORM 870-PRINT-HEADINGS
END-IF
MOVE WS-EVENTS-FOR-COUNTY TO CTY-TTL-EVENTS
MOVE WS-HOLD-COUNTY TO CTY-TTL-COUNTY
MOVE WS-PROSPECTS-FOR-COUNTY TO CTY-TTL-PROSPECTS
WRITE REPORT-LINE FROM RPT-COUNTY-TOTAL-LINE AFTER ADVANCING 3 LINES
ADD 3 TO WS-LINE-COUNT
MOVE ZEROES TO WS-EVENTS-FOR-COUNTY
MOVE ZEROES TO WS-PROSPECTS-FOR-COUNTY
.
885-WRITE-RECRUITER-SUMMARY.
IF WS-LINE-COUNT IS GREATER THAN 54
PERFORM 890-PRINT-FOOTER
PERFORM 870-PRINT-HEADINGS
END-IF
MOVE WS-EVENTS-FOR-RECRUITER TO RCTR-TTL-EVENTS
MOVE WS-HOLD-RECRUITER-NAME TO RCTR-TTL-RECRUITER
MOVE WS-PROSPECTS-FOR-RECRUITER TO RCTR-TTL-PROSPECTS
WRITE REPORT-LINE FROM RPT-RECRUITER-TOTAL-LINE
AFTER ADVANCING 3 LINES
ADD 3 TO WS-LINE-COUNT
MOVE ZEROES TO WS-EVENTS-FOR-RECRUITER
MOVE ZEROES TO WS-PROSPECTS-FOR-RECRUITER
.
890-PRINT-FOOTER.
SUBTRACT WS-LINE-COUNT FROM 54 GIVING WS-BLANK-LINES-NEEDED
WRITE REPORT-LINE FROM RPT-BLANK-LINE
AFTER ADVANCING WS-BLANK-LINES-NEEDED
WRITE REPORT-LINE FROM RPT-FOOTER AFTER ADVANCING 1 LINE
.
895-PRINT-GRAND-TOTALS.
ADD 1 TO WS-PAGE-NBR
MOVE WS-PAGE-NBR TO RPT-HDR2-PAGE-NBR
MOVE WS-TOTAL-COUNTIES TO RPT-GRAND-COUNTIES
MOVE WS-TOTAL-RECRUITERS TO RPT-GRAND-RECRUITERS
MOVE WS-TOTAL-PROSPECTS TO RPT-GRAND-PROSPECTS
WRITE REPORT-LINE FROM RPT-BLANK-LINE
AFTER ADVANCING PAGE
WRITE REPORT-LINE FROM RPT-HDR1
AFTER ADVANCING 3 LINES
WRITE REPORT-LINE FROM RPT-HDR2
AFTER ADVANCING 1 LINE
WRITE REPORT-LINE FROM RPT-GRAND-TOTAL-HDR
AFTER ADVANCING 4 LINES
WRITE REPORT-LINE FROM RPT-GRAND-TOTAL-COUNTIES
AFTER ADVANCING 4 LINES
WRITE REPORT-LINE FROM RPT-GRAND-TOTAL-RECRUITERS
AFTER ADVANCING 3 LINES
WRITE REPORT-LINE FROM RPT-GRAND-TOTAL-PROSPECTS
AFTER ADVANCING 3 LINES
MOVE 19 TO WS-LINE-COUNT
PERFORM 890-PRINT-FOOTER
.