View previous topic :: View next topic
Author
Message
purushottam New User Joined: 26 Feb 2007Posts: 37 Location: pune
Want to eliminates duplicates by comparing file1 and file2. the position of the key is different in these two files. The output should consists of file1 records only.
For Example
File1 : the length of PS file is 388
Cust-id( from position 1 to 4) Address( from position 50 to 100)
_________________________ ____________________________
1111 XXXXXXXXXXXXX
2222 YYYYYYYYYYYYYYY
3333 ZZZZZZZZZZZZZ
File2 : the length of PS file is 363
Cust-id( from position 25 to 29) Address( from position 200 to 250)
_________________________ ____________________________
1111 XXXXXXXXXXXXX
5555 AAAAAAAAAAAAA
6666 BBBBBBBBBBBBB
The output file should be : the Lengh and field positions should be same as file1:
Cust-id( from position 1 to 4) Address( from position 50 to 100)
_________________________ ____________________________
2222 YYYYYYYYYYYYYYY
3333 ZZZZZZZZZZZZZ
We need to eliminate the records from file-1 if the keys matches with file2 record.
Thanks & Regards,
Puru
Back to top
sudhakar varma New User Joined: 17 Jul 2008Posts: 2 Location: pune
I also struck with similar type of request( i am using match logic thru program). Can some one please suggest, whether this is possible with SORT or not ???
Thanks in advance...
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Puru,
Here's a DFSORT/ICETOOL job that will do what you asked for. It wasn't clear if you wanted to compare on the cust-id and address fields, or just on the cust-id field. Since you mentioned both fields, I assumed you wanted to compare on both fields. If not, the job can be changed appropriately.
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/388)
//IN2 DD DSN=... input file2 (FB/363)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (FB/388)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,4,CH) ON(50,51,CH) -
NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(389:C'1')
/*
//CTL2CNTL DD *
INREC BUILD=(1:25,4,50:200,51,389:C'2')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(389,1,CH,EQ,C'1'),
BUILD=(1,388)
/*
Back to top
sudhakar varma New User Joined: 17 Jul 2008Posts: 2 Location: pune
Frank Yaeger,
Thanks a lot ............it is working as expected....
Thanks for your help............
Back to top
Anurag Singh New User Joined: 20 Jan 2008Posts: 25 Location: India
Hi,
Please explain the function of CTL1 , CTL2 and CTL3 mentioned here in the given JCL.
Thanks
Back to top
Aaru Senior Member Joined: 03 Jul 2007Posts: 1287 Location: Chennai, India
Anurag,
Quote:
Please explain the function of CTL1 , CTL2 and CTL3 mentioned here in the given JCL.
Explained as requested.
Code:
//CTL1CNTL DD *
INREC OVERLAY=(389:C'1')
/*
numeral '1' is overlaid in the 389th column for all the records in file IN1
Code:
//CTL2CNTL DD *
INREC BUILD=(1:25,4,50:200,51,389:C'2')
/*
From IN2, the records are built and written to T1
byte 1 - 4 bytes starting from 25th pos in IN2
byte 50 - 51 bytes starting from 200th byte in IN2
numeral '2' is overlaid in the 389th column
Code:
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(389,1,CH,EQ,C'1'),
BUILD=(1,388)
/*
Only the records with '1' in 389th position is selected and then the first 388 bytes are built ignoring the data in the 389th position.
Also please refer to the manuals to understand the syntax.
Back to top
Anurag Singh New User Joined: 20 Jan 2008Posts: 25 Location: India
Thanks Aaru
Back to top
Please enable JavaScript!