Menu

#199 Add 2002 floating-point edited items PIC +z(2)9.9(28)E+9(03)

unclassified
accepted
nobody
4
2024-08-05
2017-04-27
No

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, PICTUREclause:

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'

Related

Discussion: PICTURE clause: Exponent symbol not supported?
Wish List: #70

Discussion

  • Simon Sobisch

    Simon Sobisch - 2021-02-02
    • assigned_to: Edward Hart --> nobody
     

Log in to post a comment.