Page 1 of 1

Compare files and write matching records

PostPosted: Wed Mar 13, 2013 4:54 pm
by deesunke
I have 2 files. LRECL = 40 ,

Field1 1,5
Field2 6,11
Field3 17,8
Field4 25,8
Field5 33,8


I want to compare the file and have the following output

If the keys match on field1 and field2 and does not match on field3 or 4 or 5, write to file1
If entire record match (all fields , total length 40) , then write to another file2.
If record is only on File1 (based on Key1,2,3,4) write to file3
If record is only on File2 (based on Key1,2,3,4) write to file4

How do we achieve this in Icetool.

Re: Compare files and write matching records

PostPosted: Wed Mar 13, 2013 8:06 pm
by BillyBoyo
Why ICETOOL?

Can you show some sample data for your two input files, and the expected output for each of the four output files?

Are both or either of the input files in sequence on the entire 40 bytes?

Can you have "duplicates" on either the first two fields, the first four field, or the entire record?

Re: Compare files and write matching records

PostPosted: Wed Mar 13, 2013 8:54 pm
by deesunke
Here is the sample data..

File 1

A250098985747321201201019999123120130312
A250198985747321201201019999123120130312
A250298985747321201201019999123120130312

File 2

A250098985747321201201019999123120130312
A250098985747321201201012014123120130312
A250398985747321201201019999123120130312
A250498985747321201201019999123120130312


Expected output:

Match File :

A250098985747321201201019999123120130312

data from File 1 only

A250198985747321201201019999123120130312
A250298985747321201201019999123120130312

data from File 2 only

A250398985747321201201019999123120130312
A250498985747321201201019999123120130312


Data matching for Field 1 and 2 in both the files, but Field 4 has different value in file 2.

A250098985747321201201012014123120130312


So in all we will have 4 output files.

Both the files will be sorted on entire 40 bytes.

Yes. the file can have duplicates on first two fields, the first four field, or the entire record

I was thinking if this can be done in ICETOOL as we use DFSORT, but any other method that can give the expected results should be fine. We dont have EZT on our mainframes.. so could not use that.