The hierarchy of the EVAL states that all calculations within parentheses 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 Operation Precedence in the ILE RPG Reference.
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 -.