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
what JCL Procedures?
Mention the types of job control statements?
Is their any set of rules for dd? Explain.
what is “Cond= even” and “Cond=only”?
what is the difference between JES3 and JES2?
Explain about ISPF/TSO Commands
Explain the function of the dd dcb keyword?
What are hierarchy levels in jcl?
How jcl work to handle various input output file operations?
How to override loadlib?
When you specify multiple datasets in a JOBLIB or STEPLIB, what factor determines the order?
what is DSN parameter and DISP parameter is used for?
which parameter is used to check the syntax of a jcl without executing it?
Which statement is used to identify the private libraries in job?
In job processing, what happens in conversion stage?