[Bug cobol/126821] [cobol] DISPLAY of a P-scaled item renders the scaling positions as digits

"rdubner at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126821

Robert Dubner <rdubner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rdubner at gcc dot gnu.org

--- Comment #1 from Robert Dubner <rdubner at gcc dot gnu.org> ---
I see that you found that I (I'll use "me" as a shortcut for "gcobol") am
storing, moving, and using P-scaled variables properly.

So, it became a question of what to do for DISPLAY.

I am not aware of solid documentation about DISPLAY.

So, in general, I operate from the principal of "make it human readable".

Consider a PIC S99V99.  In an ASCII implementation, MOVE -12.34 to PIC S99V99
results in four bytes in memory: "123t".  But in a gcobol compilation,
DISPLAYING that value produces the output "-12.34".

So, I do the same kind of thing for a PIC 999PPP.  After a MOVE 123000 to that
value, the image in memory is "123".  The result of a DISPLAY is "123000".

It is true for both variables, when they are part of a group, that displaying
the group shows the actual underlying character storage.

But I chose to display the S99V99 as "-12.34", even though the minus sign and
the decimal point are not part of the storage.  And I chose to display "999PPP"
as "123000", even though the zeroes are not part of the storage.

Is this a problem?  If it doesn't match historical IBM behavior, we could make
it part of the "-fdialect ibm" option.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.