Previous | Contents | Index |
The DISPOSE (or DISP) specifier indicates the status of the file after the unit is closed. It takes one of the following forms:
|
dis
Is a scalar default character expression that evaluates to one of the following values:
' KEEP ' or ' SAVE ' Retains the file after the unit closes. ' DELETE ' Deletes the file after the unit closes. ' PRINT ' 1 Submits the file to the system line printer spooler and retains it. ' PRINT/DELETE ' 1 Submits the file to the system line printer spooler and then deletes it. ' SUBMIT ' Submits the file to the batch job queue and then retains it. ' SUBMIT/DELETE ' Submits the file to the batch job queue and then deletes it.
A read-only file cannot be deleted.
The default is ' DELETE ' for scratch files; a scratch file cannot be saved, printed, or submitted. For all other files, the default is ' KEEP ' .
The EXTENDSIZE specifier indicates the number of blocks by which to extend a disk file (extent) when additional storage space is needed. It takes the following form:
|
es
Is a scalar numeric expression.
If you do not specify EXTENDSIZE or if you specify zero, the process or system default for the device is used.
On the relationship between the EXTENDSIZE specifier and the
INITIALSIZE specifier, see Section 12.6.16.
12.6.14 FILE Specifier
The FILE specifier indicates the name of the file to be connected to the unit. It takes the following form:
|
name
Is a character or numeric expression.
The name can be any specification allowed by the operating system.
Any trailing blanks in the name are ignored.
If the following conditions occur:
then HP Fortran generates a file name in the form
FORnnn.DAT, where nnn is the logical unit number
(with leading zeros, if necessary).
If the file name is stored in a numeric scalar or array, the name must
consist of ASCII characters terminated by an ASCII null character (zero
byte). However, if it is stored in a character scalar or array, it must
not contain a zero byte.
The FORM specifier indicates whether the file is being connected for formatted or unformatted data transfer. It takes the following form:
|
fm
Is a scalar default character expression that evaluates to one of the following values:
' FORMATTED ' Indicates formatted data transfer ' UNFORMATTED ' Indicates unformatted data transfer
The default is
'
FORMATTED
'
for sequential access files, and
'
UNFORMATTED
'
for direct
and keyed
access files.
The INITIALSIZE specifier indicates the number of blocks in the initial
storage allocation (extent) for a disk file. This information is used
by the EXTENDSIZE specifier, which indicates the number of blocks by
which a disk file is extended each time more space is needed for a
file. The INITIALSIZE specifier takes the following form:
If you do not specify INITIALSIZE or if you specify zero, no initial
allocation is made. The system attempts to allocate contiguous space
for INITIALSIZE, but noncontiguous space is allocated if there is not
enough contiguous space available.
INITIALSIZE is effective only at the time the file is created. If
EXTENDSIZE is specified when the file is created, the value specified
is the default value used to allocate additional storage for the file.
If you specify EXTENDSIZE when you open an existing file, the value you
specify supersedes any EXTENDSIZE value specified when the file was
created, and remains in effect until you close the file. Unless
specifically overridden, the default EXTENDSIZE value is in effect on
subsequent openings of the file.
The KEY specifier defines the access keys for records in an indexed
file. It takes the following form:
The defaults are CHARACTER and ASCENDING.
The key starts at position e1 in a record and has a length of
e2-e1+1 . The values of e1 and e2 must cause the
following calculations to be true:
If the key type is INTEGER, the key length must be either 2 or 4.
Defining Primary and Alternate Keys
You must define at least one key in an indexed file. This is the
primary key (the default key). It usually has a unique value for each
record.
You can also define alternate keys. RMS allows up to 254 alternate keys.
If a file requires more keys than the OPEN statement limit, you must
create the file using another language or the File Definition Language
(FDL).
Specifying and Referencing Keys
You must use the KEY specifier when creating an indexed file. However,
you do not have to respecify it when opening an existing file, because
key attributes are permanent aspects of the file. These attributes
include key definitions and reference numbers for subsequent I/O
operations.
However, if you use the KEY specifier for an existing file, your
specification must be identical to the established key attributes.
Subsequent I/O operations use a reference number, called the
key-of-reference number, to identify a particular key. You do not
specify this number; it is determined by the key's position in the
specification list: the primary key is key-of-reference number 0; the
first alternate key is key-of-reference number 1, and so forth.
12.6.16 INITIALSIZE Specifier
insz
Is a scalar numeric expression.
12.6.17 KEY Specifier
kspec
Takes the following form:
e1
Is the first byte position of the key.
e2
Is the last byte position of the key.
dt
Is the data type of the key: INTEGER or CHARACTER.
dr
Is the direction of the key: ASCENDING or DESCENDING.
1 .LE. (e1) .AND. (e1) .LE. (e2) .AND. (e2) .LE. record-length
1 .LE. (e2-e1+1) .AND. (e2-e1+1) .LE. 255
On the FDL, see the OpenVMS Record Management Services Reference Manual.
The MAXREC specifier indicates the maximum number of records that can
be transferred from or to a direct access file while the file is
connected. It takes the following form:
The default is the maximum allowed (2**32--1).
NAME is a nonstandard synonym for FILE (see Section 12.6.14).
The NOSPANBLOCKS specifier indicates that records are not to cross disk
block boundaries. It takes the following form:
This specifier causes an error to occur if any record exceeds the size
of a physical block.
The ORGANIZATION specifier indicates the internal organization of the
file. It takes the following form:
The default is
'
SEQUENTIAL
'
. However, if you omit the ORGANIZATION specifier when you open an
existing file, the organization already specified in that file is used.
If you specify ORGANIZATION for an existing file, org must
have the same value as that of the existing file.
12.6.18 MAXREC Specifier
mr
Is a scalar numeric expression. If necessary, the value is converted to
integer data type before use.
12.6.19 NAME Specifier
12.6.20 NOSPANBLOCKS Specifier
12.6.21 ORGANIZATION Specifier
org
Is a scalar default character expression that evaluates to one of the
following values:
'
SEQUENTIAL
'
Indicates a sequential file.
'
RELATIVE
'
Indicates a relative file.
'
INDEXED
'
Indicates an indexed file.
12.6.22 PAD Specifier
The PAD specifier indicates whether a formatted input record is padded with blanks when an input list and format specification requires more data than the record contains.
The PAD specifier takes the following form:
|
pd
Is a scalar default character expression that evaluates to one of the following values:
' YES ' Indicates the record will be padded with blanks when necessary. ' NO ' Indicates the record will not be padded with blanks. The input record must contain the data required by the input list and format specification.
The default is ' YES ' .
This behavior is different from FORTRAN 77, which never pads short records with blanks. For example, consider the following:
READ (5,'(I5)') J |
If you enter 123 followed by a carriage return, FORTRAN 77 turns the I5 into an I3 and J is assigned 123.
However, HP Fortran pads the 123 with 2 blanks unless you explicitly open the unit with PAD= ' NO ' .
You can override blank padding by explicitly specifying the BN edit descriptor.
The PAD specifier is ignored during output.
12.6.23 POSITION Specifier
The POSITION specifier indicates the position of a file connected for sequential access. It takes the following form:
|
pos
Is a scalar default character expression that evaluates to one of the following values:
' ASIS ' Indicates the file position is unchanged if the file exists and is already connected. The position is unspecified if the file exists but is not connected. ' REWIND ' Indicates the file is positioned at its initial point. ' APPEND ' Indicates the file is positioned at its terminal point (or before its end-of-file record, if any).
The default is ' ASIS ' .
A new file (whether specified as new explicitly or by default) is always positioned at its initial point.
On record position, advancement, and transfer, see the HP Fortran for OpenVMS User Manual.
The READONLY specifier indicates only READ statements can refer to this
connection. It takes the following form:
READONLY is similar to specifying ACTION=
'
READ
'
, but READONLY prevents deletion of the file if it is closed with
STATUS=
'
DELETE
'
in effect.
Default file access privileges are READWRITE, which
can cause run-time I/O errors if the file protection does not permit
write access.
The READONLY specifier has no effect on the protection specified for a
file. Its main purpose is to allow a file to be read simultaneously by
two or more programs. For example, use READONLY if you wish to open a
file so you can read it, but you also want others to be able to read
the same file while you have it open.
12.6.24 READONLY Specifier
On file sharing, see the HP Fortran for OpenVMS User Manual.
12.6.25 RECL Specifier
The RECL specifier indicates the length of each record in a file connected for direct or keyed access, or the maximum length of a record in a file connected for sequential access.
The RECL specifier takes the following form:
|
rl
Is a positive numeric expression indicating the length of records in the file. If necessary, the value is converted to integer data type before use.If the file is connected for formatted data transfer, the value must be expressed in bytes (characters). Otherwise, the value is expressed in 4-byte units (longwords). If the file is connected for unformatted data transfer, the value can be expressed in bytes if compiler option /ASSUME=BYTERECL is specified.
The rl value is the length for record data only. It does not include space for control information, such as two segment control bytes (if present) or the bytes that RMS requires for maintaining record length and deleted record control information.
The length specified is interpreted depending on the type of records in the connected file, as follows:
Errors occur under the following conditions:
Table 12-2 lists the maximum values that can be specified for rl for disk files that use the fixed-length record format:
Record I/O Statement Format | ||
---|---|---|
File Organization | Formatted (bytes) | Unformatted (longwords) |
Sequential | 32767 | 8191 |
Relative | 32255 | 8063 |
Indexed | 32224 | 8056 |
For other record formats and device types, the record size limit may be less, as described in the OpenVMS Record Management Services Reference Manual.
You must specify RECL when opening new files (STATUS= ' NEW ' , ' UNKNOWN ' , or ' SCRATCH ' ) and one or more of the following conditions exists:
The default value depends on the setting of the RECORDTYPE specifier, as shown in Table 12-3.
RECORDTYPE | RECL value |
---|---|
' FIXED ' | None; value must be explicitly specified |
All other types |
133 bytes (for formatted records)
511 longwords (for unformatted records) |
Previous | Next | Contents | Index |