File Options Used with Data Definition Names (C)

When you define ddnames, use options to specify the characteristics of the file your program opens. Options can appear in any order and are not case-sensitive. If you specify an option more than once, only the last one takes effect. If an option is not valid, fopen fails and errno is set accordingly.

You can use the following options when specifying a ddname:

Option Description
blksize( n )

Default: none

This option is meant to be used with record level I/O. Because record level I/O is not supported, this option is accepted but ignored.

The size in bytes of the block of data moved between the disk and the program. The maximum size is 32760 for fixed block files and 32756 for variable block files.

Larger values can improve the efficiency of disk access by lowering the number of times the disk must be accessed. Typically, values below 512 increase I/O time, and values above 8KB do not show improvement.

lrecl( n )

Default: none

The size in bytes of one record (logical record length). If the value specified is larger than the value of blksize, the lrecl value is ignored.

This option is meant to be used with record level I/O. Because record level I/O is not supported, this option is accepted but ignored.

recfm(f | v | fb | vb )

Default: recfm(f)

This option is meant to be used with record level I/O. Because record level I/O is not supported, this option is accepted but ignored.

Specifies whether the record length is fixed or variable, and whether the records are stored in blocks.

f
Record size is fixed (i.e. all records are the same length) and the size of each record is specified by the lrecl option.
v
Record size is variable and the maximum record size is specified by the lrecl option.
fb
Record size is fixed and the records are stored in blocks. The record size is specified by the lrecl option, and the block size is specified by the blksize option. The block size must be an integral multiple of lrecl.
vb
Rrecord size is variable and the records are stored in blocks. The maximum record size is specified by the lrecl option, and the block size is specified by the blksize option.
 
share (read | none | all )

Default: share(read)

Specifies the file sharing.
read
The file can be shared for read access. Other processes can read from the file, but not write to it.
none
The file cannot be shared. No other process can get access to the file (exclusive access).
all
Allows the file to be shared for both read and write access.
writethru( n | y )

Default: writethru(n)

Determines whether to force the writing of OS/2 buffers.
n
Turns off forced writes to the file. The system is not forced to write the internal buffer to permanent storage before control is returned to the application.
y
Forces the system to write to permanent storage before control is returned to the application. The directory is updated after every write operation. File output will be noticeably slower.

Use writethru(y) if data must be written to the disk before your program continues. This can help make data recovery easier should a program interruption occur.

memory( n | y )

Default: memory(n)

Specifies whether a file will exist in permanent storage or in memory.
n
Specifies that the file will exist in permanent storage.
y
Specifies that the file will exist only in memory. The system uses only the OS/2 file name. All other parameters, such as a path, are ignored. You must specify the /Sv compiler option to enable memory files.


Stream Processing


Open Streams Using Data Definition Names
Direct I/O to Memory Files