View previous topic :: View next topic
Author
Message
speermb New User Joined: 27 Aug 2008Posts: 30 Location: USA
I have a process that splices together 4 files keeping records that are not duplicated. Now I need the dups to fall into another file.
My splice is:
SPLICE FROM(SORTIN) TO(SORTOUT) ON(1,8,CH) -
WITHEACH -
KEEPNODUPS -
WITH(91,361) -
WITH(452,300) -
WITH(752,62) -
Is there a way to do this in one step. Or do I need to splice the files together with all and then a copy with a DISCARD(DUPS). I need to discard all dups
Inputs:
12345678 data1
12345678 data2
12345678 data3
12345678 data4
23456789 data1
23456789 data1
23456789 data2
23456789 data3
23456789 data4
12345679 data1
12345679 data2
12345679 data3
12345679 data4
Sorted wanted output:
12345678 data1 data2 data3 data4
12345679 data1 data2 data3 data4
Dup error file
23456789 data1 data2 data3 data4
23456789 data1 data2 data3 data4
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
speermb,
How do you classify the duplicates? Any key (1,8) which has more than 4 occurrances?
Also When you say 4 files , are you concatenating them all together? or did you use 4 copy passes them to a single dataset with DISP=MOD? Show me the JCL you used and may be we can suggest an alternative way of getting the results
Back to top
speermb New User Joined: 27 Aug 2008Posts: 30 Location: USA
Duplicate would be any item where 1-8 is on any file more than 1X. Currently, it only appears on data1 file multiple times.
Code:
//STEP05C EXEC PGM=ICETOOL
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SORTIN DD DISP=SHR,
// DSN=data1 file
// DD DISP=SHR,
// DSN=data2 file
// DD DISP=SHR,
// DSN=data3 file
// DD DISP=SHR,
// DSN=data4 file
//SORTOUT DD DISP=(NEW,CATLG,DELETE),
// UNIT=DISK,
// SPACE=(TRK,(20000,10000),RLSE),
// DCB=(RECFM=FB,LRECL=813,BLKSIZE=0),
// LABEL=RETPD=7,
// dSN=outfile1
//TOOLIN DD *
SPLICE FROM(SORTIN) TO(SORTOUT) ON(1,8,CH) -
WITHEACH -
KEEPNODUPS -
WITH(91,361) -
WITH(452,300) -
WITH(752,62) -
USING(FMT1)
//
//FMT1CNTL DD *
SORT FIELDS=(1,8,CH,A)
OUTFIL FNAMES=SORTOUT,
OMIT=(9,1,CH,EQ,C' ',OR,
91,1,CH,EQ,C' ',OR,
452,1,CH,EQ,C' '),
IFTHEN=(WHEN=(752,1,CH,EQ,C' '),
OVERLAY=(752:C'N',757:C'000000',763:C'000000')),
IFTHEN=(WHEN=NONE,
BUILD=(1:1,813))
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
speermb,
ok do the dups occur together or they spread out in each file? for ex:
take file 1
or do they occur as
The keys need not be sorted but do they duplicates occur as pairs?
Back to top
speermb New User Joined: 27 Aug 2008Posts: 30 Location: USA
Yes the duplicates will be in sorted order & the duplicates could be right after one another.
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
speermb,
The following DFSORT/ICETOOL JCL will give you the desired results.
Code:
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=data1 file
// DD DISP=SHR,DSN=data2 file
// DD DISP=SHR,DSN=data3 file
// DD DISP=SHR,DSN=data4 file
//SORTOUT DD SYSOUT=*
//ERROR DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(SORTIN) TO(SORTOUT) ON(1,8,CH) ON(814,8,CH) -
WITHEACH WITH(91,361) WITH(452,300) WITH(752,62) -
KEEPNODUPS USING(FMT1)
//FMT1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(814:SEQNUM,8,ZD,RESTART=(1,8)))
OUTFIL FNAMES=SORTOUT,IFOUTLEN=813,
INCLUDE=(814,8,ZD,EQ,1,AND,
009,1,CH,GT,C' ',AND,
091,1,CH,GT,C' ',AND,
452,1,CH,GT,C' '),
IFTHEN=(WHEN=(752,1,CH,EQ,C' '),
OVERLAY=(752:C'N',757:C'000000',763:C'000000'))
OUTFIL FNAMES=ERROR,BUILD=(1,813),INCLUDE=(814,8,ZD,GT,1)
/*
Sortout will have (key 23456789 has a match on all four files but has an extra record from file1. So we club the 4 records from each of the file and push the extra record to the error file.)
Code:
12345678 data1 data2 data3 data4
12345679 data1 data2 data3 data4
23456789 data1 data2 data3 data4
Dup error file
Back to top
speermb New User Joined: 27 Aug 2008Posts: 30 Location: USA
I don't want infro from records that are duplicated keys in the SORTOUT:
I need this data on the duplicated file.
SORTOUT
12345678 data1 data2 data3 data4
12345679 data1 data2 data3 data4
DUPLICATED data either:
23456789 data1 data2 data3 data4
23456789 data1
or
23456789 data1 data2 data3 data4
Back to top
Please enable JavaScript!