View previous topic :: View next topic
Author
Message
Ramanan-R New User Joined: 21 Mar 2007Posts: 66 Location: Chennai, Tamilnadu, India
Hi All,
I have two files of LRECL=80, with key as first 8 bytes. I need to select records of first file which doesn't have a matching key in second file.
Code:
File 1:
11111111 XXX
22222222 YYY
33333333 ZZZ
File 2:
11111111 AAAAA
22222222 BBBBB
Expected Output:
33333333 ZZZ
All output records generated, needs to be inserted a constant value 'UNDEFINED' at position 50 and remaining should be spaces.
Eg: 33333333 ZZZ UNDEFINED
Can we achieve the above using ICETOOL?
Thanks in advance,
Ramanan R
Back to top
nuthan Active User Joined: 26 Sep 2005Posts: 146 Location: Bangalore
U can search this in forum, it was posted here previously many times .
Back to top
Aaru Senior Member Joined: 03 Jul 2007Posts: 1287 Location: Chennai, India
This can be done using the SELECT operator of ICETOOL. As suggested, search this forum.
Back to top
Aaru Senior Member Joined: 03 Jul 2007Posts: 1287 Location: Chennai, India
ramanan,
What should happen if there are unique values in the file2? Should we extract that or not?
Back to top
Ramanan-R New User Joined: 21 Mar 2007Posts: 66 Location: Chennai, Tamilnadu, India
Aaru,
Thanks for your reply, but i need unique records only from file 1 and not from File2.
Suppose, if file 1 has the below records,
11111111 XXX
22222222 YYY
33333333 ZZZ
and file 2 with below records,
11111111 AAA
22222222 BBB
44444444 CCC
For the above, the output should only contain unique record from file 1 as below,
33333333 ZZZ UNDEFINED
and not as given below
33333333 ZZZ UNDEFINED
44444444 CCC UNDEFINED
Thank you,
Regards,
Ramanan R
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Ramanan R,
Here's a DFSORT/ICETOOL job that will do what you asked for:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/80)
//IN2 DD DSN=... input file2 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (FB/80)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,8,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(81:C'1')
/*
//CTL2CNTL DD *
INREC OVERLAY=(81:C'2')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(81,1,CH,EQ,C'1'),
BUILD=(1,49,50:C'UNDEFINED',80:X)
/*
Back to top
Ramanan-R New User Joined: 21 Mar 2007Posts: 66 Location: Chennai, Tamilnadu, India
Thanks Frank,
That was working fine, Can we build two records for every unique record of file 1. Like below,
33333333 ZZZ UNDEFINED HEADER RECORD
33333333 ZZZ UNDEFINED DETAIL RECORD
Regards,
Ramanan R
Back to top
Ramanan-R New User Joined: 21 Mar 2007Posts: 66 Location: Chennai, Tamilnadu, India
Thanks all,
I built two records for every unique record of file 1 using '/' in BUILD.
Like below,
Code:
BUILD=(1,49,50:C'UNDEFINED',60:'HEADER RECORD',80:X,/,
1:1,49,50:C'UNDEFINED',60:'DETAIL RECORD',80:X)
Regards,
Ramanan R
Back to top
Aaru Senior Member Joined: 03 Jul 2007Posts: 1287 Location: Chennai, India
You are welcome. Thanks for letting us know the final solution.
Back to top
Please enable JavaScript!