I don't know where my stop run should go in my control break. please help.
IDENTIFICATION DIVISION.
PROGRAM-ID. ASSGN-04.
AUTHOR. JESSICA BENNETT
DATE-WRITTEN. 10-29-02.
*REMARKS. THIS PROGRAM LISTS DATA, 80-80.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES. C01 IS NEXT-PAGE.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT DATA-FILE ASSIGN TO "A:CHDATA04.DAT".
SELECT PRINT-FILE ASSIGN TO "A:BREAK.CBL".
DATA DIVISION.
FILE SECTION.
FD DATA-FILE.
01 DATA-RECORD.
05 ITEM-NUMBER PIC X(9).
05 ITEM-DESCRIP PIC X(20).
05 FILLER PIC X(10).
05 QUANTITY-SOLD PIC 999.
05 UNIT-PRICE PIC 999V99.
05 SALES-DATE.
10 M-IN PIC 99.
10 D-IN PIC 99.
10 Y-IN PIC 99.
05 SALESMAN PIC X(2).
05 PIC X.
FD PRINT-FILE.
01 PRINT-RECORD PIC x(80).
WORKING-STORAGE SECTION.
01 WS-WORK-AREAS.
05 WS-HOLD-ITEM-NUMBER PIC X(9) VALUE ZEROS.
05 WS-HOLD-SALESMAN PIC X(2) VALUE ZEROS.
05 ARE-THERE-MORE-RECORDS PIC X(3) VALUE "YES".
88 MORE-RECORDS VALUE "YES".
88 NO-MORE-RECORDS VALUE "NO".
05 FIRST-RECORD PIC X(3) VALUE "YES".
05 WS-ITEM-TOTAL PIC 9(4)V99 VALUE ZEROS.
05 WS-SALES-TOTAL PIC 9(4)V99 VALUE ZEROS.
01 NAME-RECORD.
05 PIC x(50) VALUE SPACES.
05 PIC x(30) VALUE "JESSICA BENNETT".
01 HEADING-1.
05 HEADER-DATE PIC x(8) VALUE "11/05/02".
05 PIC x(23) VALUE SPACES.
05 PIC x(18) VALUE "KITCHEN INDUSTRIES".
05 PIC x(24) VALUE SPACES.
05 PIC x(5) VALUE "PAGE".
05 PAGE-NUMBER-OUT PIC Z9.
01 HEADING-2.
05 PIC X(7) VALUE SPACES.
05 PIC X(12) VALUE "ITEM NUMBER".
05 PIC X(6) VALUE SPACES.
05 PIC X(16) VALUE "ITEM DESCRIPTION".
01 HEADING-3.
05 PIC X(7) VALUE SPACES.
05 PIC X(9) VALUE "SALESMAN".
05 PIC X(6) VALUE SPACES.
05 PIC X(13) VALUE "QUANTITY SOLD".
05 PIC X(6) VALUE SPACES.
05 PIC X(5) VALUE "SALES".
01 ITEM-DETAIL-LINE.
05 PIC X(1) VALUE SPACES.
05 ITEM-NUMBER-OUT PIC X(9).
05 PIC X(8) VALUE SPACES.
05 ITEM-DESCRIP-OUT PIC X(16).
01 SALESMAN-DETAIL-LINE.
05 PIC X(8) VALUE SPACES.
05 QUANTITY-SOLD-OUT PIC ZZ9.
05 PIC X(5) VALUE SPACES.
05 SALESMAN-OUT PIC X(2).
05 PIC X(1) VALUE SPACES.
05 SALES-OUT PIC Z(7).99.
01 TOTAL-PRINT-RECORD.
05 PIC X(40) VALUE SPACES.
05 TOTAL-ITEM-TOTAL PIC $$$,$$$.99.
05 PIC X(3) VALUE SPACES.
05 TOTAL-SALES PIC $,$$$.99.
05 UNUSED PIC X(9) VALUE SPACES.
01 COUNTERS.
05 PAGE-NUMBER PIC S99 VALUE ZERO PACKED-DECIMAL.
05 LINE-COUNT PIC S99 VALUE ZERO PACKED-DECIMAL.
05 WS-TOTAL-ITEM-TOTAL PIC S9(7)V99 VALUE ZERO.
05 WS-TOTAL-SALES PIC S9(4)V99 VALUE ZERO.
05 WS-SALES PIC S9(4)V99 VALUE ZERO.
01 FLAGS.
05 MORE-DATA-FLAG PIC x(3) VALUE "YES".
88 NO-MORE-DATA VALUE "No".
PROCEDURE DIVISION.
100-MAIN-LINE-ROUTINE.
PERFORM 700-INITIALIZATION-ROUTINE.
PERFORM 200-DETAIL-ROUTINE
UNTIL NO-MORE-DATA.
PERFORM 400-ITEM-NUMBER-BREAK
PERFORM 500-FINAL-ROUTINE.
200-DETAIL-ROUTINE.
EVALUATE TRUE
WHEN FIRST-RECORD = "YES"
MOVE SALESMAN TO WS-HOLD-SALESMAN
MOVE ITEM-NUMBER TO WS-HOLD-ITEM-NUMBER
PERFORM 600-HEADER-ROUTINE
MOVE "NO" TO FIRST-RECORD
WHEN ITEM-NUMBER NOT = WS-HOLD-ITEM-NUMBER
PERFORM 400-ITEM-NUMBER-BREAK
WHEN SALESMAN NOT = WS-HOLD-SALESMAN
PERFORM 300-FIRST-BREAK
END-EVALUATE.
PERFORM 800-INITIALIZATION-ROUTINE.
STOP RUN.
300-FIRST-BREAK.
MOVE WS-ITEM-TOTAL TO TOTAL-ITEM-TOTAL
MOVE WS-HOLD-SALESMAN TO SALESMAN-OUT
WRITE PRINT-RECORD FROM SALESMAN-DETAIL-LINE
AFTER ADVANCING 2 LINES
ADD WS-SALES TO WS-ITEM-TOTAL
IF MORE-RECORDS
MOVE ZERO TO WS-ITEM-TOTAL
MOVE QUANTITY-SOLD TO WS-HOLD-SALESMAN
END-IF.
400-ITEM-NUMBER-BREAK.
PERFORM 300-FIRST-BREAK
MOVE WS-SALES TO TOTAL-SALES
WRITE PRINT-RECORD FROM ITEM-DETAIL-LINE
AFTER ADVANCING 2 LINES
IF MORE-RECORDS
MOVE ZEROS TO WS-SALES
MOVE ITEM-DESCRIP TO WS-HOLD-ITEM-NUMBER
PERFORM 600-HEADER-ROUTINE
END-IF.
500-FINAL-ROUTINE.
CLOSE DATA-FILE, PRINT-FILE.
600-HEADER-ROUTINE.
MOVE NAME-RECORD TO PRINT-RECORD.
ADD 1 TO PAGE-NUMBER.
MOVE PAGE-NUMBER TO PAGE-NUMBER-OUT.
WRITE PRINT-RECORD AFTER ADVANCING NEXT-PAGE.
MOVE HEADING-1 TO PRINT-RECORD.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
MOVE HEADING-2 TO PRINT-RECORD.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
MOVE HEADING-3 TO PRINT-RECORD.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
MOVE SPACES TO PRINT-RECORD.
700-INITIALIZATION-ROUTINE.
OPEN INPUT DATA-FILE
OUTPUT PRINT-FILE.
READ DATA-FILE AT END MOVE "No"
TO MORE-DATA-FLAG.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
MOVE 8 TO LINE-COUNT.
800-INITIALIZATION-ROUTINE.
MOVE "YES" TO MORE-DATA-FLAG.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
MOVE 8 TO LINE-COUNT.
IDENTIFICATION DIVISION.
PROGRAM-ID. ASSGN-04.
AUTHOR. JESSICA BENNETT
DATE-WRITTEN. 10-29-02.
*REMARKS. THIS PROGRAM LISTS DATA, 80-80.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES. C01 IS NEXT-PAGE.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT DATA-FILE ASSIGN TO "A:CHDATA04.DAT".
SELECT PRINT-FILE ASSIGN TO "A:BREAK.CBL".
DATA DIVISION.
FILE SECTION.
FD DATA-FILE.
01 DATA-RECORD.
05 ITEM-NUMBER PIC X(9).
05 ITEM-DESCRIP PIC X(20).
05 FILLER PIC X(10).
05 QUANTITY-SOLD PIC 999.
05 UNIT-PRICE PIC 999V99.
05 SALES-DATE.
10 M-IN PIC 99.
10 D-IN PIC 99.
10 Y-IN PIC 99.
05 SALESMAN PIC X(2).
05 PIC X.
FD PRINT-FILE.
01 PRINT-RECORD PIC x(80).
WORKING-STORAGE SECTION.
01 WS-WORK-AREAS.
05 WS-HOLD-ITEM-NUMBER PIC X(9) VALUE ZEROS.
05 WS-HOLD-SALESMAN PIC X(2) VALUE ZEROS.
05 ARE-THERE-MORE-RECORDS PIC X(3) VALUE "YES".
88 MORE-RECORDS VALUE "YES".
88 NO-MORE-RECORDS VALUE "NO".
05 FIRST-RECORD PIC X(3) VALUE "YES".
05 WS-ITEM-TOTAL PIC 9(4)V99 VALUE ZEROS.
05 WS-SALES-TOTAL PIC 9(4)V99 VALUE ZEROS.
01 NAME-RECORD.
05 PIC x(50) VALUE SPACES.
05 PIC x(30) VALUE "JESSICA BENNETT".
01 HEADING-1.
05 HEADER-DATE PIC x(8) VALUE "11/05/02".
05 PIC x(23) VALUE SPACES.
05 PIC x(18) VALUE "KITCHEN INDUSTRIES".
05 PIC x(24) VALUE SPACES.
05 PIC x(5) VALUE "PAGE".
05 PAGE-NUMBER-OUT PIC Z9.
01 HEADING-2.
05 PIC X(7) VALUE SPACES.
05 PIC X(12) VALUE "ITEM NUMBER".
05 PIC X(6) VALUE SPACES.
05 PIC X(16) VALUE "ITEM DESCRIPTION".
01 HEADING-3.
05 PIC X(7) VALUE SPACES.
05 PIC X(9) VALUE "SALESMAN".
05 PIC X(6) VALUE SPACES.
05 PIC X(13) VALUE "QUANTITY SOLD".
05 PIC X(6) VALUE SPACES.
05 PIC X(5) VALUE "SALES".
01 ITEM-DETAIL-LINE.
05 PIC X(1) VALUE SPACES.
05 ITEM-NUMBER-OUT PIC X(9).
05 PIC X(8) VALUE SPACES.
05 ITEM-DESCRIP-OUT PIC X(16).
01 SALESMAN-DETAIL-LINE.
05 PIC X(8) VALUE SPACES.
05 QUANTITY-SOLD-OUT PIC ZZ9.
05 PIC X(5) VALUE SPACES.
05 SALESMAN-OUT PIC X(2).
05 PIC X(1) VALUE SPACES.
05 SALES-OUT PIC Z(7).99.
01 TOTAL-PRINT-RECORD.
05 PIC X(40) VALUE SPACES.
05 TOTAL-ITEM-TOTAL PIC $$$,$$$.99.
05 PIC X(3) VALUE SPACES.
05 TOTAL-SALES PIC $,$$$.99.
05 UNUSED PIC X(9) VALUE SPACES.
01 COUNTERS.
05 PAGE-NUMBER PIC S99 VALUE ZERO PACKED-DECIMAL.
05 LINE-COUNT PIC S99 VALUE ZERO PACKED-DECIMAL.
05 WS-TOTAL-ITEM-TOTAL PIC S9(7)V99 VALUE ZERO.
05 WS-TOTAL-SALES PIC S9(4)V99 VALUE ZERO.
05 WS-SALES PIC S9(4)V99 VALUE ZERO.
01 FLAGS.
05 MORE-DATA-FLAG PIC x(3) VALUE "YES".
88 NO-MORE-DATA VALUE "No".
PROCEDURE DIVISION.
100-MAIN-LINE-ROUTINE.
PERFORM 700-INITIALIZATION-ROUTINE.
PERFORM 200-DETAIL-ROUTINE
UNTIL NO-MORE-DATA.
PERFORM 400-ITEM-NUMBER-BREAK
PERFORM 500-FINAL-ROUTINE.
200-DETAIL-ROUTINE.
EVALUATE TRUE
WHEN FIRST-RECORD = "YES"
MOVE SALESMAN TO WS-HOLD-SALESMAN
MOVE ITEM-NUMBER TO WS-HOLD-ITEM-NUMBER
PERFORM 600-HEADER-ROUTINE
MOVE "NO" TO FIRST-RECORD
WHEN ITEM-NUMBER NOT = WS-HOLD-ITEM-NUMBER
PERFORM 400-ITEM-NUMBER-BREAK
WHEN SALESMAN NOT = WS-HOLD-SALESMAN
PERFORM 300-FIRST-BREAK
END-EVALUATE.
PERFORM 800-INITIALIZATION-ROUTINE.
STOP RUN.
300-FIRST-BREAK.
MOVE WS-ITEM-TOTAL TO TOTAL-ITEM-TOTAL
MOVE WS-HOLD-SALESMAN TO SALESMAN-OUT
WRITE PRINT-RECORD FROM SALESMAN-DETAIL-LINE
AFTER ADVANCING 2 LINES
ADD WS-SALES TO WS-ITEM-TOTAL
IF MORE-RECORDS
MOVE ZERO TO WS-ITEM-TOTAL
MOVE QUANTITY-SOLD TO WS-HOLD-SALESMAN
END-IF.
400-ITEM-NUMBER-BREAK.
PERFORM 300-FIRST-BREAK
MOVE WS-SALES TO TOTAL-SALES
WRITE PRINT-RECORD FROM ITEM-DETAIL-LINE
AFTER ADVANCING 2 LINES
IF MORE-RECORDS
MOVE ZEROS TO WS-SALES
MOVE ITEM-DESCRIP TO WS-HOLD-ITEM-NUMBER
PERFORM 600-HEADER-ROUTINE
END-IF.
500-FINAL-ROUTINE.
CLOSE DATA-FILE, PRINT-FILE.
600-HEADER-ROUTINE.
MOVE NAME-RECORD TO PRINT-RECORD.
ADD 1 TO PAGE-NUMBER.
MOVE PAGE-NUMBER TO PAGE-NUMBER-OUT.
WRITE PRINT-RECORD AFTER ADVANCING NEXT-PAGE.
MOVE HEADING-1 TO PRINT-RECORD.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
MOVE HEADING-2 TO PRINT-RECORD.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
MOVE HEADING-3 TO PRINT-RECORD.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
MOVE SPACES TO PRINT-RECORD.
700-INITIALIZATION-ROUTINE.
OPEN INPUT DATA-FILE
OUTPUT PRINT-FILE.
READ DATA-FILE AT END MOVE "No"
TO MORE-DATA-FLAG.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
MOVE 8 TO LINE-COUNT.
800-INITIALIZATION-ROUTINE.
MOVE "YES" TO MORE-DATA-FLAG.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
MOVE 8 TO LINE-COUNT.