How to get the last but one duplicate record of the file
using Sort?

Answers were Sorted based on User's Feedback



How to get the last but one duplicate record of the file using Sort?..

Answer / vikas pujar

Sort Dataset SORTXSUM will hold the duplicate records if in
Sysin dd *, we give option XSUM, after SUM FIELDS=NONE. So
last but one record in dataset should be the answer.

Is This Answer Correct ?    4 Yes 2 No

How to get the last but one duplicate record of the file using Sort?..

Answer / 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

More JCL Interview Questions

what are the various stages of job processing?

0 Answers   IBM,


can i sort packed decimal if i can tell the syntax

1 Answers   Barclays,


What is 'mounting' of volumes ? Is there anything that a programmer can do in it ? How to find currently mounted volume ?

0 Answers   IBM,


1.How to check for the errors using TYPRUN=SCAN?What will be the output if we give TYPRUN=SCAN?

11 Answers  


in a series of 10 steps, i need to run only 1,3,5,7 & 9th steps only. how do u code?

5 Answers   ADP,






How do you submit JCL via a Cobol program?

2 Answers   Cap Gemini,


What is the function of //cntl statement?

0 Answers  


i have 10steps and i want run step3 and based on step3 i want execute step7,8,9,10?in jcl

1 Answers  


How to do automated restart when a job abend?

0 Answers  


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 ?

0 Answers  


01 A. 10 B pic X(10). move spaces to A. move spaces to B. output in A & B

2 Answers   Perot Systems,


How to pass the parameter in parm using linkage section ? (syntax)?

0 Answers   Infosys,


Categories