J3/00-287r2 Date: 20 Sep 2000 To: J3 From: Dan Nagle Subject: Passing IO Mode to DTIO routines (Unresolved Issue #30) The interaction of user specified DTIO routines and the modes specified in format control and in I/O control lists is leftover business from 153. This paper addresses this issue. Briefly, an intrinsic derived type is defined in the ISO_FORTRAN_ENV module. An argument of this type is passed to the user specified DTIO routines. The INTRINSIC derived type is named ISO_IO_MODE. The derived type specifies the current state of the following modes: BLANK, DECIMAL, PAD, ROUND, SCALE, and SIGN. Edits: 190:30+ io_mode, & 190:31+ USE, INTRINSIC :: ISO_FORTRAN_ENV 190: 37+ TYPE( ISO_IO_MODE), OPTIONAL, INTENT( IN) :: io_mode 191:7+ io_mode, & 191:8+ USE, INTRINSIC :: ISO_FORTRAN_ENV 191: 14+ TYPE( ISO_IO_MODE), OPTIONAL, INTENT( IN) :: io_mode 192:27+ add paragraph The processor shall provide the current values of the input/output modes in the argument io_mode (13.17.2.3). 194:7+ add to Note INQUIRE returns the state of the input/output modes as established by the most recently executed OPEN statement for this unit, or the default state for the modes if no OPEN has been executed for the unit. The current state of each input/output mode is represented by the value of the corresponding component of io_mode (13.17.2.3). 198:3 replace "executed." with "executed, unless the INQUIRE statement specifies a unit number that is the same unit specified in a currently executing data transfer statement, in which case, it returns values in effect prior to the initiation of that data transfer statement. 339:33 replace "values." with "values and public named derived types defined by the standard." 340:22+ 13.17.2.3 Input/output mode type Variables of this derived type are used to pass the current input/output mode to user-defined derived-type input/output procedures (9.5.4.4.3). TYPE :: ISO_IO_MODE INTEGER :: SCALE ! scale factor CHARACTER( LEN= 2) :: BLANK ! "BN" | "BZ" CHARACTER( LEN= 2) :: DECIMAL ! "DC" | "DP" CHARACTER( LEN= 2) :: ROUND ! "RU" | "RD" | "RZ" | "RN" | "RP" | "RC" CHARACTER( LEN= 2) :: SIGN ! "SP" | "SS" CHARACTER( LEN= 3) :: PAD ! "YES" | "NO" END TYPE ISO_IO_MODE When passed to a child data transfer procedure by the processor: -The SCALE component indicates the scale factor currently in effect. -The BLANK component indicates the blank interpretation mode currently in effect. It has the value BN to indicate NULL and BZ to indicate ZERO. -The DECIMAL component indicates the decimal mode currently in effect. It has the value DC to indicate COMMA and DP to indicate POINT. -The ROUND component indicates the rounding mode currently in effect. It has the value RU to indicate UP, RD to indicate DOWN, RZ to indicate ZERO, RN to indicate NEAREST, RP to indicate PROCESSOR_DEPENDENT, and RC to indicate COMPATIBLE. -The SIGN component indicates the sign mode currently in effect. It has the value SP to indicate printing plus signs and SS to indicate suppressing plus signs. -The PAD component indicates the pad mode currently in effect. It has the value YES to indicate padding is performed and NO to indicate padding is not performed.