Rule Definition
Use a single OPEN statement rather than separate OPEN statements for files opened by a program. Use of a single OPEN statement reduces routine loading time. System routines required for OPEN are referenced once for each OPEN statement regardless of the number of files specified in the statement.
Remediation
For each Cobol programs using several files, try to use only one OPEN statement instead of one OPEN statement per file. In addition, the same file should be opened only one time.
Violation Code Sample
0000-MAIN.
OPEN INPUT FI01.
PERFORM 1000-PROC1.
PERFORM 2000-PROC1.
CLOSE FI02.
CLOSE FI01.
STOP RUN.
1000-PROC1.
OPEN INPUT FI02.
MOVE DTA-FIELD1 TO CONT-F1.
..
Fixed Code Sample
0000-MAIN.
OPEN INPUT FI01 FI02.
PERFORM 1000-PROC1.
PERFORM 2000-PROC1.
CLOSE FI01 FI02.
STOP RUN.
1000-PROC1.
MOVE DTA-FIELD1 TO CONT-F1.
..
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.