10.2. Using layered I/O

The specification list on the assign -F command comprises all of the processing steps that the I/O system performs. If assign -F is specified, any default processing is overridden. For example, unformatted sequential I/O is assigned a default structure of cos on UNICOS systems and UNICOS/mk systems. The -F cos option provides the same structure. The FFIO system provides detailed control over I/O processing requests. However, to effectively use the cos option (or any FFIO option), you must understand the I/O processing details.

As a very simple example, suppose you were making large I/O requests and did not require buffering or blocking on your data. You could specify the following:

assign -F system

The system layer is a generic system interface that chooses an appropriate layer for your file. If the file is on disk, it chooses the syscall layer, which maps each user I/O request directly to the corresponding system call. A Fortran READ statement is mapped to one or more read(2) system calls and a Fortran WRITE statement to one or more write system calls. This results in almost the same processing as would be done if the assign -s u command was used.

If you want your file to be COS blocked (the default blocking for Fortran unformatted I/O on UNICOS and UNICOS/mk systems), you can specify the following:

assign -F cos,system

If you want your file to be F77 blocked , you can specify the following:

assign -F f77,system

These two specs request that each WRITE request first be blocked (blocking adds control words to the data in the file to delimit records). The cos layer then sends the blocked data to the system layer. The system layer passes the data to the device.

The process is reversed for READ requests. The system layer retrieves blocked data from the file. The blocked data is passed to the next higher layer, the cos layer, where it is deblocked. The deblocked data is then presented to the user.

A COS blocked blank-compressed file can also be read. The following are the processing steps necessary to do this:

  1. Issue system calls to read data from the device.

  2. Deblock the data and deliver blank-compressed characters.

  3. Decompress the characters and deliver them to the user.

In this case, the spec with system is on the right end and would be as follows:

-F blankx,cos,system

You do not need to specify the system spec because it is always implied on the right end. To read the COS blocked blank-compressed file, use the following specification:

assign -F blankx,cos

Because the system spec is assumed, it is never required.

10.2.1. I/O layers

Several different layers are available for the spec argument. Each layer invokes one or more layers, which then handles the data it is given in an appropriate manner. For example, the syscall layer essentially passes each request to an appropriate system call. The tape layer uses an array of more sophisticated system calls to handle magnetic tape I/O. The blankx layer passes all data requests to the next lower layer, but it transforms the data before it is passed. The mr layer tries to hold an entire file in a buffer that can change size as the size of the file changes; it also limits actual I/O to lower layers so that I/O occurs only at open, close, and overflow.

The following tables list the classes you can specify for the spec argument to the assign -F option:

I/O Layers available on all hardware platforms
Layer 

Function

blankx or blx 

Blank compression or expansion layer

bufa 

Asynchronous buffering layer

c205/eta 

CDC CYBER 205/ETA record formats

cache 

Memory cached I/O

cachea 

Asynchronous memory cached I/O

cdc 

CDC 60-bit NOS/SCOPE file formats

cos or blocked 

COS blocking

event 

Monitors I/O layers

er90 

ER90 handlers

f77 

Record blocking common to most UNIX Fortran implementations

fd 

File descriptor open

global 

Distributed cache layer

ibm 

IBM file formats

mr 

Memory-resident file handlers

nosve 

CDC NOS/VE file formats

sds 

SDS-resident file handlers

tape or bmx 

UNICOS online tape handling

vms 

VAX/VMS file formats

null 

Syntactic convenience for users (does nothing)

site 

Site-specific layer

syscall 

System call I/O

system 

Generic system interface

text 

Newline separated record formats

user 

User-written layer

10.2.2. Layered I/O options

You can modify the behavior of each I/O layer. The following spec format shows how you can specify a class and one or more opt and num fields:

class.opt1.opt2:num1:num2:num3

For class, you can specify one of the layers listed in the previous tables. Each of the layers has a different set of options and numeric parameter fields that can be specified. This is necessary because each layer performs different duties. The following rules apply to the spec argument:

The following options all have the same effect. They all specify the sds layer on UNICOS systems and set the initial SDS allocation to 100 512-word sectors:

-F sds:100
-F sds.:100
-F sds..:100

The following option contains one spec for an sds layer that has an opt field of scr (which requests scratch file behavior):

-F sds.scr

The following option requests two class es with no opt s:

-F cos,sds

The following option contains two specs and requests two layers: cos and sds. The cos layer has no options; the sds layer has options scr and ovfl, which specify that the file is a scratch file that is allowed to overflow, and that the maximum SDS allocation is 1000 sectors:

-F cos,sds.scr.ovfl::1000

When possible, the default settings of the layers are set so that optional fields are seldom needed.