View previous topic :: View next topic
|
Author |
Message |
mosinjamadar
New User
Joined: 26 Sep 2007 Posts: 42 Location: pune
|
|
|
|
Hi
I have two files which I want to compare,but the problem is i have to compare 36 diffrent fields for each record of the file
for ex
I will read File1 and File 2 If Key is matching,I have to start comparing
each of 36 fields(which are text and numeric) with each other if there is
mismatch in the field i will write a new record in the one new output file
with both values let us say old and new value
but for me concern is there any way I can optimize the 36 fields compare
i want to avoid 36 IF statements
is it possible,If so please help me with solution
It would be great help
Regards,
Mosin |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
with both values let us say old and new value |
You already answered Yourself !
since You have to write the details of the comparison for each field
You have no choice... You will have to compare one by one (*)
if on the other side You had needed just a plain match/nomatch
You could have aggregated contiguous fields to use just one <string> compare
obviously with a properly modified record layout
(*) add on
and not stop at the first <field> mismatch, the proper thing to do is to show all of them |
|
Back to top |
|
|
bhagyac
New User
Joined: 17 Apr 2008 Posts: 44 Location: bangalore
|
|
|
|
Hi,
Can you please provide some more details reg your requirment, with ex. I feel its not clear.
If u just want to compare the files, u can use ISRSUPC utility.
Thanks. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
seemed clear enough to me |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Sounds to me like a job for SORT...
O. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
at a first glance I thought the same
but the customized formatting might get a bit complicated ( just a guess ) |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
SAS, Easytrev, DB2? |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
FORTRAN, APL, ALGOL, JOVIAL, SNOBOL, LISP? |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Ah, its about languages in stead of tools.
I would opt for : DUTCH |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
mijn hond heeft vier poten |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
expat wrote: |
mijn hond heeft vier poten |
mijn hond is een jongen en heeft 5 poten |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
Back to top |
|
|
bhagyac
New User
Joined: 17 Apr 2008 Posts: 44 Location: bangalore
|
|
|
|
You mean you need to get the output file as below.??
FileA FileB
AA12345 AAA23B5
BB2879B BB2CB9C
CC52A1Z CC5A2ZZ
OUTPUT FILE
AA1A4B
BB8C7BBC
CC2AA21Z
do you want to generate such output file? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
do you want to generate such output file? |
Probably not. . .
The request was a way to compare 36 fields without writing code to compare 36 fields. . .
This "soluton" does some kind of byte-by-byte comparison of one field. . . |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
mosinjamadar,
You can do it in SORT as well as some code. Choice is yours depending on the whole process which you want to achieve. If you have some database processing in addition to the field comparison, the best way is to do a bit of coding. On the other hand if your only aim is to compare and list out the unmatched fields, SORT may be a better alternative. |
|
Back to top |
|
|
|