To: J3 J3/25-200 From: Van Snyder Subject: Specifications for US09 -- allow I/O of enumeration type names Date: 2025-October-26 Reference: 23-151, 23-151r1, 25-007r1 History ======= 23-151 advocated to use "A" formatting for input and output of enumerator names, "I" formatting for input and output of enumeration-type values using their ordinal positions, and their names for list-directed input and output. 23-151r1 advocated to use "G" formatting. "G" format editing for enumeration-type objects might be considered to introduce a conflict. Without a specification, perhaps as a changeable mode, to use enumerator names, one might reasonable belive that "G" formatting would use the enumerator's ordinal value. 13.7.5 "Generalized editing" doesn't mention enumeration-type objects, for which editing is described in 13.7.2.2 Integer editing, which also specifies "The G, B, O, and Z edit descriptors may also be used to edit integer data." "G" editing could be used without a problem for input -- if the first character is a digit, it's the ordinal value; otherwise it's the name -- but it would remain ambiguous for output. Specifications are provided for using a combination of both methods. Specifications ============== s1. When an object of enumeration type is input or output by Explicit format specification methods (13.2): s1a. If the corresponding format item specifies character editing (13.7.4) its name is used; s1b. If the corresponding format item specifies integer editing (13.7.2.2) using I, O, Z, or B edit descriptors, its ordinal value (7.6.2) is used. s1c. If the format item corresponding to the next effective input item specifies generalized editing (13.7.5) and the first character of the next input value is a digit, integer editing is used; otherwise character editing is used. s1d. If the format item corresponding to the next effective output item specifies generalized editing, whether character or integer editing is used is specified by the ENUMERATION (spelling TBD) changeable mode. s2. A changeable mode (12.5.2) shall determine whether generalized output editing uses enumerators' names or ordinal values. Spellings of the mode name and values are TBD. If the mode is NAME, generalized output editing shall use the enumerator's name. If the mode is ORDINAL, generalized output editing shall use the enumerator's ordinal value. If the mode is DEFAULT, whether generalized output editing uses character or integer editing is processor dependent. {Changeable modes can be specified by an OPEN statement or format item, and inquired by an INQUIRE statement. The format item might be EN (without w.d or w.dEe) for NAME, EO for ORDINAL, or ED for default.} s3. List-directed (13.10) and namelist (13.11) editing shall use generalized editing for objects of enumeration type. If the first character of an input value is not a digit, or the first character after the asterisk in the r*c form, if any, is not a digit, the item is edited according to the rules for character editing. See s2 for output. s4. C8109, which already pointlessly prohibits a from being of enumeration type, or having a component of enumeration type, shall be removed. {13.10 List-directed formatting is silent about objects of enumeration type.} s5. During character editing of enumeration-type input items, if the next input value is not the name of an enumerator of the type of the next effective list item or the corresponding namelist group object, an error condition exists. s6. A changeable mode shall determine whether generalized output editing of enumerator names, the "E" or "D" in real values, variable names in namelist output, and component names in namelist output, use upper case, lower case, or a processor-dependent default. s7. A changeable mode shall determine whether namelist output of structures produces component names.