IDENTIFICATION DIVISION.
PROGRAM-ID. SMPSORT.
AUTHOR. KK.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INPFILE ASSIGN TO DD1
FILE STATUS IS FS1.
SELECT WRKFILE ASSIGN TO DD2.
SELECT OUTFILE ASSIGN TO DD3.
* ORGANIZATION IS SEQUENTIAL
* ACCESS MODE IS SEQUENTIAL
DATA DIVISION.
FILE SECTION.
FD INPFILE.
01 INP-REC.
05 INP-NO PIC 9(4).
05 INP-NAME PIC X(20).
05 INP-DEPT PIC X(3).
05 FILLER PIC X(53).
SD WRKFILE.
01 WRK-REC.
05 WRK-NO PIC 9(4).
05 WRK-NAME PIC X(20).
05 WRK-DEPT PIC X(3).
05 FILLER PIC X(53).
FD OUTFILE.
01 OUT-REC.
05 OUT-NO PIC 9(4).
05 OUT-NAME PIC X(20).
05 OUT-DEPT PIC X(3).
05 FILLER PIC X(53).
WORKING-STORAGE SECTION.
01 FS1 PIC 9(2).
* 01 EOF PIC XX.
PROCEDURE DIVISION.
OOO1-MAIN-PARA.
SORT WRKFILE
ON ASCENDING WRK-NO
INPUT PROCEDURE 0002-PROC-INP
GIVING OUTFILE
STOP RUN.
0002-PROC-INP.
OPEN INPUT INPFILE.
PERFORM UNTIL FS1 = 10
READ INPFILE AT END DISPLAY "EOF "
NOT AT END IF INP-DEPT = "CSC"
DISPLAY INP-REC
DISPLAY INP-DEPT
RELEASE WRK-REC FROM INP-REC
END-IF
END-READ
END-PERFORM.
PROGRAM-ID. SMPSORT.
AUTHOR. KK.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INPFILE ASSIGN TO DD1
FILE STATUS IS FS1.
SELECT WRKFILE ASSIGN TO DD2.
SELECT OUTFILE ASSIGN TO DD3.
* ORGANIZATION IS SEQUENTIAL
* ACCESS MODE IS SEQUENTIAL
DATA DIVISION.
FILE SECTION.
FD INPFILE.
01 INP-REC.
05 INP-NO PIC 9(4).
05 INP-NAME PIC X(20).
05 INP-DEPT PIC X(3).
05 FILLER PIC X(53).
SD WRKFILE.
01 WRK-REC.
05 WRK-NO PIC 9(4).
05 WRK-NAME PIC X(20).
05 WRK-DEPT PIC X(3).
05 FILLER PIC X(53).
FD OUTFILE.
01 OUT-REC.
05 OUT-NO PIC 9(4).
05 OUT-NAME PIC X(20).
05 OUT-DEPT PIC X(3).
05 FILLER PIC X(53).
WORKING-STORAGE SECTION.
01 FS1 PIC 9(2).
* 01 EOF PIC XX.
PROCEDURE DIVISION.
OOO1-MAIN-PARA.
SORT WRKFILE
ON ASCENDING WRK-NO
INPUT PROCEDURE 0002-PROC-INP
GIVING OUTFILE
STOP RUN.
0002-PROC-INP.
OPEN INPUT INPFILE.
PERFORM UNTIL FS1 = 10
READ INPFILE AT END DISPLAY "EOF "
NOT AT END IF INP-DEPT = "CSC"
DISPLAY INP-REC
DISPLAY INP-DEPT
RELEASE WRK-REC FROM INP-REC
END-IF
END-READ
END-PERFORM.
//* Complex sort compile
//usermf JOB 'Training','KK',NOTIFY=&SYSUID,MSGCLASS=X,
// MSGLEVEL=(2,0)
//STEP1 EXEC PROC=IGYWCL
//COBOL.SYSIN DD DSN=usermf.JAN.COBOLPG2(COMSORT),DISP=SHR
//LKED.SYSLMOD DD DSN=usermf.JAN.COBOLPGM.LOADLIB(COMSORT),
// DISP=SHR
//* Complex sort RUN
//usermf JOB 'Training','KK',NOTIFY=&SYSUID
//JOBLIB DD DSN=usermf.JAN.COBOLPGM.LOADLIB,DISP=SHR
//STEP1 EXEC PGM=COMSORT
//DD1 DD DSN=usermf.JAN.IMPFILE,DISP=SHR
//DD2 DD DSN=usermf.JAN.DEMO,DISP=SHR
//DD3 DD DSN=usermf.JAN.OUTFILE,DISP=SHR
//*SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//
No comments:
Post a Comment