How to get the last but one duplicate record of the file
using Sort?
Answer Posted / anju
//step1 exec pgm=sort
//sortin dd dsn=file1,disp=shr
//sortout dd dsn=file2,disp=(new,catlg,delete),
// unit=disk,space=(cyl(20,10),rlse)
// dcb=(recfm=fb,lrecl=80,blksize=800)
//sortxsum dd dsn=file3,disp=(new,catlg,delete),
// unit=disk,space=(cyl(20,10),rlse)
// dcb=(recfm=fb,lrecl=80,blksize=800)
//sysin dd *
sortfields=none,xsum
/*
//step2 exec pgm=sort
//sortin dd dsn=*.step1.sortxsum
//sortof01 dd dsn=file4,disp=(new,catlg,delete),
// unit=disk,space=(cyl(20,10),rlse)
// dcb=(recfm=fb,lrecl=80,blksize=800)
//sortof02 dd dsn=file5,disp=(new,catlg,delete),
// unit=disk,space=(cyl(20,10),rlse)
// dcb=(recfm=fb,lrecl=80,blksize=800)
sysin dd *
sortfields=copy
outfil files=01,startrec=2,endrec=2
outfil files=02,startrec=3,ENDREC=5
/*
I did not test this. Hope this will work and file4 will give
the last but 1 duplicate record.
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
WORKING-STORAGE SECTION. 77 W-A PIC 9(3)V99 VALUE 23.75. 77 W-B PIC ZZ9V99 VALUE 123.45. PROCEDURE DIVISION. MOVE W-A TO W-B. DISPLAY W-B. STOP RUN. compiler : IGYGR1080-S A "VALUE" clause literal was not compatible with the data category o subject data item. The "VALUE" clause was discarded. WORKING-STORAGE SECTION. 77 W-A PIC 9(3)V99 VALUE 23.75. 77 W-B PIC ZZ9V99. PROCEDURE DIVISION. MOVE 123.45 TO W-B. MOVE W-A TO W-B. DISPLAY W-B. STOP RUN. 2375
in ways data can be passed to a COBOL program from JCL?
Explain the purpose of dd dummy statement?
How is a type of file defined in the jcl that executes the cobol program?
What does it mean by Restart and Checkpoint in JCL ? How are checkpoints being taken and what is their usage ? How to use Checkpoint macro on a JOBSTEP ?
How to remove the spaces at end of each record in the output file Via COBOL program? note: The file has a VB length ----TRY
Give the syntax of job specifying jcl statement.
What are the parameter we cannot use in procedure? How many instream we can write in single jcl?
How to compare two files in SYNCSORT and on the mismatch record should be deleted from second file.
What is the purpose of dd?
Suppose I have a program in cobol name ”careerride” and want to execute the program by jcl. Specify the process?
Explain the purpose of dd * statement in jcl?
When The Define Jcl Is Not Available, How Can You Get Information About A Vsam File's Organisation ?
How can the submitting users racf authority be overridden in a job stream?
Explain the function of //jcllib statement?