Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Characteristics of Defined I/O Procedures

Shown below are the four interfaces that specify the characteristics of the user-defined I/O procedures. The actual specific procedure names and the names of the dummy arguments in these interfaces are arbitrary.

The following names are used in the interfaces:

dtv-type-spec

Is one of the following:

  • TYPE(d-name) for a sequence or BIND(C) type

  • CLASS(d-name) for an extensible type

d-name is the name of the derived type. It cannot be an abstract type. All length type parameters of the derived type must be assumed.

var

Is a scalar of the derived type. For output, it holds the value to be written. For input, it will be altered in accordance with the values read.

unit

Is the scalar integer value of the I/O unit on which input or output is taking place. It is a negative number for an internal file or for an external unit that is a NEWUNIT value. It is a processor-dependent number (which may be negative) for the '*' unit.

iotype

Is the value 'LISTDIRECTED', 'NAMELIST', or 'DT'//string, where string is the character string from the DT edit descriptor.

vlist

Is a rank-one assumed-shape integer array whose value comes from the parenthetical list of integers from the DT edit descriptor. For list-directed formatting and namelist formatting, vlist is a zero-sized integer array.

iostat

Is a scalar integer variable that must be given a positive value if an error condition occurs. If an end-of-file or end-of-record condition occurs, it must be given the value IOSTAT_END or IOSTAT_EOR (from the intrinsic module ISO_FORTRAN_ENV). In all other cases, it must be given the value zero.

iomsg

Is an assumed-length scalar character variable that must be set to an explanatory message if iostat is given a nonzero value. Otherwise, it must not be altered.

The following interfaces specify the characteristics of the user-defined I/O procedures:

SUBROUTINE my_read_formatted (var,unit,iotype,vlist,iostat,iomsg)
dtv-type-spec,INTENT(INOUT) :: var
INTEGER,INTENT(IN) :: unit
CHARACTER(*),INTENT(IN) :: iotype
INTEGER,INTENT(IN) :: vlist(:)
INTEGER,INTENT(OUT) :: iostat
CHARACTER(*),INTENT(INOUT) :: iomsg
END 

SUBROUTINE my_read_unformatted (var,unit,iostat,iomsg)
dtv-type-spec,INTENT(INOUT) :: var
INTEGER,INTENT(IN) :: unit
INTEGER,INTENT(OUT) :: iostat
CHARACTER(*),INTENT(INOUT) :: iomsg
END 

SUBROUTINE my_write_formatted (var,unit,iotype,vlist,iostat,iomsg)
dtv-type-spec,INTENT(IN) :: var
INTEGER,INTENT(IN) :: unit
CHARACTER(*),INTENT(IN) :: iotype
INTEGER,INTENT(IN) :: vlist(:)
INTEGER,INTENT(OUT) :: iostat
CHARACTER(*),INTENT(INOUT) :: iomsg
END 

SUBROUTINE my_write_unformatted (var,unit,iostat,iomsg)
dtv-type-spec,INTENT(IN) :: var
INTEGER,INTENT(IN) :: unit
INTEGER,INTENT(OUT) :: iostat
CHARACTER(*),INTENT(INOUT) :: iomsg
END