Page 1 of 1

88-Level and display.

Posted: Fri Jul 19, 2013 12:04 pm
by Sachin Kumar
Hi,

Can we display the value of 88-level variables?

Re: 88-Level and display.

Posted: Fri Jul 19, 2013 4:34 pm
by Robert Sample
1. There is no such thing as an 88-level variable.
2. 88 levels are called conditions, not variables.
3. You can display the variable associated with the 88-level, but not the condition.

Code like this (untested) would achieve what you asked:

Code: Select all

05  WS-VAR PIC X(01).
     88  COND-A VALUE 'A'.
     88  COND-B VALUE 'B'.

IF  COND-A
    DISPLAY 'COND-A ' WS-VAR
ELSE
     IF  COND-B
         DISPLAY 'COND-B' WS-VAR
     END-IF
END-IF.

Re: 88-Level and display.

Posted: Wed Jul 24, 2013 1:27 pm
by Manoj
Robert Sample wrote:1. There is no such thing as an 88-level variable.
So is it always wrong to mention them as "variables"?

Re: 88-Level and display.

Posted: Wed Jul 24, 2013 7:09 pm
by Robert Sample
An 88-level is not a variable. The manual calls them
88 Identifies any condition-name entry that is associated with a particular value of a conditional variable. (For details, see "VALUE clause" in topic 5.3.18.)
and the various places in the manual will refer to "condition-name" or "entry" for 88-levels.

If you refer to an 88-level as a variable, people will generally know what you mean; however, if you try something like MOVE 'A' TO COND-A in your program, you will find out that COBOL does NOT treat 88-levels as variables

Re: 88-Level and display.

Posted: Sun May 04, 2014 9:55 pm
by Sachin Kumar
That make sense Robert and I think a kind of notion one (I) can't figure out from manuals...Thanks for your time.

Re: 88-Level and display.

Posted: Sun May 04, 2014 10:38 pm
by Robert Sample
It is common -- but wrong -- to see them referred to as "variables". From the Enterprise COBOL Language Reference manual, the distinction is clarified:
A condition-name is used in conditions as an abbreviation for the relation condition. The rules for comparing a conditional variable with a condition-name value are the same as those specified for relation conditions. If condition-name-1 has been associated with a range of values (or with several ranges of values), the conditional variable is tested to determine whether its value falls within the ranges, including the end values. The result of the test is true if one of the values that corresponds to the condition-name equals the value of its associated conditional variable. | Condition-names are allowed for alphanumeric, DBCS, national, and | floating-point data items, as well as others, as defined for the | condition-name format of the VALUE clause. The following example illustrates the use of conditional variables and condition-names:

01 AGE-GROUP PIC 99.
88 INFANT VALUE 0.
88 BABY VALUE 1, 2.
88 CHILD VALUE 3 THRU 12.
88 TEENAGER VALUE 13 THRU 19.


AGE-GROUP is the conditional variable; INFANT, BABY, CHILD, and TEENAGER are condition-names. For individual records in the file, only one of the values specified in the condition-name entries can be present.
The variable is called the conditional variable while the associated 88-levels are condition names -- so it is NOT correct to refer to 88-levels as "variables".

Re: 88-Level and display.

Posted: Mon May 05, 2014 2:16 pm
by William Collins
You can't directly DISPLAY the values associate with 88's (for the reasons Robert has gone into) but you can see them. In your source. In the compile listing. In the loadmodule on the library, as part of the module in a dump, etc. Why would you need more than that?

Re: 88-Level and display.

Posted: Tue May 06, 2014 3:20 pm
by Sachin Kumar
Got it, thanks.