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

ASSIGMENT error in IF condition

Status
Not open for further replies.

jfdumais

Programmer
Dec 4, 2007
2
0
0
CA
IF TYPEUN = "FGPVC 1" .OR. TYPEUN = "FGPVC 2" .OR. TYPEUN = "FGPVC 3" .OR. TYPEUN = "FGPVC 4" .OR. TYPEUN = "FGPVC 5" .OR. TYPEDEUX = "FGPVC 2L" .OR. TYPEDEUX = "FGPVC 3L" .OR. TYPETROIS = "FGPVC 3LB" .OR. TYPEDEUX = "FGPVC 3A" .OR. TYPEDEUX = "FGPVC 4A" .OR. TYPEDEUX = "FGPVC 5A" .OR. TYPEDEUX = "FGPVC 10" .OR. TYPETROIS = "FGPVC 10B" .OR. TYPETROIS = "FGPVC 10C" .OR. TYPETROIS = "FGPVC 20B"

This is my IF condition.

When I try to build I get an ASSIGMENT error on this line.

There is something wrong in my syntax ?

Thank you for your help.
 
Salut, jfdumais

It looks like the resulting statement is just too long.
I got it to work by splitting up the statement using semicolons:

IF TYPEUN = "FGPVC 1" .OR. TYPEUN = "FGPVC 2" .OR. TYPEUN = "FGPVC 3" .OR.;
TYPEUN = "FGPVC 4" .OR. TYPEUN = "FGPVC 5" .OR. TYPEDEUX = "FGPVC 2L" .OR.;
TYPEDEUX = "FGPVC 3L" .OR. TYPETROIS = "FGPVC 3LB" .OR.;
TYPEDEUX = "FGPVC 3A" .OR. TYPEDEUX = "FGPVC 4A" .OR. TYPEDEUX = "FGPVC 5A" .OR.;
TYPEDEUX = "FGPVC 10" .OR. TYPETROIS = "FGPVC 10B" .OR.;
TYPETROIS = "FGPVC 10C" .OR. TYPETROIS = "FGPVC 20B"
? 'Oui'
else
? 'Non'
endif

However, I have to say I would do something like:

if typeun$"FGPVC 1 \FGPVC 2 \...\FGPVC 5 " ;
.or. typedeux$"FGPVC 2L \...\FGPVC 10 ";
.or. typetrois$" ... etc

for improved readability and to shorten the line. However the strings you are testing for would each have to be padded out to len(typex), which I have assumed to be 9 bytes.

Jock
 
I *think* you are limited to about 16 conditions (it's a bit like recursion).

Regards

Griff
Keep [Smile]ing
 
Good I split it and it work fine !

Thanks a lot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top