*SORT INPUT PS TO OUTPUT PS*
IDENTIFICATION DIVISION.
PROGRAM-ID. SOR.
AUTHOR. SRIBLOG.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT PS ASSIGN TO DD1
ORGANIZATION SEQUENTIAL
ACCESS MODE SEQUENTIAL
FILE STATUS WS-PS .
SELECT PSO ASSIGN TO DD2
ORGANIZATION SEQUENTIAL
ACCESS MODE SEQUENTIAL
FILE STATUS WS-PSO .
SELECT SRT ASSIGN TO DD3 .
DATA DIVISION.
FILE SECTION.
FD PS.
01 PS-REC.
02 PS-REGNO PIC 9(4).
02 FILLER PIC X.
02 PS-NAME PIC X(17).
02 FILLER PIC X(2).
02 PS-COUNTRY PIC X(5).
02 FILLER PIC X.
02 PS-STATE PIC X(13).
02 FILLER PIC X(2).
02 PS-SALARY PIC 9(6).
02 FILLER PIC X(29).
FD PSO.
01 PSO-REC.
02 PSO-REGNO PIC 9(4).
02 FILLER PIC X.
02 PSO-NAME PIC X(17).
02 FILLER PIC X(2).
02 PSO-COUNTRY PIC X(5).
02 FILLER PIC X.
02 PSO-STATE PIC X(13).
02 FILLER PIC X(2).
02 PSO-SALARY PIC 9(6).
02 FILLER PIC X(29).
SD SRT.
01 SRT-REC.
02 SRT-REGNO PIC 9(4).
02 FILLER PIC X.
02 SRT-NAME PIC X(17).
02 FILLER PIC X(2).
02 SRT-COUNTRY PIC X(5).
02 FILLER PIC X.
02 SRT-STATE PIC X(13).
02 FILLER PIC X(2).
02 SRT-SALARY PIC 9(6).
02 FILLER PIC X(29).
WORKING-STORAGE SECTION.
01 VARIABLES.
02 WS-PS PIC 9(2).
88 PS-SUCCESS VALUE 00.
88 PS-EOF VALUE 10.
02 WS-PSO PIC 9(2).
88 PSO-SUCCESS VALUE 00.
88 PSO-EOF VALUE 10.
PROCEDURE DIVISION.
0000-MAIN-PARA.
PERFORM 1000-INITIALIZATION-PARA
THRU 1000-INITIALIZATION-PARA-EXIT
PERFORM 2000-PROCESS-PARA
THRU 2000-PROCESS-PARA-EXIT
PERFORM 9000-TERMINATION-PARA
THRU 9000-TERMINATION-PARA-EXIT
.
0000-MAIN-PARA-EXIT.
EXIT
.
1000-INITIALIZATION-PARA.
.
1000-INITIALIZATION-PARA-EXIT.
EXIT
.
2000-PROCESS-PARA.
PERFORM 2100-SORT-PARA
THRU 2100-SORT-PARA-EXIT
.
2000-PROCESS-PARA-EXIT.
EXIT
.
2100-SORT-PARA.
SORT SRT
ON DESCENDING KEY SRT-NAME
USING PS
GIVING PSO
.
2100-SORT-PARA-EXIT.
EXIT
.
9000-TERMINATION-PARA.
STOP RUN
.
9000-TERMINATION-PARA-EXIT.
EXIT
.
IDENTIFICATION DIVISION.
PROGRAM-ID. SOR.
AUTHOR. SRIBLOG.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT PS ASSIGN TO DD1
ORGANIZATION SEQUENTIAL
ACCESS MODE SEQUENTIAL
FILE STATUS WS-PS .
SELECT PSO ASSIGN TO DD2
ORGANIZATION SEQUENTIAL
ACCESS MODE SEQUENTIAL
FILE STATUS WS-PSO .
SELECT SRT ASSIGN TO DD3 .
DATA DIVISION.
FILE SECTION.
FD PS.
01 PS-REC.
02 PS-REGNO PIC 9(4).
02 FILLER PIC X.
02 PS-NAME PIC X(17).
02 FILLER PIC X(2).
02 PS-COUNTRY PIC X(5).
02 FILLER PIC X.
02 PS-STATE PIC X(13).
02 FILLER PIC X(2).
02 PS-SALARY PIC 9(6).
02 FILLER PIC X(29).
FD PSO.
01 PSO-REC.
02 PSO-REGNO PIC 9(4).
02 FILLER PIC X.
02 PSO-NAME PIC X(17).
02 FILLER PIC X(2).
02 PSO-COUNTRY PIC X(5).
02 FILLER PIC X.
02 PSO-STATE PIC X(13).
02 FILLER PIC X(2).
02 PSO-SALARY PIC 9(6).
02 FILLER PIC X(29).
SD SRT.
01 SRT-REC.
02 SRT-REGNO PIC 9(4).
02 FILLER PIC X.
02 SRT-NAME PIC X(17).
02 FILLER PIC X(2).
02 SRT-COUNTRY PIC X(5).
02 FILLER PIC X.
02 SRT-STATE PIC X(13).
02 FILLER PIC X(2).
02 SRT-SALARY PIC 9(6).
02 FILLER PIC X(29).
WORKING-STORAGE SECTION.
01 VARIABLES.
02 WS-PS PIC 9(2).
88 PS-SUCCESS VALUE 00.
88 PS-EOF VALUE 10.
02 WS-PSO PIC 9(2).
88 PSO-SUCCESS VALUE 00.
88 PSO-EOF VALUE 10.
PROCEDURE DIVISION.
0000-MAIN-PARA.
PERFORM 1000-INITIALIZATION-PARA
THRU 1000-INITIALIZATION-PARA-EXIT
PERFORM 2000-PROCESS-PARA
THRU 2000-PROCESS-PARA-EXIT
PERFORM 9000-TERMINATION-PARA
THRU 9000-TERMINATION-PARA-EXIT
.
0000-MAIN-PARA-EXIT.
EXIT
.
1000-INITIALIZATION-PARA.
.
1000-INITIALIZATION-PARA-EXIT.
EXIT
.
2000-PROCESS-PARA.
PERFORM 2100-SORT-PARA
THRU 2100-SORT-PARA-EXIT
.
2000-PROCESS-PARA-EXIT.
EXIT
.
2100-SORT-PARA.
SORT SRT
ON DESCENDING KEY SRT-NAME
USING PS
GIVING PSO
.
2100-SORT-PARA-EXIT.
EXIT
.
9000-TERMINATION-PARA.
STOP RUN
.
9000-TERMINATION-PARA-EXIT.
EXIT
.