I have a File that has duplicate records. I need only those
records that occur more than thrice.
Answers were Sorted based on User's Feedback
Answer / pradip anand
//USERIDR JOB (M,92950000,,9999),'N=TSO.ICETOOL',MSGCLASS=M,
// CLASS=M,NOTIFY=USERID
//*
//STEP001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//*
//SORTIN DD DSN=INPUT.FILE1,DISP=SHR
// DD DSN=INPUT.FILE2,DISP=SHR
//*
//EQDUPES DD DSN=OUTPUT.FILE.REC,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// DCB=(LRECL=200,RECFM=FB,BLKSIZE=0,DSORG=PS),
// SPACE=(CYL,(30,30),RLSE)
//TOOLIN DD
*
SELECT FROM(SORTIN) TO(EQDUPES) -
ON(4,4,CH) EQUAL(N)
/*
Example:
Input File1:
000 1111 12356908
001 1212 54321234
002 1323 78654323
003 5656 98765456
Input File2:
000 1000 12356908
001 1212 99999999
002 1323 77777777
003 5656 88888888
Output File:
When EQUAL(1)
000 1000 12356908
000 1111 12356908
When EQUAL(2)
001 1212 54321234
001 1212 99999999
002 1323 78654323
002 1323 77777777
003 5656 98765456
003 5656 88888888
mail me if still have any doubt.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / brian
Sort the file in ascending order of your duplicated fields.
You can write a COBOL module to read the file sequentially.
Set up a dup-counter in Working Storage. Set up a group of
fields in Working Storage to hold duplicated fields. They
should be similar to what you are sorting on. Save each
records read fields after reading it. When you read the
current record compare it to the saved fields. If they
match add to your dup-counter. If they don't match zero
out your counter. After adding to your counter check the
value. If > 1 you have a 3rd duplicate. Write that record
to a duplicate output file. Hope I'm close to getting you
an answer.
| Is This Answer Correct ? | 3 Yes | 1 No |
Hello Guys, I have 1+ Year Experience in MAINFRAME TESTING. After 1 Week I have an Interview With a Company on Mainframe Testing. Please Could You Guys Please Suggest me What Sections Should I prepare ?? ___Tell Me the Topic Or Appropriate Site & Links. ?? ---------------Thank You
A maximum of 100 chars can be passed to Cobol through Parm in JCL, If we want to pass more than 100 Chars how we can do it ?
I have three files for one step i need to override the third file how to do that in jcl?
difference between internal sort and external sort
Why we will create load module in PDS only, Why nt in PS?
What is the function of the dd dcb keyword?
What is the function of a dd statement?
hi iam learning mainframes,can anybody tell me how to check JCL errors.(after submiting the JCL we have check in spool or is there any other method)
wht do u mean by notify parameter, how can u give acess to multiple users ?
how to write a jcl prog to copy alternate recs from ps1 to another ps2,suppose ps1 having 10 recs?
IF we are calling a PROC from Jcl...This Proc have 3 steps in it and we want to execute only the second step using the JCL, How to do it?? Please give the answer ASAP:)
i have step1,step2,step3 from where can i start coding cond parameter ?