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.
Joined: 14 Jan 2008 Posts: 2504 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.
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.
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!