Page 1 of 1

SORT to compare 2 files and write to 3rd file

PostPosted: Fri Feb 19, 2010 4:18 pm
by manjeera.bonakurthi
Hi...
I have 2 files..
File A:
LRECL - 3099
RECFM - VB

File B :
LRECL - 1117
RECFM - VB

I have to compare these two files with fields of position from 103-117 (ACC.NO) of file A with position 2-16 of file B .... and...
163-166 (DATE) of file A with 28-31 (DATE) of file B...

IF A MATCH OCCURES FOR BOTH FIELDS ...

Then I have to write fields of position 592-595 (TRANS-ID) of file A and 23-26(TRANS-ID) of file B...

File A
       
        ACC.NO              DATE                   TRANS-ID
------103--117------------163-166-----------------592-595---------
       1234               12/02/10                   1
       1234               10/04/10                   2     
       2345              03/03/10                   3
       3456               11/03/10                   4

File B
       ACC.NO               TRANS-ID                   DATE
------2-16----------------23-26----------------------28-31---------
      1234                    12                     04/05/10
      1234                    13                      10/04/10             
      2345                    14                      09/09/10
      3456                    15                      11/03/10


The o/p file shud b....

TRANS-ID (FILE A)                    TRANS-ID (FILE B)
       2                                         13
       4                                        15

The files does not have duplicates...
The fields (ACC.NO+DATE) acts as composite key in matching purpose...

HOW CAN I ACHIEVE THIS USING SORT UTILITY?

Re: SORT to compare 2 files and write to 3rd file

PostPosted: Fri Feb 19, 2010 10:40 pm
by Alissa Margulies
This appears to be a duplicate post, therefore, I am locking this one since the other has been answered.