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

Comparing 2 alphanumeric files


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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: 6966
Location: porcelain throne

PostPosted: Mon May 25, 2009 10:58 pm
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon May 25, 2009 11:17 pm
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: 6966
Location: porcelain throne

PostPosted: Mon May 25, 2009 11:34 pm
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

Moderator Emeritus


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

PostPosted: Mon May 25, 2009 11:44 pm
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue May 26, 2009 12:07 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
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
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top