General file features
Be sure to close all of the files that have been opened by the application program before exiting the application program. Without this operation, file corruptions and /or system resource leaks may arise.
A double open error (I-O status: 41) does not occur even though the same file is opened in a process. In this case, a different file descriptor is assigned. The maximum number of file descriptors that can be opened in the same process is 1024.
If two or more errors occur when the API function is executed, an I-O status different from those of the COBOL application may be returned.
For the I-O statements in COBOL that do not need explicit description of the access method, the sequential access/random access API functions must be explicitly described to use the API. Be sure to describe the file organization and access method.
The current status functions (cobfa_errno(), cobfa_stat(), cobfa_reclen(), and cobfa_recnum()) are shared values and do not retain values for each file descriptor. These values are replaced or destroyed by the next call to an API function. Therefore, these values should be saved in local variables before calling the next I-O function.
To read, write, rewrite, or position a record, an area that is equivalent to or larger than the maximum/fixed record length used to open the file should be reserved in advance as the area for passing the data. For functions using other pointers, be sure to reserve the necessary area in advance as well.
Note that errors can be detected only when API functions are executed although errors can be detected during compilation in COBOL. Practically, these errors are inconsistent bit-wise flags, incorrect index key specification, etc.
For quantitative restrictions of files, refer to "Functional differences between file systems" in the "NetCOBOL User's Guide" and "Sequential File", "Relative File", in Appendix B of the "NetCOBOL Language Reference".
For correspondence between the COBOL data types and C language data types, refer to "Correspondence of COBOL and C Data Types" in the "NetCOBOL User's Guide". Note that the internal format of COMP-5 is different from the internal format of binary.
Please note the code of the specified filename when you open the file. When the code is mistaken, operation is not guaranteed.
cobfa_open() : Shift-JIS
cobfa_openW() : Unicode(UTF-16)
Enclose the file name with double quotes (") when you specify a file that contains commas (,) in the file name.
Line sequential file
A 0-byte record cannot be written.
In this product, when 0x0D 0x0A (line feed and line break) is treated as a line-feed character, and it begins to write records, it adds.
A control character contained in a record to be read is treated as follows:
0x0C (page feed): Treated as a record delimiter
0x0D (return): Treated as a record delimiter
0x1A (data end symbol): Treated as a file terminator
If a record read from a line sequential file includes a tab, the tab code is replaced by a blank. Refer to "Processing Line Sequential Files", in "File Processing" of NetCOBOL User's Guide for details.
Record sequential file
The print file cannot be handled, therefore the following limitations:
No support for LINAGE clause in the COBOL syntax.
No support for the line feed control /page control for the WRITE statement in the COBOL syntax.
Relative file
The relative record number must be explicitly specified by using an argument in random delete (cobfa_delrec()), random write (cobfa_wrrec()), random rewrite (cobfa_rewrec()), and random read (cobfa_rdrec()).
The relative record number of the record accessed in sequential read (cobfa_rdnext()) and sequential write (cobfa_wrnext()) can be acquired by using the cobfa_recnum() function.
Indexed file
When opening an existing file, you can open it without specifying the record key list. In this case, the file is opened based on the record key list in the existing file.
The cobfa_indexinfo() function can be used to retrieve the indexed file attributes (record length and record format) or record key list after the file is open.
The multithread function is specific to server operation environment products.
The following functions must be used for exclusive control (setting and opening exclusive lock) when accessing COBOL files. For details, see the description of each API function.
LOCK_cobfa()
UNLOCK_cobfa()
In a multithread environment, exclusive control is required before calling API function with input-output function and API function in which the file information is acquired. If the access is not exclusively controlled, the following problems may occur:
Incorrect execution of input-output files
Abnormal termination of the thread
File corruption
Please refer to "3.25 UNLOCK_cobfa()nlock of exclusive control.
Unicode
Note the following points regarding handling of Unicode:
Set the number of bytes for key part length kp_leng of indexed files to be handled by COBOL applications operating in Unicode mode.
Set the number of bytes for the record length of line sequential files to be handled by COBOL applications operating in Unicode mode.
Other
DLL and applications created using a file access routine of V5.0L10 or before will operate correctly. However, part of the header file contents was modified for the V6.0L10 release. Therefore, if an application created for a file access routine of V5.0L10 or before must be corrected, recompile all related source programs.