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


Please Help Members By Posting Answers For Below Questions

Differentiate between addressing mode and run mode.

689


How to do automated restart when a job abend?

897


what are JCLLIB and STEPLIB in JCL?

775


Explain the function of //cntl statement?

747


What is the purpose of the dd keylen parameter?

820






What is notcat 2 - gs?

1056


How to alter the parameters for the existing gdg?

799


How can a fb file convert to vb file using sort program?

922


Explain how can a stopped job be started again?

742


which utility is used to run a cobol-db2 program?

915


Name what parameter directs the output of the job log dataset?

638


Must tape dataset definitions include vol=ser specifications?

1138


State the uses of syspring, sysin, sort fields, sum fields and dummy.

747


Explain how can the disposition of sysout datasets be set for an entire jobstream?

729


Is acct parameter mandatory?

843