Compare files and write matching records



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Compare files and write matching records

Postby deesunke » Wed Mar 13, 2013 4:54 pm

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.
deesunke
 
Posts: 2
Joined: Wed Mar 13, 2013 4:24 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Compare files and write matching records

 

Re: Compare files and write matching records

Postby BillyBoyo » Wed Mar 13, 2013 8:06 pm

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?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Compare files and write matching records

Postby deesunke » Wed Mar 13, 2013 8:54 pm

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.
deesunke
 
Posts: 2
Joined: Wed Mar 13, 2013 4:24 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post