Previous Topic Next topic Print topic


Open EXTEND of Nonexistent File

In Studio Enterprise Edition, because setting the RM Compiler directive sets the NOOPTIONAL-FILE Compiler directive, if you try to open a non-existent file for I-O or EXTEND the run-time system will give an error message. For I-O, RM/COBOL does the same. However, for EXTEND, RM/COBOL creates the file and opens it as if you had specified OUTPUT.

The following options are available:

  • Add the keyword OPTIONAL to the SELECT statement. This makes Studio Enterprise Edition create the file and open it for OUTPUT
  • Create the empty file before running your program
  • Specify the OPTIONAL-FILE Compiler directive. This makes Studio Enterprise Edition create the file and open it for OUTPUT. However, the behavior with files opened for I-O will now differ from RM/COBOL
Previous Topic Next topic Print topic