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

Can we compare uppercase to lowercase in COBOL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ibrahim Ronaque

New User


Joined: 20 Mar 2008
Posts: 3
Location: Mumbai

PostPosted: Tue Apr 05, 2011 5:27 pm
Reply with quote

I have a situation where first name of 1 file has lowercase character and the first name of the 2nd file has uppercase character. Though they are same name, it doesnt matches during comparison and therefore I am unable to process the record.

Can anyone help me what we could use here?

Thanks,
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 Apr 05, 2011 5:30 pm
Reply with quote

There is a link to manuals at the top of this page. Click on it, open the COBOL Language Reference manual, and read the sections (7.1.24 and 7.1.48) on the functions LOWER-CASE and UPPER-CASE.

Oh, and the answer to the question in your subject line is yes, of course we can compare lower-case to upper-case. They are never going to be equal, but you can compare them all you want.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Apr 05, 2011 5:56 pm
Reply with quote

Do you need to convert LOWER-CASE to UPPER-CASE? If so, an INSPECT with "Literals" will work. The minimum COBOL version/release for the FUNCTION's is COBOL/370 (about 18 years ago). The INSPECT will work for VS/COBOL II and greater (COBOL/370's predecessor).

If you're using OS/VS COBOL, then you'd have to use the TRANSFORM Verb (ANSI 74) or EXAMINE Verb (ANSI 68), but you'd have to build your "FROM" and "TO" images in Working-Storage for both.

A called Assembler sub-program is another option and will work for any version/release, regardless.

Bill
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Tue Apr 05, 2011 8:37 pm
Reply with quote

You have to convert both your name variables to either all lower case or all uppercase if you want to make shure that the test for equality works in all cases (sic!)

You can use any method suggested by the gentlemen above, but remember that standard function for case transformation only delas with standard codeset alphabet - national character representaions may be untouched.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Apr 06, 2011 9:04 pm
Reply with quote

It seems unusual that you want to do this comparison.

It is likely one of two situations.

Either both names (upper and lower case) have come from the same source originally, in which case it would be best to be able to compare to the original source for both files. For instance, if the original is what has come from data entry and the other has been through some formatting, then the formatting might have had other "editing" done to it (like formatting for inclusion in a letter). We used to take "DOCTOR ROBERT SAMPLE" and change it to "Dr Robert Sample" for a letter. I think the next questions are, why is one in lower case? Is it all lower case? Have there been any other changes?

Or, the names are orginally from two different sources, in which case a name is far from the best thing to try to match against (even after converting to the same case) as data entry can introduce many-a "subtle" difference to a name.

Hopefully you have the first case (also sic!) and can go back to whoever specced the file and get the correct name on the file. Otherwise you are looking at expending time doing case conversion - is it a daily task? Ick!
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top