IF IDX <= MAX-IDX AND MYTBL(IDX) > 34
without worrying about making a reference outside the bounds of the table. If IDX is greater than MAX-IDX, the code will not even execute the part after the AND. I knew C and Java had this feature but it quite useful to know that COBOL also has it.
The way I discovered this was that I had the 2 sides of the AND reversed, so it was ABENDING due an out-of-table reference, even though I was checking for that... I was just checking it in the wrong order. Switching the order solved it.
Does anyone know if that is part of the standard, or is it just an added feature of certain versions?