Rule Definition
When a program doesn't check for its files availability, it may produce an abend.
Remediation
Always have ON UNDF or ON UNDEFINEDFILE statement for the declared files.
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 UNDF (FTEST1) UDF_FTEST1 = ON;
ON UNDF (FTEST2) UDF_FTEST2 = 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 UNDF (FTEST1) UDF_FTEST1 = ON;
ON UNDF (FTEST2) UDF_FTEST2 = ON;
ON UNDF (FTEST3) UDF_FTEST3 = 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.