Developer Guide and Reference

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

Nested and Group Repeat Specifications

Format specifications can include nested format specifications enclosed in parentheses; for example:

15   FORMAT (E7.2,I8,I2,(A5,I6))
35   FORMAT (A6,(L8(3I2)),A)

A group repeat specification can precede a nested group of edit descriptors; it can be an unsigned integer literal constant, a variable format expression, or * to indicate an unlimited repeat count. For example, the following statements are equivalent, and the second statement shows a group repeat specification:

50   FORMAT (I8,I8,F8.3,E15.7,F8.3,E15.7,F8.3,E15.7,I5,I5)
50   FORMAT (2I8,3(F8.3,E15.7),2I5)

If a nested group does not show a repeat count, a default count of 1 is assumed.

Normally, the string edit descriptors and control edit descriptors cannot be repeated (except for slash), but any of these descriptors can be enclosed in parentheses and preceded by a group repeat specification. For example, the following statements are valid:

76   FORMAT ('MONTHLY',3('TOTAL'))
100  FORMAT (I8,4(T7),A4)

Each of the following can be used to read data at the end of an input record into N elements of array A:

    read (10,'(<N>F8.2)') A(1:N)  ! Variable format expression
    read(10,'(*(F8.2))') A(1:N)   ! Unlimited repeat count

See Also