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
 
Can we compare uppercase to lowercase in COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Can we compare uppercase to lowercase in COBOL
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: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Tue Apr 05, 2011 5:30 pm    Post subject:
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: 2504
Location: Atlanta, Georgia, USA

PostPosted: Tue Apr 05, 2011 5:56 pm    Post subject: Reply to: Can we compare uppercase to lowercase in COBOL
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Apr 06, 2011 9:04 pm    Post subject:
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    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 IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am

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