Rule Definition
Each file used by a program must be properly opened and closed. It is especially important for temporary datasets that are allocated in the step that executes the Cobol programs. If the file is not closed explicitly, then data can be lost.
Remediation
For each Cobol programs using files, check if files are closed. If not, then add a CLOSE statement at the end of the program.
Violation Code Sample
PROCEDURE DIVISION
0000-MAIN.
OPEN OUTPUT DTA-FILE.
PERFORM 1000-PROC1.
STOP RUN.
1000-PROC1.
...
MOVE VAR-01 TO DTA-FILE-REC.
WRITE DTA-FILE-REC.
Fixed Code Sample
PROCEDURE DIVISION
0000-MAIN.
OPEN OUTPUT DTA-FILE.
PERFORM 1000-PROC1.
CLOSE DTA-FILE.
STOP RUN.
1000-PROC1.
...
MOVE VAR-01 TO DTA-FILE-REC.
WRITE DTA-FILE-REC.
Reference
IBM Enterprise Cobol - Performance Tuning
Related Technologies
Cobol
Technical Criterion
Efficiency - SQL and Data Handling Performance
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.