Page 1 of 1

What is the use of level number 88 in COBOL?

Posted: Sat Nov 14, 2015 12:00 pm
by Anand Bharti
H,

What is the use of level number 88 in COBOL? What are the different ways we can use it in programs? Give some examples.

To this my answer was, level number 88 in COBOL is used for condition names . Any level number except 66 and 77 can be a CONDITION VARIABLE. But interviewer asked further and I could not satisfy him better. Could anyone explain this question more in detail.

Re: What is the use of level number 88 in COBOL?

Posted: Sat Nov 14, 2015 7:58 pm
by Robert Sample
The 88 level can be used to define groupings of a variable. For example:

Code: Select all

88 NE-STATES VALUE 'ME', 'MA', 'NH', 'VT', 'RI', 'CT', 'NY'.
88 SE-STATES VALUE 'FL', 'GA', 'SC', 'NC', 'TN', 'AL', 'MS'.
etc
could be used to define groups of US states. It is easier to understand

Code: Select all

IF NE-STATES
than

Code: Select all

IF STATE-CODE = 'ME' OR 'MA' OR ...
and if the IF statements are used extensively, they are easier to code and maintain (if New Jersey is moved from Mid-Atlantic states to the Northeast states, you can move the one state code from MA-STATES to NE-STATES, rather than having to locate EVERY IF statement in the program that references NJ and changing it.).