IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Compare two files with multiple filelds


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mosinjamadar

New User


Joined: 26 Sep 2007
Posts: 42
Location: pune

PostPosted: Wed Nov 24, 2010 12:56 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Nov 24, 2010 1:02 pm
Reply with quote

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
View user's profile Send private message
bhagyac

New User


Joined: 17 Apr 2008
Posts: 44
Location: bangalore

PostPosted: Wed Nov 24, 2010 5:10 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Nov 24, 2010 7:06 pm
Reply with quote

seemed clear enough to me icon_biggrin.gif
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Nov 24, 2010 7:07 pm
Reply with quote

Sounds to me like a job for SORT...

O.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Nov 24, 2010 7:28 pm
Reply with quote

at a first glance I thought the same
but the customized formatting might get a bit complicated ( just a guess )
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed Nov 24, 2010 7:39 pm
Reply with quote

SAS, Easytrev, DB2?
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Wed Nov 24, 2010 7:48 pm
Reply with quote

FORTRAN, APL, ALGOL, JOVIAL, SNOBOL, LISP?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed Nov 24, 2010 7:57 pm
Reply with quote

Ah, its about languages in stead of tools.

I would opt for : DUTCH
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Nov 24, 2010 8:01 pm
Reply with quote

mijn hond heeft vier poten icon_eek.gif
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed Nov 24, 2010 8:02 pm
Reply with quote

expat wrote:
mijn hond heeft vier poten icon_eek.gif


mijn hond is een jongen en heeft 5 poten icon_redface.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Nov 24, 2010 8:14 pm
Reply with quote

Peter icon_lol.gif icon_lol.gif icon_lol.gif
Back to top
View user's profile Send private message
bhagyac

New User


Joined: 17 Apr 2008
Posts: 44
Location: bangalore

PostPosted: Thu Nov 25, 2010 12:16 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Nov 25, 2010 12:47 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Nov 25, 2010 10:22 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top