phv
Well, I guess I need to start over. First of all, the code is NOT my code. Were it my code it would be written correctly using the parens for clarity. That said, the code resides in a program I have been assigned to make changes in and the statement is not one appearing on my specs...
k5tm
Your input so far seems most reasonable. We agree that unless SW-PRINT = 1 then no evaluation of HLD-REC-TYPE is done. However, you say since the expression by standard must be evaluated left-to-right, if HLD-REC-TYPE not = '5' the value of the expression remains unknown, causing the...
ph
you say the IF condition is true if ANY of the following is true:
1) SW-PRINT = 1 AND HLD-REC-TYPE = '5'
2) HLD-REC-TYPE = '4' (even if SW-PRINT NOT = 1)
3) HLD-REC-TYPE = '6' (even if SW-PRINT NOT = 1)
The was this statement is currently written, not using parens, you may be right. But, I...
PH
Thanks for your input. You say to always use the parens, but you did not use parens in your second example. any reason why? Years ago I though I recalled to always use parens in the AND/OR relation when either the AND or the OR contained multiples, that control whould stop when the first not...
Thank you, you stated what I have known for years.
However, for the remainder of the question.
If the first check is not true, will the second and third
check be made? Or does control pass to the next statement
ending the IF statement too soon and distorting expected output?
thanks
I have the following COBOL statement.
004250 IF SW-PRINT = 1
AND HLD-REC-TYPE = '5' OR '4' OR '6'
R11725 MOVE PRT-LINE TO HD-LINE
R11725* MOVE STAA-PRT-LINE TO HD-LINE
004270 PERFORM...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.