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!

IF statement

Status
Not open for further replies.

pvuppa1

Programmer
Nov 14, 2003
61
0
0
US
Can some one help me with the below If statement, I dont know where I'm going wrong, it looks simple but, wont work.

DEFINE FILE MYFILE
TEMP/D12.2=IF FIELD1='A' AND FIELD2='B' AND FIELD3='ASD' THEN MYFIELD ELSE 0;
END
TABLE FILE MYFILE
PRINT TEMP
END

gives me below error message

0 ERROR AT OR NEAR LINE 73 IN PROCEDURE
(FOC246) COMPUTATIONAL STATEMENT REFERS TO MORE THAN ONE DATA PATH

How do I define a field with more than one condition?

Any help would be greatful

Thanks
-P
 
The message says that you are using fields from multiple data paths. Do a CHECK FILE MYFILE PICT if you can and you will see you have a multipath hierachy.

Example : NAME

| |

VACATION SALARY

Its like saying IF VACATION EQ '20040501' AND SALARY GT 1000;

This would not make sense.

See if there are JOINS in effect and how you can manipulate to get your desired result.


 
The issue is WHERE to associate the DEFINE expression. It can't reside on either path, as data is required from the 'other' path (whichever that is). DEFINE expressions are logically associated with the lowest level needed to retrieve all the referenced fields. Where that requires TWO paths, the expression can't be associated with a position in the file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top