View previous topic :: View next topic
|
Author |
Message |
Ibrahim Ronaque
New User
Joined: 20 Mar 2008 Posts: 3 Location: Mumbai
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
Kjeld
Active User
Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|