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



I have a File that has duplicate records. I need only those records that occur more than thrice...

Answer / jammi

can use icetool utility to can select the records which has
more than thrice or more
//sysin dd *
select from(idd) to(outdd) on(stpos,leng,type)
nodups/alldups/lower(n)/higher(n)/equal(n)

set n=3 in higher rest are optional try this and let me know

Is This Answer Correct ?    5 Yes 1 No

I have a File that has duplicate records. I need only those records that occur more than thrice...

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

I have a File that has duplicate records. I need only those records that occur more than thrice...

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

Post New Answer

More JCL Interview Questions

What is the difference between specifying DISP=OLD and DISP=SHR for a dataset?

5 Answers   CitiGroup,


Where can program checkpoints be stored for use in a restart?

0 Answers  


Is Default for MSGCLASS = (1,1) ?

2 Answers   IBM,


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  


How to override loadlib?

0 Answers   Fiserv,






How to submit multiple jobs. These jobs are members in PDS. The second job should run if the first job runs successfully and so on.

1 Answers  


IF WE GIVE COND on step3 then, What does the following mean ? And Just adding to that, All the below COND are VALID as per the specifications. (i) COND = (8,LT,step1,step2) ---(AND/OR ?) (ii) COND = (8,LT,step1,step2, ONLY), (iii) COND = (8,LT,step1,ONLY) will it execute only if this condition is true or only if step1 ABENDS ? (iv) COND = (8,LT,step1,step2,EVEN), (v) COND = (8,LT,step1,EVEN) ?

2 Answers   IBM,


How to release a JOB (from the input queue) held by TYPRUN = HOLD ? and how to see the installation default time after which a JOB will be automatically released ? How to see the list of currently HELD JOBS ?

5 Answers   IBM,


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 program opens the file in EXTEND mode. What happens ?

3 Answers  


how to identify a vasam dataset by seeing in 3.4(browse)

5 Answers   Cap Gemini,


Write a jcl to execute a job by 7 a.m on Jan 20,1986 ?

5 Answers   Maples, Patni, TCS,


how to identify the file used in the JCL is an VSAM file. Just seeing the JCL code how can we track the file as VSAM file?

6 Answers   CSC,


Categories