The hierarchy of the EVAL states that all calculations within parantheses are done first. Your eval would translate to:
XXAVAL = 30 – (30 + 0 + 30) + 30 which would then become
XXAVAL = 30 – 60 + 30 whci would give a value of 0.
Parenthesis are indeed done first. For the “rest of the story” see <a href=”http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/books_web/c0925086547.htm#HDROPPREC”>Operation Precedence</a> in the ILE RPG Reference.
Integrated solutions for the System i user community
Well, my brain doesn’t always see what the my eyes show it. I copied that line of code direct from the source member. What I didn’t see was that the minus sign is abutted against the paren.
That changes the operation from a binary operation (subtract) to a unary operation (ie. like z-sub).
That’s the real problem/answer, not Operation Precedence, but Expression Operators!
So, the real formula is:
XXAVAL= 30 + (60-) + 30 making XXAVAL = zero.
I’ll remember to check for spaces in a formula, ’cause it changes + and -.