How to get the last but one duplicate record of the file
using Sort?
Answers were Sorted based on User's Feedback
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 |
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 |
what are the various stages of job processing?
can i sort packed decimal if i can tell the syntax
What is 'mounting' of volumes ? Is there anything that a programmer can do in it ? How to find currently mounted volume ?
1.How to check for the errors using TYPRUN=SCAN?What will be the output if we give TYPRUN=SCAN?
in a series of 10 steps, i need to run only 1,3,5,7 & 9th steps only. how do u code?
How do you submit JCL via a Cobol program?
What is the function of //cntl statement?
i have 10steps and i want run step3 and based on step3 i want execute step7,8,9,10?in jcl
How to do automated restart when a job abend?
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 ?
01 A. 10 B pic X(10). move spaces to A. move spaces to B. output in A & B
How to pass the parameter in parm using linkage section ? (syntax)?