View previous topic :: View next topic
|
Author |
Message |
thangavels
New User
Joined: 03 May 2009 Posts: 6 Location: Chennai
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
What's the question? |
|
Back to top |
|
|
thangavels
New User
Joined: 03 May 2009 Posts: 6 Location: Chennai
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
thangavels
New User
Joined: 03 May 2009 Posts: 6 Location: Chennai
|
|
|
|
Therecords are not numeric. It is a Alphanumeric. So is it possible to compare these Alphanumeric with the above mentioned method? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
|