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

Suppose I have a program in cobol name ”careerride” and want to execute the program by jcl. Specify the process?

0 Answers  


Explain about ISPFTTRC

1 Answers  


Explain about Cobol Subroutines

1 Answers  


what is the function of iebcompr?....is it compare record length or characteristics of a dataset?...pls explain with examples.......

2 Answers  


Can we give two user name in NOTIFY parameter in JOBCARD

1 Answers   Syntel,






How to copy one PS file to multiple PS files with same data?

1 Answers  


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

1 Answers  


FOR a GDG, the book by 'SABA ZAMEER' says 'We can NOT ALTER the LIMIT parameter after it is defined'. (p-211). But many persons have written that it can be changed, which one is true ?

4 Answers   IBM,


i have a jcl in which 4 & 5 step creates a new generation. 4th step output is as input for the 6th step & 5th step output is used as input in the 7th step. How they are refered as in the 6th & 7th steps? If the job abends in 6th step then how the 5th step output is refered in 7th step?

6 Answers   IBM,


What is Uncatalog dataset? How can we access/use them?

1 Answers  


how can handle the s0c4 abend???

3 Answers  


what is the default region size if I dont specify region parametre in my job card ( I know that if I specify region=0k or 0M, then the job will occupy all he available resources at the time of job execution), but I want to know the defult value for "region" paramatre.

5 Answers   BirlaSoft, Infosys,


Categories