Truusvlugindewind
Programmer
Just saw the following construction in a mainframe COBOL program:
"Look" I said to a collegue
"When the num-field actually contains a non-numeric value, the program will dump with a S0C7. In java (I followed a java course the other day) the program will stop testing because the numeric part of the IF is false, so the rest needs no evaluation. The program will not check if the field is equal zero or not, it servers no purpose. The IF is false anyhow.".
My collegue stated that for the old COBOL (OS/VS) that was true, an error would occur, but the new compiler (cobol for OS/390 2.2.0) will check the same way as java and will NOT dump.
Is this true? how about your compiler?
Code:
if (num-field in rec-layout numeric) and
(num-field in rec-layout not equal zero)
then perform this
else perform that
end-if.
"When the num-field actually contains a non-numeric value, the program will dump with a S0C7. In java (I followed a java course the other day) the program will stop testing because the numeric part of the IF is false, so the rest needs no evaluation. The program will not check if the field is equal zero or not, it servers no purpose. The IF is false anyhow.".
My collegue stated that for the old COBOL (OS/VS) that was true, an error would occur, but the new compiler (cobol for OS/390 2.2.0) will check the same way as java and will NOT dump.
Is this true? how about your compiler?