Page 1 of 1

Is COBOL string CASE sensitive?

PostPosted: Thu Sep 06, 2012 2:21 pm
by seiko
I am comparing for a string, see for example

if value = APPLE
compute ..
if value = GRAPES
compute ..

but the value on my file is lowercase.

What should i do inorder to match values, aside from inspect converting and without changing my input file?
Are there any methods in cobol?

thanks

Re: Is COBOL string CASE sensitive?

PostPosted: Thu Sep 06, 2012 2:45 pm
by BillyBoyo
Cobol conditions are "case sensitive". Or, to be more exact, if you are doing any particular test, it is looking for one, and only one, particular bit-pattern for the bytes being tested (per condition value).

If you MOVE your input field to a WORKING-STORAGE field and use the intrinsic function to make it upper-case then your test will work with an upper-case condition value will work for both upper- and lower-case values on your input file.

I know you'll be looking in the manual for intrinsic functions, so I'll let you find the name of it yourself.

Re: Is COBOL string CASE sensitive?

PostPosted: Thu Sep 06, 2012 4:03 pm
by NicC
Again a question that could be answered in class - do you think you are the only one wondering? If it was not mentioned , or was unclear, then ASK.