IDENTIFICATION DIVISION.
PROGRAM-ID. P8LIST.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT MASTER-FILE-INDEXED
ASSIGN TO 'THMASTVS.DAT'.
ORGANIZATION IS INDEXED
ACCESS IS SEQUENTIAL
RECORD KEY IS MASTER-NUM-INDEXED.
************************************************************
* ASSIGN TO DA-I-??? PUT CORRECT NAME HERE ON Z
************************************************************
SELECT SALES-REPORT
ASSIGN TO 'P8STEP2.DOC'.
ORGANIZATION IS LINE SEQUENTIAL.
**************************************************************
* ASSIGN TO UT-S-??? PUT CORRECT NAME HERE ON Z
* DELETE ORGANIZATION IS LINE SEQUENTIAL
**************************************************************
DATA DIVISION.
FILE SECTION.
FD MASTER-FILE-INDEXED.
01 MASTER-REC-INDEXED.
05 MASTER-NUM-INDEXED PIC X(5).
05 FILLER PIC XX.
05 NAME-INDEXED.
10 F-INIT-INDEXED PIC X.
10 M-INIT-INDEXED PIC X.
10 LAST-NAME-INDEXED PIC X(20).
05 TRANS-CUR-SALES-INDEXED PIC S9(5)V99.
05 FILLER PIC XX.
05 TRANS-CUR-COMM-INDEXED PIC S9(5)V99.
05 FILLER PIC XX.
05 TRANS-YTD-COMM-INDEXED PIC S9(6)V99.
05 FILLER PIC X(22).
FD SALES-REPORT
RECORDING MODE IS F.
01 REPORT-LINE-OUT PIC X(132).
WORKING-STORAGE SECTION.
01 WORKING-FIELDS.
05 EOF-MASTER-WS PIC X(3) VALUE 'NO '.
01 ACCUMULATORS.
05 AC-LINE-COUNT PIC S999 VALUE 0.
05 AC-PAGE-COUNT PIC S999 VALUE 0.
05 AC-RECORD-COUNT PIC S999 VALUE 0.
01 REPORT-HEADING.
02 RH-LINE-1.
03 PIC X(26) VALUE SPACES.
03 PIC X(20) VALUE
"SALES REPORT".
03 PIC X(18) VALUE SPACES.
03 PIC X(6) VALUE 'PAGE:'.
03 RH-PAGE-COUNT PIC ZZ9.
03 PIC X(50) VALUE SPACE.
02 RH-LINE-2.
03 PIC X(15) VALUE
" EMP NUMBER".
03 PIC X(4) VALUE SPACES.
03 PIC X(13) VALUE
"EMPLOYEE NAME".
03 PIC X(12) VALUE SPACES.
03 PIC X(10) VALUE "SALES".
03 PIC X(9) VALUE SPACES.
03 PIC X(16) VALUE "COMMISSION".
03 PIC X(7) VALUE SPACES.
01 DETAIL-LINE.
02 PIC X(2) VALUE SPACES.
02 MASTER-NUM-OUT PIC X(5).
02 PIC X(6) VALUE SPACES.
02 LAST-NAME-OUT PIC X(20).
02 PIC X(2) VALUE SPACES.
02 PIC X(10).
02 PIC XXX VALUE SPACES.
02 PIC X(7) VALUE SPACES.
02 TRANS-CUR-SALES-OUT PIC S9(5)V99.
02 PIC X(5) VALUE SPACES.
02 TRANS-CUR-COMM-OUT PIC S9(5)V99.
01 SUMMARY-LINES.
02 SL-LINE-1.
03 PIC X(26) VALUE SPACES.
03 PIC X(25) VALUE
"TOTAL RECORDS PRINTED = ".
03 SL-RECORD-COUNT PIC ZZ9.
03 PIC X(76) VALUE SPACES.
02 SL-EOR-LINE.
03 PIC X(32) VALUE SPACES.
03 PIC X(13) VALUE
"END OF REPORT".
03 PIC X(85) VALUE SPACES.
PROCEDURE DIVISION.
100-MAIN-MODULE.
PERFORM 200-OPEN.
PERFORM 300-PROCESS
UNTIL EOF-MASTER-WS = 'YES'.
PERFORM 600-WRAPUP.
PERFORM 900-CLOSE.
STOP RUN.
200-OPEN.
INITIALIZE ACCUMULATORS.
OPEN INPUT MASTER-FILE-INDEXED
OUTPUT SALES-REPORT.
PERFORM 250-READ.
250-READ.
READ MASTER-FILE-INDEXED
AT END MOVE 'YES' TO EOF-MASTER-WS
END-READ.
300-PROCESS.
IF AC-LINE-COUNT = 0
PERFORM 500-HEADER
END-IF
MOVE MASTER-NUM-INDEXED TO MASTER-NUM-OUT
MOVE LAST-NAME-INDEXED TO LAST-NAME-OUT
MOVE TRANS-CUR-SALES-INDEXED TO TRANS-CUR-SALES-OUT
MOVE TRANS-CUR-COMM-INDEXED TO TRANS-CUR-COMM-OUT
WRITE REPORT-LINE-OUT FROM DETAIL-LINE
AFTER ADVANCING 2 LINES
ADD 2 TO AC-LINE-COUNT
ADD 1 TO AC-RECORD-COUNT
IF AC-LINE-COUNT > 35
MOVE ZERO TO AC-LINE-COUNT
END-IF
PERFORM 250-READ.
500-HEADER.
ADD 1 TO AC-PAGE-COUNT.
MOVE AC-PAGE-COUNT TO RH-PAGE-COUNT.
WRITE REPORT-LINE-OUT FROM RH-LINE-1
AFTER ADVANCING PAGE.
WRITE REPORT-LINE-OUT FROM RH-LINE-2
AFTER ADVANCING 1 LINE.
MOVE SPACES TO REPORT-LINE-OUT
WRITE REPORT-LINE-OUT AFTER ADVANCING 3 LINES.
MOVE 9 TO AC-LINE-COUNT.
600-WRAPUP.
MOVE AC-RECORD-COUNT TO SL-RECORD-COUNT.
WRITE REPORT-LINE-OUT FROM SL-LINE-1
AFTER ADVANCING 3 LINES.
WRITE REPORT-LINE-OUT FROM SL-EOR-LINE
AFTER ADVANCING 2 LINES.
900-CLOSE.
CLOSE MASTER-FILE-INDEXED
SALES-REPORT.
its giving me few errors with the "SALES-REPORT" variable. says its not a record. anyone have any idea , why? my professor gave us a similar program with "EMPLOYEE-REPORT", and that program runs fine. Id really appreciate any kind of help.
Coded