[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[open-cobol-list] displaying max values in comp-5 field

From: vince coen
Subject: [open-cobol-list] displaying max values in comp-5 field
Date: Sun, 26 Jul 2009 12:05:09 +0100
User-agent: KMail/1.9.6


On Saturday 25 July 2009, Robert Keane wrote:
> Hello All,
> I've found a problem when displaying the maximum value in a comp-5 field.
> If an s9(4) comp-5 can hold +32767 or -32768. After initializing or moving
> +32767 or -32768 to the s9(4) comp-5 field the display gives +2767 or
> -2768, the high order digit is dropped. However if the comp-5 field is
> moved to a field defined with enough z's the display is ok.

A dropped leading digit does not supprise me.  Moving above 9,999 to a pic s9
(4) will result in truncation. Solution is to increase picture size to 
reflect the maximum value your field will get to in this case pic s9(5) 

Or better still use binary-short, its more effective for arithmetic etc in OC.


> Bob Keane

reply via email to

[Prev in Thread] Current Thread [Next in Thread]