Why do I get a compile error "--S: Invalid open mode" on an OPEN I-O of an ORGANIZATION LINE SEQUENTIAL file?

Question ID : 37
Created on 2009-08-31 at 4:42 PM
Author : Veryant Support [support@veryant.com]

Online URL : http://support.veryant.com/support/phpkb/question.php?ID=37

In our experience it is rare to find COBOL programs that use OPEN I-O with ORGANIZATION LINE SEQUENTIAL files. The following limitations significantly reduce the usefulness of this combination:
  1. START statement cannot be used
  2. READ PREVIOUS cannot be used
  3. The only function of REWRITE or DELETE is to replace or delete the last read record when reading forward through the file
For best performance and to take advantage of automatic Unicode conversion, the current implementation for LINE SEQUENTIAL files uses the JRE classes java.io.FileInputStream for OPEN INPUT and java.io.FileOutputStream for OPEN OUTPUT.

In order to support OPEN I-O and REWRITE on an ORGANIZATION LINE SEQUENTIAL file, the implementation would need to be modified to use the java.io.RandomAccessFile class instead.

This is feasible and Veryant will implement it if required. However, experience so far has shown that programs can be easily modified so they do not require this feature.

If the program does not update the file with REWRITE or DELETE, then the OPEN can be changed from OPEN I-O to OPEN INPUT or to OPEN OUTPUT depending on whether the program READs from or WRITEs to the file.

Otherwise, you can change the ORGANIZATION to BINARY SEQUENTIAL and add code to handle the carriage returns.

Please notify your Veryant representative if you determine that this feature is critical and that you cannot use the workarounds.

Back to Original Question