Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 6970
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: 8189
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: 6970
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: 8189
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 Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 0 Thu Nov 23, 2017 10:24 am
No new posts Comparing dates in different formats migusd SYNCSORT 4 Sat Nov 18, 2017 3:02 am
No new posts Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm
No new posts Copy selected columns from 2 input fi... Poha Eater DFSORT/ICETOOL 3 Thu Nov 02, 2017 3:43 pm
This topic is locked: you cannot edit posts or make replies. Comparing current time with the time ... arunsoods SYNCSORT 1 Mon Oct 30, 2017 4:07 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us