https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126821

--- Comment #3 from Robert Dubner <rdubner at gcc dot gnu.org> ---
As long as we are making disclosures, I will toss in a confession of my own: 
Before I was engaged to work on this project, I had never written, or even
read, a single line of COBOL.

You are painting a clear picture of what you have learned, and what you have
gleaned from it.  

(I can make an argument that both you and I are in the position of trying to
learn to pilot a plane by reading the Aircraft Flight Manual.  That document is
prepared by the manufacturer, and is approved by the government, and would
nonetheless rapidly result in catastophe.  But absent access to an Enterprise
COBOL, all we can do is count angels on the head of this pin.)

Based on IBM's documentation, you make a compelling argument that for "PIC
99PPP VALUE 12000" I should simply DISPLAY "12".  (Some additional research on
my part tends to agree with the "12" conclusion.)

For "PIC S99PPP VALUE -12000" I should DISPLAY "1r" in ASCII and "1K" in
EBCDIC.

Even more troubling:  A strict reading of IBM (6.5 LR page 340) suggests that
the same is true for "PIC S99999 VALUE -12000".  A DISPLAY of that value should
appear as "1200}" in EBCDIC, and analogously in ASCII: "1200p".  That's with
IBM's DISPSIGN(COMPAT) in effect.  With DISPSIGN(SEP) specified, they become
-12 and -12000.

Based on all this, and pending discussion with Jim Lowden, I am coming to a
conclusion that I am going to make it "12" when "-dialect ibm" is in effect. 
As for negative values:  I will display "-12", since we will default to
DISPSIGN(SEP) until such time as we implement DISPSIGN(COMPAT).

One wonders what, exactly "COMPAT" is compatible with.  That feature causes "an
overpunch" in the low-order digit position.  I don't know about you, but I
think the last time I laid eyes on a card punch output device was around 1975.

Reply via email to