Rule Definition
When a program doesn't check the end of file exception it may produce an abend.
Remediation
Always add ON EOF or ON ENDFILE for the files declared as RECORD INPUT or RECORD UPDATE.
Violation Code Sample
DCL SYSPRINT FILE STREAM OUTPUT PRINT;
DCL FTEST1 FILE RECORD INPUT;
DCL FTEST2 FILE RECORD INPUT;
DCL FTEST3 FILE RECORD OUTPUT;
ON ENDF (FTEST1) EOF_FTEST1 = ON;
Fixed Code Sample
DCL SYSPRINT FILE STREAM OUTPUT PRINT;
DCL FTEST1 FILE RECORD INPUT;
DCL FTEST2 FILE RECORD INPUT;
DCL FTEST3 FILE RECORD OUTPUT;
ON ENDF (FTEST1) EOF_FTEST1 = ON;
ON ENDF (FTEST2) EOF_FTEST2 = ON;
Related Technologies
Technical Criterion
Programming Practices - Error and Exception Handling
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.