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 [email@example.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:
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.
- START statement cannot be used
- READ PREVIOUS cannot be used
- The only function of REWRITE or DELETE is to replace or delete the last read record when reading forward through the file
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