Note: This overlapps with [feature-requests:#70] and therefore should be implemented with a configuration option - the same picture could either define a floating-point edited item for output-only (tracked in this ticket) or an item for actual calculations (tracked in the other ticket with different rules) - or be invalid, depending on the configuration used.
Quoting from 20xx draft, PICTURE
clause:
To produce a floating-point edited result, characters-string-1 shall consist of two parts, separated without
any spaces, by the symbol 'E'. The first part represents the significand; the second part represents the
exponent.
The significand shall be a valid character-string for either a numeric item or a numeric-edited item for a
fixed-point result. Neither floating insertion editing nor zero suppression with replacement shall be
specified for the significand.
The exponent shall be ‘+9’, ‘+99’, ‘+999’, ‘+9999’, or ‘+9(n)’ where n = 1, 2, 3, or 4.
COBOL 2002 has maximum size of 31/3, COBOL 2014 34/4 (but I'd just use the full maximum length).
I'm assigning this to Edward for a future point in time (opt-out is possible as always ;-)
If possible it would be nice to have the parsing in tree.c cb_build_picture()
in before the actual implementation (maybe even 2.2?) which needs more time (change in multiple places) and tests. This way we won't raise
error: invalid picture string - '+z(2)9.9(28)E+9(03)'
any more but something like
error: floating-point edited items not implemented
As a side effect the declaration of external floating-point items would raise the same error message, instead of
error: invalid picture string - +9(1).9(15)E+99'
Discussion: PICTURE clause: Exponent symbol not supported?
Wish List: #70
Related: [feature-requests:#71] to set and check floating-point values and [feature-requests:#70] for a common similar extension.
Related
Wish List: #70
Wish List: #71