Page 1 of 1

How to use DFSORT/ICETOOL in this scenario

PostPosted: Mon Nov 29, 2010 11:03 pm
by nandanphalak
Hi,

I have two files, both are fixed block.
File1 : File length 8
T1T2S1G1
T1T3S1G1
T2T3S1G1
T1T2S2G1
T1T3S2G1

File2: File length 8
I1T1T2W1
I2T1T2W2
I3T1T3W3
I4T2T3W4
I5T1T2W5
I6T1T3W6
I7T1T3W7
I8T1T3W8

Now, I need to match first 4 bytes of File1 with 3rd to 6th bytes of File2 (middle 4 bytes).
The O/p file should have number of records in File1 multiplied by number of records in File 2, if the match happens.

The o/p file would look like this:

T1T2S1G1I1W1
T1T2S1G1I2W2
T1T2S1G1I5W5
T1T3S1G1I3W3
T1T3S1G1I6W6
T2T3S1G1I4W4
T1T2S2G1I1W1
T1T2S2G1I2W2
T1T2S2G1I5W5

How to do this using DFSORT/ICETOOL/SPLICE? Anything which works with high performance is fine to me.

Best Regards

Re: How to use DFSORT/ICETOOL in this scenario

PostPosted: Tue Nov 30, 2010 12:31 am
by Frank Yaeger
It seems like your output is missing some records. Based on your "rules", wouldn't the output be:

T1T2S1G1I1W1
T1T2S1G1I2W2
T1T2S1G1I5W5
T1T2S2G1I1W1
T1T2S2G1I2W2
T1T2S2G1I5W5
T1T3S1G1I3W3
T1T3S1G1I6W6
T1T3S1G1I7W7
T1T3S1G1I8W8
T1T3S2G1I3W3
T1T3S2G1I6W6
T1T3S2G1I7W7
T1T3S2G1I8W8
T2T3S1G1I4W4


If so, then you can use this DFSORT job:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/8)
//IN2 DD DSN=...  input file2 (FB/8)
//SORTOUT DD DSN=...  output file (FB/12)
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(1,4,A)
  JOINKEYS F2=IN2,FIELDS=(3,4,A)
  REFORMAT FIELDS=(F1:1,8,F2:1,2,7,2)
  OPTION COPY
/*

Re: How to use DFSORT/ICETOOL in this scenario

PostPosted: Tue Nov 30, 2010 2:29 am
by nandanphalak
Yes Frank.. You are right.. and this job is perfect.. Thanks for your time and help!!

Best Regards