View previous topic :: View next topic
|
Author |
Message |
Prabha Warnings : 2 New User
Joined: 05 Dec 2005 Posts: 79
|
|
|
|
Hi,
Below is the esisting code
IF AK402AA19 = 'MAXI '
& AK402AA24 = 'Y'
| (AK402AA19 = 'MINIE'
| AK402AA19 = 'MINIC'
| AK402AA19 = 'MINIL')
& AK402AA23 = 'Y'
THEN
G387EA01 = 3716;
END;
Here if AK402aa19 is MAXI, AK402aa24 is 'Y', Ak402AAA23 is 'y' means, 3716 will be assigned.
Now, i need to add more checking, that ak4022aa20 >=892.
IF AK402AA19 = 'MAXI '
& AK402AA24 = 'Y'
| (AK402AA19 = 'MINIE'
| AK402AA19 = 'MINIC'
| AK402AA19 = 'MINIL')
& AK402AA23 = 'Y'
&Ak4022A20 >=892
THEN
G387EA01 = 3716;
END;
Here if AK402aa19 is MAXI, AK402aa24 is 'Y', Ak402AAA23 is 'y' and Ak402AA20 is 891 means, it should not assign 3716. But my code assigns the value 3716.
Help me how to add the condition AK402AA >=892 |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
...
use the code tag to make Your code more readable
for complex logic expressions in the if
it would be better to use parenthesis !
if You had used them the operators precedences would have been more clear |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the parenthese were there
not using the code tag didn' t make them stick out !! |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
I keep hitting the enter key too early..
I see You are using parenthesis in the most unclear way...
expression without parenthesis should be used only for operators with the same precedence level
Your way of writing, in many places I have known, would not have passed quality assurance
for example :
Code: |
A & B & C is ok all &
A | B | C same
|
Code: |
A & B | C ??? without looking at the manual
( A & B ) | C
A & ( B | C )
|
the reader with a different programming language background
would have to look at the manual to find the proper operator priority |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Your problem may be with the first "or".
Quote: |
& AK402AA24 = 'Y'
| (AK402AA19 = 'MINIE'
|
I believe that should be an "&".
I'd sugest you verify which values ahould be "and'ed" and which values should be "or'ed". |
|
Back to top |
|
|
|