Is COBOL string CASE sensitive?

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Is COBOL string CASE sensitive?

Postby seiko » Thu Sep 06, 2012 2:21 pm

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?

Posts: 8
Joined: Fri Aug 31, 2012 8:04 am
Has thanked: 0 time
Been thanked: 0 time

Re: Is COBOL string CASE sensitive?

Postby BillyBoyo » Thu Sep 06, 2012 2:45 pm

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.
Global moderator
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Is COBOL string CASE sensitive?

Postby NicC » Thu Sep 06, 2012 4:03 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Global moderator
Posts: 3026
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Return to IBM Cobol


  • Related topics
    Last post