Cobol Level 88

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

Cobol Level 88

Postby weekeong81 » Tue Apr 15, 2014 8:21 am

Can anyone shade some light on this:
03  WS-STATUS            PIC X.
      88  VALID-STATUS   VALUE '1', '2', '9'   
      88  ACTIVE              VALUE '1'
      88  INACTIVE           VALUE '2'
      88  DROPPED           VALUE '9'
What is the value in WS-STATUS after the SET statement?
Do you always get '1' or any value of '1', '2, or '9' ?

Posts: 1
Joined: Tue Apr 15, 2014 8:00 am
Has thanked: 0 time
Been thanked: 0 time

Re: Cobol Level 88


Re: Cobol Level 88

Postby BillyBoyo » Tue Apr 15, 2014 1:02 pm

From the SET for a condition-name you will always get the first value in the list for the VALUE clause on the 88-level which defines the condition-name.

So, in your case, yes, you always get '1'. Depending on the exact context, it could be unusual and confusing to use that line of code.

If you can provide more context, we can confirm or deny :-)
Global moderator
Posts: 3732
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 254 times

Re: Cobol Level 88

Postby dick scherrer » Tue Apr 15, 2014 7:09 pm

Hello and welcome to the forum,

Suggest you consider changing the code to one of the specific valid values so there will never be a question. . .
Hope this helps,
User avatar
dick scherrer
Global moderator
Posts: 6308
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 90 times

Re: Cobol Level 88

Postby Aki88 » Thu Apr 24, 2014 2:47 pm

@weekeong81: adding onto what Billy and Dick have already suggested; from the way the '88' levels are arranged, what the program might be doing is:

First: Setting any one of the values from 'ACTIVE', 'INACTIVE', 'DROPPED' to TRUE
Second: Later down the line in the same program, checking the 'WS-STATUS' whether it falls under -- 'VALID STATUS' category, in which case the three values will be validated.
This can be done by coding any conditional statement such as below (please note your code 'might' be using some other condition)

IF VALID-STATUS  <-- Method 1
an EVALUATE TRUE statement with --

I agree that the original query pertains to the value in WS-STATUS, but the purpose of having this kind of arrangement is tad bit different and can pertain to as above (the installation I currently support, has quite a few COBOL progs which use similar logic). Though as Dick has suggested the SET clause here can be made better, by setting a specific value.

Posts: 267
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 30 times
Been thanked: 22 times

Return to IBM Cobol


  • Related topics
    Last post