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
 

 

Comparing 2 alphanumeric files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
thangavels

New User


Joined: 03 May 2009
Posts: 6
Location: Chennai

PostPosted: Mon May 25, 2009 10:30 pm    Post subject: Comparing 2 alphanumeric files
Reply with quote

Hi,
I have 2 Alphanumeric files. i need to compare each record from the input files and write it into output file. i need to check these three conditions as mentioned below.

1. equal
2. greater than
3. smaller than

after checking above conditions, need to right output in a file as ( equal, greater,smaller ).

example input files below,

Inputfile1 :
eng23land
india2
12australia

Inputfile2:
eng23land
india34
1australia
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon May 25, 2009 10:32 pm    Post subject:
Reply with quote

What's the question?
Back to top
View user's profile Send private message
thangavels

New User


Joined: 03 May 2009
Posts: 6
Location: Chennai

PostPosted: Mon May 25, 2009 10:48 pm    Post subject: Reply to: Comparing 2 alphanumeric files
Reply with quote

i want to compare two strings ( compare record 1 from input_file1 with record 1 from input_file2 ,compare record 2 from input_file1 with record 2 from input_file2 and so on.... )
result should written in output_file.

help me in comparing alpha-numeric strings.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Mon May 25, 2009 10:58 pm    Post subject:
Reply with quote

IF record-1 = record-2 then perform write-equal
IF record-1 > record-2 then perform write-1-gt-2
IF record-1 < record-2 then perform write-1-le-2
Back to top
View user's profile Send private message
thangavels

New User


Joined: 03 May 2009
Posts: 6
Location: Chennai

PostPosted: Mon May 25, 2009 11:15 pm    Post subject: Reply to: Comparing 2 alphanumeric files
Reply with quote

Therecords are not numeric. It is a Alphanumeric. So is it possible to compare these Alphanumeric with the above mentioned method?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Mon May 25, 2009 11:17 pm    Post subject:
Reply with quote

Did you look in the manual (link at the top of the page) to see what COBOL allows you to do with alphanumeric variables?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Mon May 25, 2009 11:34 pm    Post subject:
Reply with quote

Robert Sample wrote:
Did you look in the manual (link at the top of the page) to see what COBOL allows you to do with alphanumeric variables?


can I answer the question? as in "DID YOU READ ANYTHING?".
Huh, can I?

School project questions should be in the interview forum,
if they are asked on this website.
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: Mon May 25, 2009 11:44 pm    Post subject:
Reply with quote

Hello,

It sounds like you want to "match" the 2 files.

Assuming that both files are sorted in the same sequence you can download and use the 2-file match/merge sample code that is attached to a "Sticky" near the top of the cobol part of the forum.

You need to right-click and save the attachment to your local drive, then upload it into a source library on the mainframe. All you need to do is change to code for your specifics and it will do what you want.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Tue May 26, 2009 12:07 am    Post subject:
Reply with quote

Quote:
can I answer the question? as in "DID YOU READ ANYTHING?".
Huh, can I?
Go for it, Dick! Come up with a good one!

Quote:
Therecords are not numeric. It is a Alphanumeric. So is it possible to compare these Alphanumeric with the above mentioned method?
Unlike certain other languages, COBOL does not use different comparison operators for numeric and alphanumeric data. This statement makes me question whether you know anything about COBOL at all.
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 Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm


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