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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pLEASE HELP ME THIS IF CONDITION 1

Status
Not open for further replies.

sriganti

Programmer
Dec 17, 2002
2
0
0
CA
Hi,

I have some thing like this in my PGM:

IF x
or y
or z
.....
END-if

X, y and Z are 88 level.

When I compile , I am getting the folloing error:

IGYPS2048-S An invalid abbreviated relation condition was found. The statement was discarded.
IGYPS2170-E An object of a simple condition was found after a condition name or outside the scope of an abbreviated condition. The object was processed as written but may have unpredictable results.

cAN U PLEASE HELP ME?
 
Hi sriganti,

I have a feeling we are not looking at the problem in the code you provided ("I have some thing like this in my PGM: IF x or y or z...").

Could you post the actual IF statement, and the WORKING-STORAGE structure? And, do you have any one of AND, =, NOT in the real IF statement?

Dimandja
 
Hello,

if you use this with 88 numbers I would like to use an evaluate. It is faster and i think better for structure. But without your code it is qiuiet difficult to answer.

Goetz
 
Hey.

Remember that using nested IF statements with no intervening ELSE generates ANDs (IF A IF B is the same thing as IF A AND B). With OR, the ELSE denotes the OR; in IF A ... ELSE IF B..., you have IF A OR IF B. If you don't get what you want, you can also break this down into single IF statements, but I think you'll find that IF ... IF ...
means that the first If must be true to get to the second, while IF ...ELSE IF ... ELSE means that if either IF is true your test is passed.

Good Luck.
 
It doesn't look like there's a solution to the problem yet. There are some ways to change it presented above but you're going to run into the same problem that you have now.

The error message you're getting says that either x, y, or z is not an 88 level like you said.

Given:

03 FIELD-1 PIC 9(03).
88 COND-1 VALUE 1.
88 COND-2 VALUE 2.

This is an example of an abbreviated relation condition:

IF FIELD-1 = 7 OR 9
MOVE ....
END-IF.

The "FIELD-1 =" does not have to be repeated after the OR so they call it abbreviated. It saves coding rather than writing FIELD-1 = 7 OR FIELD-1 = 9

If you code something like this:

IF COND-1
OR
FIELD-1
OR
COND-2
MOVE .....
END-IF.

You're going to get the same error message that you encountered. COBOL expects a subject and a relational operator before FIELD-1.

Check your definitions and I expect you'll find that one of your "88 levels" is not really an 88.
 
Hi Lunker,

Your explanation of the problem is right on. Unfortunateely, sriganti doesn't seem to be around for it.

Dimandja
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top