View previous topic :: View next topic
Author
Message
atchuta konduri New User Joined: 25 Oct 2007Posts: 16 Location: mumbai
Hi,
I have two files FileA & FileB
FileA
======
789111567
111888991
330007845
FileB
======
789111567
311888991
330007845
I need to create two files
FileC containing matched records and FileD containing unmatched records
FileC
======
789111567
330007845
FileD
======
111888991
311888991
I tried using ICETOOL with following syntax in TOOLIN
SELECT FROM(BKIN) TO(DUP) DISCARD(NODUP) -
ON(1,9,ZD) ALLDUPS
//BKIN FILEA,DISP=SHR
FILEB,DISP=SHR
//DUP FILEC,DISP=(NEW,CATLG,DELETE)
//NODUP FILED,DISP=(NEW,CATLG,DELETE)
FILED is getting generated properly but FileC contains duplicate records
FileD
======
111888991
311888991
FileC
=====
330007845
330007845
789111567
789111567
Does it mean I have to sort FileC again in the next step or is it possible in the same step.
Can someone advise on the correct syntax?
Thanks in advance.
Atchuta
Back to top
hchinnam New User Joined: 18 Oct 2006Posts: 73
You can add additional statment in splice to copy from NODUP and write in to your final output (i.e final file with duplicates).
During this copy you can eliminate duplicates using SUM FIELDS=NONE.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Atchuta,
You can use a DFSORT/ICETOOL job like the following to do what you asked for. I assumed your input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FILEA DD DSN=FILEA,DISP=SHR (FB/80)
//FILEB DD DSN=FILEB,DISP=SHR (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//FILEC DD DSN=FILEC,DISP=(NEW,CATLG,DELETE) (FB/80)
//FILED DD DSN=FILED,DISP=(NEW,CATLG,DELETE) (FB/80)
//TOOLIN DD *
COPY FROM(FILEA) TO(T1) USING(CTL1)
COPY FROM(FILEB) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(FILEC) ON(1,9,ZD) KEEPNODUPS -
WITH(81,1) USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(81:C'BB')
/*
//CTL2CNTL DD *
INREC OVERLAY=(81:C'VV')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=FILEC,INCLUDE=(81,2,CH,EQ,C'VB'),
BUILD=(1,80)
OUTFIL FNAMES=FILED,SAVE,
BUILD=(1,80)
/*
Back to top
atchuta konduri New User Joined: 25 Oct 2007Posts: 16 Location: mumbai
Thank you Frank, it worked perfectly
Back to top
atchuta konduri New User Joined: 25 Oct 2007Posts: 16 Location: mumbai
Hi,
As mentioned in the earlier post we have two files. above resolution given by frank is working perfectly but i have a small problem here.
FileA
======
789111567
111888991
330007845
FileB
======
789111567
311888991
330007845
but fileA contains data in hex format (S9(09) USAGE COMP).
FileB --- Picture clause defined as 9(09).
Is there any way to compare these two files? or Do i need to convert any of these file format before icetool step?
Thanks in advance.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
9(9) is a 9-byte ZD field.
S9(9) COMP is a 4-byte BI field (assuming its unsigned like the 9(9) field).
If you want to compare these two fields, you must convert one of them first. You could use a DFSORT/ICETOOL job like this. However, your output files could have a mixture of the records with the ZD fields and the records with the BI fields. I'm not sure if that's what you want. If not, you need to explain what you do want for output.
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FILEA DD DSN=... input fileA (FB/80) - ZD field
//FILEB DD DSN=... input fileB (FB/80) - BI field
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//FILEC DD DSN=... output fileC (FB/80)
//FILED DD DSN=... output fileD (FB/80)
//TOOLIN DD *
COPY FROM(FILEA) TO(T1) USING(CTL1)
COPY FROM(FILEB) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(FILEC) ON(83,4,BI) KEEPNODUPS -
WITH(81,1) USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(81:C'BB',83:1,9,ZD,TO=BI,LENGTH=4)
/*
//CTL2CNTL DD *
INREC OVERLAY=(81:C'VV',83:1,4)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=FILEC,INCLUDE=(81,2,CH,EQ,C'VB'),
BUILD=(1,80)
/*
Back to top
Please enable JavaScript!