To: J3 J3/18-120r2 From: Steve Lionel Subject: Control of leading zero in F and E format Date: 2018-February-13 Reference: 18-007 When using F format to output a value less than 1, the standard allows the implementation to choose whether to include a zero before the decimal symbol. 13.7.2.3.2 (F format) paragraph 11 says (in part): "Leading zeros are not permitted except for an optional zero immediately to the left of the decimal symbol if the magnitude of the value in the output field is less than one. The optional zero shall appear if there would otherwise be no digits in the output field." Similarly for E format, when the scale factor is zero, 13.7.2.3.2p11 says: "Leading zeros are not permitted except for an optional zero immediately to the left of the decimal symbol if the magnitude of the value in the output field is less than one. The optional zero shall appear if there would otherwise be no digits in the output field." EN, ES and EX formats do not have this option. Some implementations always provide the leading zeros, some do not, and this inconsistency results in user complaints, especially when test programs produce different results across different implementations. The inconsistency also occurs for G format when the value is in a certain range, since E and F formatting is used. Unlike the optional sign before a positive value, there is no user control over the optional zero. The proposal is to add control edit descriptors, analogous to the SS, SP and S edit descriptors, allowing the programmer to specify the desired behavior. Proposed: ZN - No leading zero ZS - Supply leading zero ZP - Processor-defined behavior The requirement of the leading zero when otherwise no digits would appear is to remain. Continuing the analogy with SS, SP and S, and the SIGN= OPEN/INQUIRE specifier, a ZERO= OPEN and INQUIRE specifier would be added with possible values of 'NO', 'SUPPLY', and 'PROCESSOR_DEFINED'. The default would be 'PROCESSOR_DEFINED'.