I have 2 files FILE1 and FIle2 both of 80 in length and the key fields are the first 12 bytes.I want to compare the file1 with file2 and those records which differ in keyfields that is the first 12 should come in a dsn as inserted records and those records which are both in file1 and file2 but which differ in fields other than the keyfields should come as updated records in another DSN can u suggest a sorting method using ICETOOL
If you need more specific help, please show an example of the records in each input file and the expected output. If input file1 has duplicate records, show that in the example. If input file2 has duplicate records, show that in the example. Be as specific as possible.
000000000001 A
000000000002 B
000000000003 C
000000000004 D
000000000005 E
and Suppose the file1 contents are like this
000000000006 A
000000000002 B
000000000003 D
000000000004 G
000000000008 E
the keyfields are first 12 in length and based pn this i want to generate 2 imput files with the following output
Inserted file should contain the following records
000000000006 A
000000000008 E
Updated file should contain the following records
000000000003 D
000000000004 G
i am comparing file2 with file1 records which are common in both file1 abnd file 2 gets eliminated
Hi
Will be more preicse about the requirement.I have 2 files FIle1 and file2.File1 is the older one file and file2 is the newer version.
I am Comparing the file2 with file1
The condition is
A)The records which are common to both file1 and file2 need to be eliminted
B)IF the key is only 12 in length starting from position one and filelength is 80,So whatever records which are differing which have the same key in file1 and file2 and which differ only from position 13-80 need to created in a seperate DSN as updated records
c) the records which differ are in file2 and which differ in key field with file1 should come as inserted records
d)the records which differ are in file1 and which differ in key field with file2 should come as Deleted records
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Well, assuming that o/p3 (deleted records) should also have the 000000000005 A5 record, I believe I understand what you want, and this DFSORT/ICETOOL job will do it:
IF we are giving the INREC OVERLAY=(81:C'11') does it adds a header '11' from the 81byte onwards for file 1 and '22' as a header for the File2 records.How does it SPLICE the records again to get updated records as '21'inserted as 22 and deleted as 11 .Could you share your thoughts on this
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
WITH(1,81) tells DFSORT to splice positions 1-81 from the second record with each key (overlay record) and position 82 from the first record with each key (base record). So for the first pair of records with the same key:
000000000001 AB ... 11
000000000001 AB ... 22
we splice
000000000001 AB ... 2
in positions 1-81 from the second record and the 1 in position 82 from the first record to get:
000000000001 AB ... 21
For records that only appear in file1, no splicing occurs and the id will be 11. KEEPNODUPS ensures we keep these non-dup records.
For records that only appear in file2, no splicing occurs and the id will be 22. KEEPNODUPS ensures we keep these non-dup records.
For complete information on the SPLICE operator of DFSORT's ICETOOL, see Chapter 6 of "z/OS DFSORT Application Programming Guide". You can access all of the DFSORT books online from:
But the actual Scenario is If we include a condition like that it will give the record in file2 as deleted record. But i want the record from file1 that got updated as when compared to file2 as updated record For example
File1
001Iamhere
002Iamhere
004Iamhere
File2
001Iamher
003Iamhere
004Iamhere
so the inserted file should contain
003Iamhere
The updated file should contain
001Iamher (since the record changed in position other than 1-3)
and the deleted should contain both the updated records in file1 as well as the deleted records from file1
001Iamhere(this is the record from file1 and not from file2)
002Iamhere
If we include the condition as u specified it will produce a deleted records file as
001Iamher (Instead of the record from file1 which is 001Iamhere)
002Iamhere