Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Compare two files with multiple filelds

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Compare two files with multiple filelds
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Wed Nov 24, 2010 1:02 pm    Post subject: Reply to: Compare two files with multiple filelds
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Wed Nov 24, 2010 7:06 pm    Post subject: Reply to: Compare two files with multiple filelds
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: 2360
Location: Israel

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

Sounds to me like a job for SORT...

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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Wed Nov 24, 2010 7:28 pm    Post subject: Reply to: Compare two files with multiple filelds
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: 2422
Location: Netherlands, Amstelveen

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

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

Active Member


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

PostPosted: Wed Nov 24, 2010 7:48 pm    Post subject:
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Wed Nov 24, 2010 7:57 pm    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Wed Nov 24, 2010 8:01 pm    Post subject:
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Wed Nov 24, 2010 8:02 pm    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Wed Nov 24, 2010 8:14 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Thu Nov 25, 2010 12:47 am    Post subject:
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: 2158
Location: @my desk

PostPosted: Thu Nov 25, 2010 10:22 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm
No new posts COMPARE command sivatechdrive TSO/ISPF 7 Fri Sep 16, 2016 4:31 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us