RotorBalls
MIS
Wondering if someone could help me with my program. What am I doing wrong? Is something wrong with my sort? Can't seem to get it to run and produce output.
IDENTIFICATION DIVISION.
PROGRAM-ID. PROG3.
AUTHOR. PRESTON AMUA-SEKYI.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT SALES-FILE ASSIGN TO 'A:\ASSIGN3A.DAT'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT SORT-FILE ASSIGN TO 'A:\SORTWORK.DAT'.
SELECT SORTED-FILE ASSIGN TO 'A:\SALES.DAT'
ORGANIZATION IS LINE SEQUENTIAL.
*
DATA DIVISION.
FILE SECTION.
FD SALES-FILE.
01 SALES-RECORD-IN.
05 SR-ACCOUNT-NUMBER PIC 9(6).
05 PIC X.
05 SR-NAME-IN PIC X(15).
05 SR-SALES PIC S9(4).
05 PIC XX.
05 SR-COMMISSION-PERCENT PIC V99.
05 PIC XX.
05 SR-LOCATION-IN PIC X(15).
05 SR-REGION-IN PIC X(11).
SD SORT-FILE.
01 SORT-REC.
05 SR-NAME-OUT PIC X(15).
05 SR-LOCATION-OUT PIC X(15).
05 SR-REGION-OUT PIC X(11).
FD SORTED-FILE.
01 SORTED-REC PIC X(41).
WORKING-STORAGE SECTION.
01 ARE-THERE-MORE-RECORDS PIC X(3) VALUE 'YES'.
PROCEDURE DIVISION.
100-MAIN-MODULE.
SORT SORT-FILE
ON ASCENDING KEY SR-REGION-OUT
WITH DUPLICATES IN ORDER
USING SALES-FILE
GIVING SORTED-FILE
OPEN INPUT SORTED-FILE
OUTPUT SALES-FILE
PERFORM UNTIL ARE-THERE-MORE-RECORDS = 'NO'
READ SORTED-FILE
AT END
MOVE 'NO' TO ARE-THERE-MORE-RECORDS
NOT AT END
PERFORM 200-PROCESS-RTN
END-READ
END-PERFORM
CLOSE SALES-FILE
SORTED-FILE.
STOP RUN.
200-PROCESS-RTN.
MOVE SR-REGION-IN TO SR-REGION-OUT
MOVE SR-LOCATION-OUT TO SR-LOCATION-OUT
MOVE SR-NAME-IN TO SR-NAME-OUT
RELEASE SORT-REC.
IDENTIFICATION DIVISION.
PROGRAM-ID. PROG3.
AUTHOR. PRESTON AMUA-SEKYI.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT SALES-FILE ASSIGN TO 'A:\ASSIGN3A.DAT'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT SORT-FILE ASSIGN TO 'A:\SORTWORK.DAT'.
SELECT SORTED-FILE ASSIGN TO 'A:\SALES.DAT'
ORGANIZATION IS LINE SEQUENTIAL.
*
DATA DIVISION.
FILE SECTION.
FD SALES-FILE.
01 SALES-RECORD-IN.
05 SR-ACCOUNT-NUMBER PIC 9(6).
05 PIC X.
05 SR-NAME-IN PIC X(15).
05 SR-SALES PIC S9(4).
05 PIC XX.
05 SR-COMMISSION-PERCENT PIC V99.
05 PIC XX.
05 SR-LOCATION-IN PIC X(15).
05 SR-REGION-IN PIC X(11).
SD SORT-FILE.
01 SORT-REC.
05 SR-NAME-OUT PIC X(15).
05 SR-LOCATION-OUT PIC X(15).
05 SR-REGION-OUT PIC X(11).
FD SORTED-FILE.
01 SORTED-REC PIC X(41).
WORKING-STORAGE SECTION.
01 ARE-THERE-MORE-RECORDS PIC X(3) VALUE 'YES'.
PROCEDURE DIVISION.
100-MAIN-MODULE.
SORT SORT-FILE
ON ASCENDING KEY SR-REGION-OUT
WITH DUPLICATES IN ORDER
USING SALES-FILE
GIVING SORTED-FILE
OPEN INPUT SORTED-FILE
OUTPUT SALES-FILE
PERFORM UNTIL ARE-THERE-MORE-RECORDS = 'NO'
READ SORTED-FILE
AT END
MOVE 'NO' TO ARE-THERE-MORE-RECORDS
NOT AT END
PERFORM 200-PROCESS-RTN
END-READ
END-PERFORM
CLOSE SALES-FILE
SORTED-FILE.
STOP RUN.
200-PROCESS-RTN.
MOVE SR-REGION-IN TO SR-REGION-OUT
MOVE SR-LOCATION-OUT TO SR-LOCATION-OUT
MOVE SR-NAME-IN TO SR-NAME-OUT
RELEASE SORT-REC.