Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

DT Edit Descriptor in User-Defined I/O

The DT edit descriptor passes a character string and integer array to a defined I/O procedure. It takes the following form:

DT [string] [(v-list)]

The string is a default character literal constant delimited by single quotes (' ') or double quotes (" "); no kind parameter can be specified. Its length is the number of characters between the delimiters; two consecutive delimiters are counted as one character. If string is not specified, a character string of length zero is passed.

The v-list is a list of one or more signed or unsigned integer literal constants; no kind parameter can be specified. If v-list is not specified, an integer array of length zero is passed.

A DT edit descriptor must correspond to a list item of a derived type. Also, there should be an accessible interface to a corresponding defined FORMATTED I/O procedure for that derived type.

In a format statement, if the last closing parenthesis of the format string is reached and there are no effective items left, then format processing terminates. But, if there are more items to be processed, then format control reverts to the beginning of the format item which was terminated by the next-to-last right parenthesis.

If there is no such preceding right parenthesis, it reverts to the first left parenthesis of the format specification. During this format reversion, the right parenthesis that is part of a DT edit descriptor is not considered as the next-to-last parenthesis. For example, consider the following:

write (10, '(F10.3, I5, DT "sample" (1, 2) )' ) 10.1, 3, obj1, 4.7, 1, obj2

In the above case, format control reverts to the left parenthesis before F10.3 and not to DT.

Examples

The following are valid ways to specify the DT edit descriptor:

DT
DT "z8, i4, e10.2"
DT (1, -1, +1000)
DT 'spec1 type' (0)