View previous topic :: View next topic |
Author |
Message |
mfuser Banned
Joined: 01 Mar 2005 Posts: 105 Topics: 58
|
Posted: Tue Nov 28, 2006 12:07 am Post subject: internal sort program and jcl needed |
|
|
Members,
Can anybody help me sample cobol program using internal simple SORT and the RUN JCL for it and i do not want to make use of INPUT and OUTPUT PROCEDUREs?
I want to make use of Simple SORT statement like:
Code: |
SORT SORT-FILE
ASCENDING KEY SORT-KEY
USING INPUT-FILE
GIVING OUTPUT-FILE.
|
|
|
Back to top |
|
|
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Tue Nov 28, 2006 1:28 am Post subject: |
|
|
mfuser,
Try this code:
Code: |
FILE-CONTROL.
SELECT INP-FILE ASSIGN TO A.
SELECT OUT-FILE ASSIGN TO B.
SELECT SORT-FILE ASSIGN TO DUMMYAB.
DATA DIVISION.
FILE SECTION.
SD SORT-FILE
DATA RECORD IS SORT-RECORD.
01 SORT-RECORD.
05 SORT-KEY PIC X(15).
05 EMPINITIALS PIC X(02).
05 EMPNO PIC 9(04).
05 FILLER PIC X(59).
FD INP-FILE
RECORDING MODE IS F
BLOCK CONTAINS 0 CHARACTERS
DATA RECORD IS INPUT-RECORD.
01 INPUT-RECORD.
05 EMPNAME PIC X(15).
05 EMPINITIALS PIC X(02).
05 EMPNO PIC 9(04).
05 FILLER PIC X(59).
FD OUT-FILE
RECORDING MODE IS F
BLOCK CONTAINS 0 CHARACTERS
DATA RECORD IS OUTPUT-RECORD.
01 OUTPUT-RECORD.
05 EMPNAME PIC X(15).
05 EMPINITIALS PIC X(02).
05 EMPNO PIC 9(04).
05 FILLER PIC X(59).
WORKING-STORAGE SECTION.
PROCEDURE DIVISION.
0000-MAIN.
SORT SORT-FILE
ASCENDING KEY SORT-KEY
USING INP-FILE
GIVING OUT-FILE.
IF SORT-RETURN = 0
DISPLAY "SORT SUCCESS"
ELSE
DISPLAY "SORT FAILED"
END-IF.
0000-MAIN-EXIT.
EXIT.
GOBACK.
//STEP010 EXEC PGM=PGMNAME
//STEPLIB DD DSN=LOAD MODULE PDS NAME,DISP=SHR
//A DD DSN=INPUT DATASET NAME,DISP=SHR
//B DD DSN=OUTPUT DATASET NAME,DISP=SHR
//DUMMAB DD DUMMY
//
|
_________________ Shekar
Grow Technically |
|
Back to top |
|
|
|
|