# Defined I/O Data Transfers

The following rules apply to defined I/O data transfers:

- During execution of a defined I/O procedure, there must be no I/O for an external unit except for the unit argument. However, I/O is permitted for internal files.

- You cannot use user-defined I/O in combination with asynchronous I/O.

- No file-positioning commands are permitted in the defined I/O procedure. OPEN, CLOSE, BACKSPACE, ENDFILE, and REWIND statements will not be executed. Any ADVANCE= specifier in a child statement is ignored.

- A record positioning edit descriptor, such as TL and TR, used on the unit by a child data transfer statement will not cause the record position to be positioned before the record position at the time the defined I/O procedure was invoked.

- A child data transfer statement must not specify the ID=, POS=, or REC= specifier in an I/O control list.

- The file position on entry is treated as a left tab limit and there is no record termination on return. However, a child statement with slash (/) edit descriptor, or explicit record termination by a list-directed child I/O, is allowed.

- If the unit is associated with an external file (for example, non-negative, or equal to one of the constants ERROR_UNIT, INPUT_UNIT, or OUTPUT_UNIT from the intrinsic module ISO_FORTRAN_ENV), the current settings for the pad mode, sign mode, etc., can be discovered by using INQUIRE with PAD=, SIGN=, etc. on the unit argument.

  Note that INQUIRE must not be used if the unit is an internal unit passed to a user-defined derived-type I/O procedure from a parent I/O statement. When an internal unit is used with the INQUIRE statement, an error condition will occur, and the variable specified in an IOSTAT= specifier in the INQUIRE statement will be assigned the value IOSTAT_INQUIRE_INTERNAL_UNIT from the intrinsic module ISO_FORTRAN_ENV.

Parent topic: Specify the User-Defined Derived Type

## See Also

ISO_FORTRAN_ENV Module
User-Defined Derived-Type I/O