VMS Help  —  FORTRAN  Statements  OPEN
  Opens an existing file or creates a new file.  If you do not
  explicitly open a file before accessing it, the file is created
  (for write operations) or opened with default attributes.

     OPEN (par[,par]...)

     par  Is a keyword specification in one of the
          following forms:

          keywd
          keywd=value

          keywd  Is a keyword.  (See the subtopic headings
                 listed at the end of this Help topic.)
          value  Is a keyword value. (Some keywords do not
                 have keyword values.)

  If an OPEN statement is executed for a unit that is already open,
  and the file pathname (or specification) is different from that of
  the current open file, the previously opened file is closed and the
  new file is opened.  If the file pathname (or specification) is the
  same for both files, the new value of the BLANK= specifier is in
  effect, but the position of the file is unaffected.

  Keyword specifications can appear in any order.  In most cases,
  they are optional.  Default values apply in their absence.  If the
  logical unit specifier is the first parameter in the list, the UNIT
  keyword is optional.

  You can specify character values at run time by substituting a
  general character expression for a keyword value in the OPEN
  statement.  The character value can contain trailing spaces but not
  leading or embedded spaces; for example:

     CHARACTER*6 FINAL /' '/
     ...
     IF (exp) FINAL = 'DELETE'
     OPEN (UNIT=1, STATUS='NEW', DISP=FINAL)

                                 NOTE

          Keyword values that are numeric expressions can  be
          any  integer  or real expression.  The value of the
          expression is converted to integer data type before
          it is used in the OPEN statement.

1  –  ACCESS

  Indicates the access method for the connection of the file.  It
  takes the following form:

  ACCESS = acc

  acc  Is a character expression with one of the following
       values:

  'DIRECT'           Access by record number
  'SEQUENTIAL'       Access sequentially (the default)
  'KEYED'            Access by a specified key
  'APPEND'           Access sequentially, after the last record
                      of the file

2  –  ACTION

  Indicates the allowed I/O operations for the file connection.  It
  takes the following form:

  ACTION = act

  act  Is a character expression with one of the
       following values:

  'READ'      Indicates that only READ statements can refer to
              this connection.
  'WRITE'     Indicates that only WRITE, DELETE, and ENDFILE
              statements can refer to this connection.
  'READWRITE' Indicates that READ, WRITE, DELETE, and ENDFILE
              statements can refer to this connection (*DEFAULT*)

3  –  ASSOCIATEVARIABLE

  Indicates a variable that is updated after each direct access I/O
  operation, to reflect the record number of the next sequential
  record in the file.  It takes the following form:

  ASSOCIATEVARIABLE = asv

  asv  Is an integer variable.  It cannot be a dummy argument
       to the routine in which the OPEN statement appears.
       Use only in direct access mode.

                                 NOTE

          Direct access  READ,  direct  access  WRITE,  FIND,
          DELETE, and REWRITE statements can affect the value
          of the variable.

4  –  BLANK

  Indicates how blanks are interpreted in a file.  It takes the
  following form:

  BLANK = blnk

  blnk  Is a character expression with one of the following
        values:

  'NULL'  Ignore all blanks in a numeric field (unless the field
          is all blanks, in which case treat blanks as zero).
  'ZERO'  Treat all blanks other than leading blanks as zeros.

  The default is 'NULL' (for explicitly OPENed files, preconnected
  files, and internal files).

  If the BN or BZ edit descriptors are specified for a formatted
  input statement, they supersede the default interpretation of
  blanks.

5  –  BLOCKSIZE

  Indicates the physical I/O transfer size for the file.  It takes
  the following form:

  BLOCKSIZE = bks

  bks  Is a numeric expression whose value specifies a
       number of bytes.

  For magnetic tape files, the value of "bks" specifies the physical
  record size in the range 18 to 32767 bytes.  The default value is
  2048 bytes.

  For sequential disk files, "bks" is rounded up to an integral
  number of 512-byte blocks and used to specify multiblock transfers.
  The number of blocks transferred can be 1 to 127; it is determined
  by RMS defaults.

  For indexed and relative files, "bks" is rounded up to an integral
  number of 512-byte blocks and used to specify the RMS bucket size.
  This must fall in the range 1 to 63 blocks.  The default is the
  smallest value capable of holding a single record.

6  –  BUFFERCOUNT

  Indicates the number of buffers to be associated with the logical
  unit for multibuffered I/O.  It takes the following form:

  BUFFERCOUNT = bc

  bc  Is a numeric expression.

  The range of values for "bc" is 1 to 127.

  If you do not specify BUFFERCOUNT or you specify 0, the process or
  system default is assumed.

7  –  BUFFERED

  Indicates run-time library behavior following WRITE operations.  It
  takes the following form:

  BUFFERED = bf

  bf   Is a character expression with one of the following
       values:

       'NO'   Requests that the run-time library send output
              data to the file system after each WRITE
              operation.

       'YES'  Requests that the run-time library accumulate
              output data in its internal buffer, possibly
              across several WRITE operations, before the data
              is sent to the file system.

              Buffering may improve run-time performance
              for output-intensive applications.

  The default is 'NO'.

  On OpenVMS, BUFFERED has no effect.  The operating system
  automatically performs buffering, which can be affected by the
  values of the BUFFERCOUNT and BUFFERSIZE keywords when the file is
  opened.

8  –  CARRIAGECONTROL

  Indicates the type of carriage control used when a file is
  displayed at a terminal.  It takes the following form:

  CARRIAGECONTROL = cc

  cc  Is a character expression with one of the following
      values:

  'FORTRAN'   Process with normal FORTRAN interpretation of
              the first character
  'LIST'      Process with single spacing between records
  'NONE'      Do not use implied carriage control

  The default for unformatted files is 'NONE'.  The default for
  formatted files is 'FORTRAN'.

9  –  CONVERT

  Indicates a nonnative numeric format for unformatted data.  It
  takes the following form:

  CONVERT = fm

  fm  Is a character expression with one of the following
      options:

     'LITTLE_ENDIAN'- Little endian integer data of the
                      appropriate size (INTEGER*1, INTEGER*2,
                      INTEGER*4, or INTEGER*8) and IEEE
                      floating-point data of the appropriate size
                      and type (REAL*4, REAL*8, REAL*16, COMPLEX*8,
                      COMPLEX*16, or COMPLEX*32).  INTEGER*1 data
                      is the same for little endian and big endian.

     'BIG_ENDIAN' -   Big endian integer data of the appropriate
                      size (INTEGER*1, INTEGER*2, INTEGER*4, or
                      INTEGER*8) and IEEE floating-point data of
                      the appropriate size and type (REAL*4, REAL*8,
                      REAL*16, COMPLEX*8, COMPLEX*16, or COMPLEX*32).
                      INTEGER*1 data is the same for little endian
                      and big endian.

     'CRAY' -         Big endian integer data of the appropriate
                      size (INTEGER*1, INTEGER*2, INTEGER*4, or
                      INTEGER*8) and CRAY floating-point data of
                      size REAL*8 or COMPLEX*16.

     'FDX' -          Little endian integer data of the appropriate
                      size (INTEGER*1, INTEGER*2, INTEGER*4, or
                      INTEGER*8) and HP VAX floating-point data
                      of format F_floating for REAL*4 or COMPLEX*8,
                      D_floating for size REAL*8 or COMPLEX*16, and
                      IEEE X_floating for REAL*16 or COMPLEX*32.

     'FGX' -          Little endian integer data of the appropriate
                      size (INTEGER*1, INTEGER*2, INTEGER*4, or
                      INTEGER*8) and HP VAX floating-point data
                      of format F_floating for REAL*4 or COMPLEX*8,
                      G_floating for size REAL*8 or COMPLEX*16, and
                      IEEE X_floating for REAL*16 or COMPLEX*32.

     'IBM' -          Big endian integer data of the appropriate
                      size (INTEGER*1, INTEGER*2, INTEGER*4, or
                      INTEGER*8) and IBM System\370 floating-point
                      data of size REAL*4 or COMPLEX*8 (IBM
                      short 4) and size REAL*8 or COMPLEX*16 (IBM
                      long 8).

     'VAXD' -         Little endian integer data of the appropriate
                      size (INTEGER*1, INTEGER*2, INTEGER*4, or
                      INTEGER*8) and HP VAX floating-point
                      data of format F_floating for size
                      REAL*4 or COMPLEX*8, D_floating for size
                      REAL*8 or COMPLEX*16, and H_floating for
                      REAL*16 or COMPLEX*32.

     'VAXG' -         Little endian integer data of the appropriate
                      size (INTEGER*1, INTEGER*2, INTEGER*4, or
                      INTEGER*8) and HP VAX floating-point
                      data of format F_floating for size
                      REAL*4 or COMPLEX*8, G_floating for size
                      REAL*8 or COMPLEX*16, and H_floating for
                      REAL*16 or COMPLEX*32.

     'NATIVE' -       No data conversion.  This is the default.

  You can use CONVERT to specify multiple formats in a single
  program, usually one format for each specified unit number.

  When reading a non-native format, the non-native format on disk is
  converted to native format in memory.  If a converted non-native
  value is outside the range of the native data type, a run-time
  message appears.

  There are other ways to specify numeric format for unformatted
  files:  you can specify an OpenVMS logical name or the compiler
  option /CONVERT (or OPTIONS/CONVERT).  The order of precedence is
  OpenVMS logical name, OPEN (CONVERT=), OPTIONS/CONVERT, and then
  compiler option /CONVERT.  The /CONVERT compiler option and
  OPTIONS/CONVERT affect all unit numbers used by the program, while
  logical names and OPEN (CONVERT=) affect specific unit numbers.

  The following source code shows how to code the OPEN statement to
  read unformatted CRAY numeric data from unit 15, which might be
  processed and possibly written in little endian format to unit 20:

     OPEN (CONVERT='CRAY', FILE='graph3.dat', FORM='UNFORMATTED',
    1     UNIT=15)
     ...
     OPEN (FILE='graph3_native.dat', FORM='UNFORMATTED', UNIT=20)

10  –  DEFAULTFILE

  Indicates a default file specification string.  It takes the
  following form:

  DEFAULTFILE = ce

  ce  Is a character expression.

  This specifier supplies a value to the RMS default file
  specification string for the missing components of a file
  specification.  If you do not specify the DEFAULTFILE keyword,
  Fortran uses the default value 'FORnnn.DAT', where nnn is the unit
  number with leading zeros.

  The default file pathname string is used primarily when accepting
  file specifications interactively.  File specifications known to a
  user program are normally completely specified in the FILE keyword.

  You can specify default values for any one of the following file
  specification components:  node, device, directory, file name, file
  type, and file version number.

  When you specify any of the above components in the FILE keyword,
  they override those values specified in the DEFAULTFILE keyword.

  The following example uses the file name supplied by the user and
  the default file specification supplied by the DEFAULTFILE keyword
  to define the file specification for an existing file:

     TYPE *, 'ENTER NAME OF DOCUMENT'
     ACCEPT *, DOC
     OPEN (UNIT=1, FILE=DOC, DEFAULTFILE='[ARCHIVE].TXT',
    1     STATUS='OLD')

11  –  DELIM

  Indicates what characters (if any) are used to delimit character
  constants in list-directed and namelist output.  It takes the
  following form:

  DELIM = del

  del  Is a character expression with one of the
       following values:

  'APOSTROPHE'  Indicates that apostrophes delimit character
                constants. All internal apostrophes are doubled.

  'QUOTE'       Indicates that quotation marks delimit character
                constants.  All internal quotation marks are doubled.

  'NONE'        Indicates that character constants have no
                delimiters.  No internal apostrophes or quotation
                marks are doubled. This is the default.

  DELIM is only allowed for files connected for formatted data
  transfer; it is ignored during input.

12  –  DISPOSE

  Indicates the status of the file after the unit is closed.  It
  takes one of the following forms:

  DISP = dis
  DISPOSE = dis

  dis  Is a character expression with one of the following
       values:

  'KEEP' or 'SAVE'  Retain the file after the unit is closed.
                    (*DEFAULT FOR ALL BUT SCRATCH FILES*)

  'DELETE'          Delete the file after the unit is closed.
                    (*DEFAULT FOR SCRATCH FILES*)

  'PRINT'           Submit the file as a print job and retain it.
                    Use this value only with sequential files.

  'PRINT/DELETE'    Submit the file as a print job and then
                    delete it.  Use this value only with sequential
                    files.

  'SUBMIT'          Submit the file as a batch job and retain it.

  'SUBMIT/DELETE'   Submit the file as a batch job and then
                    delete it.

  The disposition specified in a CLOSE statement supersedes the
  disposition specified in the OPEN statement, except that a file
  opened as a scratch file cannot be saved, printed, or submitted,
  nor can a file opened for read-only access be deleted.

13  –  ERR

  Identifies a branch target statement that receives control if an
  error occurs.  It takes the following form:

  ERR = s

  s  Is the label of an executable statement

  ERR applies only to the OPEN statement in which it is specified,
  and not in subsequent I/O operations on the unit.  If an error
  occurs, no file is opened or created.  However, you can use IOSTAT
  in subsequent I/O statements to perform a similar function.

14  –  EXTENDSIZE

  Indicates the number of blocks by which to extend a disk file
  (extent) when additional storage space is needed.  It takes the
  following form:

  EXTENDSIZE = e

     e  Is a numeric expression.

  The space used to extend a file is contiguous if possible.
  Otherwise, noncontiguous space is used.  The default is the system
  default for the device.

15  –  FILE

  Indicates the name of the file to be connected to the unit.  It
  takes the following form:

  FILE = name

  name   Is a character or numeric expression.

  The "name" can be any pathname (or specification) allowed by the
  operating system.  (See the appropriate manual in the OpenVMS
  operating system documentation set.)

  Any trailing blanks in the name are ignored.

  If the following conditions occur:

   o  FILE is omitted

   o  The unit is not connected to a file

   o  STATUS='SCRATCH' is not specified

  then VSI 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.

16  –  FORM

  Indicates whether the file is being connected for formatted,
  unformatted, or binary data transfer.  It takes the following form:

  FORM = ft

  ft  Is a character expression with one of the following
      values:

    'FORMATTED'         Formatted *DEFAULT FOR SEQUENTIAL ACCESS*
    'UNFORMATTED'       Unformatted *DEFAULT FOR KEYED
                          AND DIRECT ACCESS*
    'BINARY'            Binary

17  –  INITIALSIZE

  Indicates the number of blocks in the initial storage allocation
  (extent) for a disk file.  It takes the following form:

  INITIALSIZE = e

     e  Is a numeric expression.

  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.  If not enough contiguous space
  is available, noncontiguous space is allocated.

18  –  IOSTAT

  Designates a variable to store a value indicating the status of a
  data transfer operation.  It takes the following form:

  IOSTAT = ios

  ios   Is a scalar default integer variable.

  If no error exists, "ios" is defined as zero.  If an error exists,
  "ios" is defined as a positive integer.

  IOSTAT applies only to the OPEN statement in which it appears and
  not to subsequent I/O operations on the logical unit that is
  opened.  However, you can use the IOSTAT parameter in subsequent
  I/O statements to perform a similar function.

  Secondary operating system messages do not display when IOSTAT is
  specified.  To display these messages, remove IOSTAT or use a
  platform-specific method such as a VMS condition handler.  (For
  more information, see the HP Fortran for OpenVMS User Manual.)

19  –  KEY

  Defines the access keys for records in an indexed file.  It takes
  the following form:

  KEY = (kspec[,kspec]...)

  kspec   Takes the following form:

          e1:e2[:dt[:dr]]

          e1   Is the position of the first byte of the
               key in the record.
          e2   Is the position of the last byte of the
               key in the record.
          dt   Is the data type of the key: CHARACTER (*DEFAULT*)
               or INTEGER.
          dr   Is the direction of the key: ASCENDING (*DEFAULT*)
               or DESCENDING.

  The length of the key must not exceed 255 bytes.  The first byte
  position of the key must be at least 1 and the last byte position
  must not exceed the length of the record.

  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 it from another language or with the File Definition
  Language (FDL).

  Specifying and Referencing Keys:

  You must specify the KEY parameter 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 parameter 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.

20  –  MAXREC

  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:

  MAXREC = mr

  mr  Is an numeric expression.

  The default is the maximum allowed (2**32-1).

21  –  NAME

  NAME is a nonstandard synonym for FILE.  (See OPEN FILE.)

22  –  NOSPANBLOCKS

  NOSPANBLOCKS

  Specifies that records are not to cross disk block boundaries.  If
  a record exceeds the size of a physical block, an error occurs.

23  –  ORGANIZATION

  Indicates the internal organization of the file.  It takes the
  following form:

  ORGANIZATION = org

  org  Is a character expression with one of the following
       values:

  'SEQUENTIAL'          Records are stored in the order that
                        they are written. Access mode must be
                        sequential, append, or direct (fixed-length
                        records only). (*DEFAULT FOR NEW FILES*)

  'RELATIVE'            Records are stored in numbered positions.
                        Access mode must be direct or sequential.

  'INDEXED'             Records are stored according to the values
                        of their keys. Access mode must be indexed
                        or sequential.

  The default for an existing file is its current organization.

24  –  PAD

  Indicates whether a formatted input record is padded with blanks
  when an input list and format specification requires more data than
  the record contains.  It takes the following form:

  PAD = pd

  pd   Is a character expression with one of the
       following values:

  'YES'  Indicates the record will be padded with blanks
         when necessary (the default).

  '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.

  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 will
  turn the I5 into an I3 and J will be assigned 123.

  However, VSI 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.

25  –  POSITION

  Indicates the position of a file connected for sequential access.
  It takes the following form:

  POSITION = pos

  pos   Is a character expression with 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.
           This is the default.

  '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).)

  A new file (whether specified as new explicitly or by default) is
  always positioned at its initial point.

26  –  READONLY

  READONLY

  Prohibits WRITE access to the file.  Enables users with READ access
  to access the file.

  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.

27  –  RECL

  Indicates the length of logical records in a file connected for
  direct or keyed access, or the maximum length of a record in a file
  connected for sequential access.  It takes the following form:

  RECL = rl

  rl  Is an numeric expression.  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:

   o  For segmented records, RECL indicates the maximum length for
      any segment (not including the two segment control bytes).

   o  For fixed-length records, RECL indicates the size of each
      record.

   o  For variable-length or stream records, RECL specifies the size
      of the buffer that will be allocated to hold records read or
      written.  Specifying RECL for stream records (STREAM, STREAMCR
      or STREAMLF) is required if the longest record length in the
      file exceeds the default RECL value.

  Errors occur under the following conditions:

   o  If your program attempts to write to an existing file a record
      that is longer than the logical record length

   o  If you are opening an existing file that contains fixed-length
      records or has relative organization and you specify a value
      for RECL that is different from the actual length of the
      records in the file

  The following table lists the maximum values that can be specified
  for "rl" for disk files that use the fixed-length record format:

    Sequential formatted               32767 bytes
    Sequential unformatted              8191 longwords
    Relative formatted                 32255 bytes
    Relative unformatted                8063 longwords
    Indexed formatted                  32224 bytes
    Indexed unformatted                 8056 longwords
    Tape formatted                      9999 bytes
    Tape unformatted                    2499 longwords

  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 when one or more of the following
  conditions exists:

   o  The file is opened for direct access (ACCESS='DIRECT').

   o  The record format is fixed length (RECORDTYPE='FIXED').

   o  The file organization is relative or indexed
      (ORGANIZATION='RELATIVE' or 'INDEXED').

  The default value depends on the setting of the RECORDTYPE
  specifier, as follows:

  RECORDTYPE value    RECL value
  ----------------    -----------------------------------------

  'FIXED'             None; value must be explicitly specified.
  All other types     133 bytes (for formatted records)
                      511 longwords (for unformatted records)

28  –  RECORDSIZE

  RECORDSIZE is the nonstandard synonym for RECL (see OPEN RECL).

29  –  RECORDTYPE

  Indicates the type of records in a file.  It takes the following
  form:

  RECORDTYPE = typ

  typ  Is a character expression with one of the following
       values:

  'FIXED'      All records are one size. Short records are padded
               with blanks (formatted files) or zeros (unformatted
               files).
  'VARIABLE'   Records can vary in length.
  'SEGMENTED'  A record consists of one or more variable length
               records which may exist in different physical blocks.
               Valid only for unformatted, sequential files with
               sequential access.
  'STREAM'     Data is not grouped into records and contains no
               control information.
  'STREAM_CR'  Variable-length records whose length is indicated by
               carriage-returns embedded in the data.
  'STREAM_LF'  Variable-length records whose length is indicated by
               line-feeds (new lines) embedded in the data.

  When you open a file, default record types are as follows:

  +-------------------------------------+---------------------+
  | File Type                           | Default Record Type |
  +-------------------------------------+---------------------+
  | Relative or indexed files           | 'FIXED'             |
  | Direct access sequential files      | 'FIXED'             |
  | Formatted sequential access files   | 'VARIABLE'          |
  | Unformatted sequential access files | 'SEGMENTED'         |
  +-------------------------------------+---------------------+

  A segmented record is a logical record consisting of one or more
  variable-length records (segments).  The logical record can span
  several physical records.  Only unformatted sequential-access files
  with sequential organization can have segmented records;
  'SEGMENTED' must not be specified for any other file type.

  Files containing segmented records can be accessed only by
  unformatted sequential data transfer statements.  You cannot use an
  unformatted READ statement to access such a file, unless you
  specify RECORDTYPE='SEGMENTED' in the OPEN statement.

  Normally, if you do not use the RECORDTYPE specifier when you are
  accessing an existing file, the record type of the file is used.
  However, if the file is an unformatted sequential-access file with
  sequential organization and variable-length records, the default
  record type is 'SEGMENTED'.

  If you use the RECORDTYPE specifier when you are accessing an
  existing file, the type that you specify must match the type of the
  existing file.

  If an output statement does not specify a full record for a file
  containing fixed-length records, the following occurs:

   o  In formatted files, the record is filled with blanks

   o  In unformatted files, the record is filled with zeros

30  –  SHARED

  SHARED

  Specifies that the file can be accessed by more than one user at
  the same time.

  For more information on file sharing, see the HP Fortran for
  OpenVMS User Manual.

31  –  STATUS

  Indicates the status of a file when it is opened.  It takes the
  following form:

  STATUS = sta

  sta  Is a character expression with one of the following
       values:

  'OLD'       Open an existing file.

  'NEW'       Create a new file; if the file already exists an
              error occurs.

  'SCRATCH'   Create a new file and delete it when the file is
              closed.

  'REPLACE'   Replace the file with another. If the file to be
              replaced exists, it is deleted and a new file is
              created with the same name.  If the file to be replaced
              does not exist, a new file is created and its status
              changes to 'OLD'.

  'UNKNOWN'   Open the file as OLD; if it does not exist, then
              open the file as NEW.

  The default is 'UNKNOWN'.  However, if you implicitly open a file
  using WRITE or you specify compiler option /NOF77 (or OPTIONS
  /NOF77), the default value is 'NEW'.  If you implicitly open a file
  using READ, the default is 'OLD'.

  Scratch files (STATUS='SCRATCH') are created on the user's default
  disk (SYS$DISK) and are not placed in a directory or given a name
  that is externally visible.  To indicate a different device, use
  the FILE specifier.

                                 NOTE

          The  STATUS  parameter  is  also  used   in   CLOSE
          statements  to  specify  the status of a file after
          the file is closed.  However, in  CLOSE  statements
          the  STATUS values are the same as those listed for
          the DISPOSE specifier (see OPEN DISPOSE).

32  –  TYPE

  TYPE is a nonstandard synonym for STATUS (see OPEN STATUS).

33  –  UNIT

  Indicates the logical unit to which a file is to be connected.  It
  takes the following form:

  [UNIT=] u

  u  Is a numeric expression

  The unit specification must appear in the parameter list, unless
  the unit specifier is the first element in the list.

  The logical unit may already be connected to a file when an OPEN
  statement is executed.  If this file is not the same as the one to
  be opened, the OPEN statement executes as if a CLOSE statement had
  executed just before it.

  If the file to be opened is already connected to the unit or if the
  file specifier (FILE keyword) is not included in the OPEN
  statement, only the blank specifier (BLANK keyword) can have a
  value different from the one currently in effect.  The position of
  the file is unaffected.

34  –  USEROPEN

  Indicates a user-written external function that controls the
  opening of the file.  It takes the following form:

  USEROPEN = func

  func  Is the symbolic name of the USEROPEN function.

  The function must be declared in a previous EXTERNAL statement; if
  it is typed, it must be INTEGER*4.
Close Help