Page 1 of 1

Extract the Matching Records

PostPosted: Thu Feb 17, 2011 3:49 pm
by fornanthakumar
Hi,

I need to compare two file records and get the matching records based on the columns.Here is the input sample

INPUT FILE1
- -- -+ -- --1- - -- + - -- -2 - - - -+---
2344567890NANTHUSOUTHAFRICA
1244567890MUKILAINDIA
1244567890BREYANUNITEDSTATES
1234567890DONALDAUSTRALIA

INPUT FILE2
- -- -+ -- --1- - -- + - -- -2 - - - -+---
2134567890NANTHU
4544567890MUKILA
4564567890BREYAN
1234567890DONALD

I have done in option 3.13 , i have mentioned the columns like below
CMPCOLM 6:4 6:4
CMPCOLM 11:6 11:6

i got all the records are mismatched but according to the column all the values are matched na.. 3.13 option considered the whole record but i want to consider only the column and no matter what ever the record values are ...

could you please any one tell me, how to compare only the column values..

Re: Extract the Matching Records

PostPosted: Thu Feb 17, 2011 3:58 pm
by NicC
From the manual...
CMPCOLM Applies to the columns in both the new (or search) data set and old data set
CMPCOLMN Applies to the columns only in the new data set
CMPCOLMO Applies to the columns only in the old data set.


Are you using the correct keyword?

Re: Extract the Matching Records

PostPosted: Mon Feb 21, 2011 7:59 pm
by fornanthakumar
Records in File 1 :

1234567890
2345678901
1235789000

Records in File 2 :

1234567890
2345678902
1235467890

I want the output like

1234567890
1235467890
1235789000

It means i have just compared two file columns from position 1 to 4. I dont mind other character from position 5 to 80.

But if i use any CMPCOLM,CMPCOLMN,CMPCOLMO.. this wil check other characters from position 5 to 80. It means giving output like

1234567890

it will not consider below records though the column values from position 1 to 4 are same.
1235467890 -- FILEB
1235789000 -- FILEA

Please advice if there is any chances.

Re: Extract the Matching Records

PostPosted: Mon Feb 21, 2011 8:00 pm
by fornanthakumar
Records in File 1 :

1234567890
1834567133
1235789000

Records in File 2 :

1234567890
2345678902
1235467890

Please consider this as input file for the above reply.. apologies.

Re: Extract the Matching Records

PostPosted: Mon Feb 21, 2011 8:31 pm
by NicC
Suggest you read all about CMPCOLMx and note that you specify which columns to compare.

Re: Extract the Matching Records

PostPosted: Tue Feb 22, 2011 1:18 pm
by expat
Or maybe look at the functionality of your SORT product.