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 statement marks the beginning of a job step; assigns a name to the step; identifies the program or catalogued or in-stream procedure to be executed in the step?
We can use PASS with permanent datasets also. THEN Which is the condition in which we may use PASS (instead of KEEP) with permanent data sets, while there is no need to specify UNIT and VOL for them like temporary data sets (in cas we use KEEP for permanent data sets) ?
Must tape dataset definitions include vol=ser specifications?
Is their any limit for data sets?
The disp in the JCL is MOD and the program opens the file in OUTPUT mode. What happens ? The disp in the JCL is SHR and the pgm opens the file in EXTEND mode. What happens ?
Explain the function of the dd dcb keyword?
How do you access an uncatalogued dataset in a jcl?
In job processing, what happens in conversion stage?
what is use of dcb parameter in dd statement?
In job processing, what happens in execution stage?
What are the rules employed while naming the steps in a job?
Can I send output of job to my remote device careerride123?
What is multithreading in jcl?
What statement marks the beginning of an in-stream or cataloged procedure in jcl and assigns default values to parameters defined in the procedure?
What do we mean by 'Virtual storage' for a dataset and for a JOBSTEP ? What is the significance of the following statement for a programmer 'Virtual storage results in program addresses being independent of the addresses that actually exist in a computer' ?