Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set statement error using FALSE

Status
Not open for further replies.

JebusRocks

Programmer
Sep 14, 2004
30
CA
Hello all I have the following

This definition

05 WS-COF-REC-FOUND-IND PIC X(01).
88 WS-COF-REC-FOUND VALUE 'Y'.

This set statement

SET WS-COF-REC-FOUND TO FALSE

When I try to compile I get the following error msg

"FALSE" was found in the "SET" statement. It was not allowed in this context. The statement was discarded.

I use the set statement with other 88 level variables within my program and do not encounter an error. The differernce is that I am setting them to true
ie

Set bla-blalvblas-bla to true

Any ideas? Can I not use the false key word here?
 
Another alternative:

Code:
05  WS-COF-REC-FOUND-IND            PIC X(01).
    88  WS-COF-REC-FOUND            VALUE 'Y'.
    88  WS-COF-REC-NOT-FOUND        VALUE 'N'.
.
.
.
SET WS-COF-REC-NOT-FOUND TO TRUE

Marc
 
Marc,

This is a bit of a 'religious issue' and I know I am flying in the face of tradition, but actually, I would recommend minimizing the number of user-names created to provide the desired function. In this case the following will do:
Code:
05                                  PIC X(01).
    88  WS-COF-REC-FOUND            VALUE 'Y' FALSE 'N'.
...
SET WS-COF-REC-FOUND to true
SET WS-COF-REC-FOUND to false

Warning: unsolicited opinion:

I also think that condition-names should be chosen to avoid double negatives and to promote the readability of the IF statements in which they are used.

Tom Morrison
 
You also need to be aware that the
88 ... WHEN FALSE is not available in all compilers so you may need to consider this on your decision.



Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
thanks for the replies everyone, its Monday morning and this post will get me going. Hopefully fix the one remaining issue with my code!!

Thanks again
 
I think if you can use flase and true ( As Reserved Words ) that the values have to be zero and one. The value statements probably will always work.

What I was thinking was the statement:

Value B"0"

On the AS400 you could make a variable Boolean (Spell). This would be a variable with only 2 states which would be true or false.

I dont know if other compilers let you do this.

If you do not like my post feel free to point out your opinion or my errors.
 
ceh -

TRUE and FALSE as used in the SET statement are not limited to zero/one. For example:
Code:
01  WS-SOME-VALUE         PIC X.
    88  WS-SOME-VALUE-IS-VALID VALUES ARE "A" THRU "M".
...
    SET WS-SOME-VALUE-IS-VALID
This code sets WS-SOME-VALUE to "A". Obviously, when the 88 is later used in a conditional statement, it will evaluate to true when it contains this value.

Glenn
 
Hit submit too soon. The last code line should say:

SET WS-SOME-VALUE-IS-VALID TO TRUE
 
Boolean data items and B"literals" are included in the 2002 ANSI/ISO Standards - but not implemented in many existing compilers. (The OS/400 implementation is SIMILAR but NOT identical to what is in the '02 Standard).

It is true that B"1" and B"0" may be tested against TRUE and FALSE (in the EVALUATE statement) - but SET TO TRUE or FALSE still require 88 levels to tell what is "true" and what is "false".

Bill Klein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top