COBOL allows definitions of decimal numeric fields to be signed or unsigned packed decimal or external decimal (as well as other other formats).

I believe it had always generated Compared Packed hardware instructions to compare signed decimal fields, ensuring that negative and positive were properly collated.  But this is relatively slow.

For speed more recent compilers could generate the faster CLC instructions for unsigned decimal fields.  However problems arise when the data in the unsigned field came from an external source and unsigned fields did not consistently use the C or the F nybble for the sign.

One practical effect of the F-zone or C-zone in a signed number is the COBOL DISPLAY command, which uses the hardware Unpack instruction to convert the number to EBCDIC but does not interpret the sign.  The last digit displayed will be numeric if an F-zone, but alphabetic if a C-zone.  For other zones, it could be alphabetic or weird.


On 2025-04-29 12:00 a.m., IBM-MAIN automatic digest system wrote:
Date:    Tue, 29 Apr 2025 09:40:09 +1000
From:    Andrew Rowley<[email protected]>
Subject: Re: Packed decimal sign nibbles

On 29/04/2025 9:32 am, Seymour J Metz wrote:
The decimal instructions treat F zones as positive.
That's always been my understanding. But I'm intrigued by the statement
that it means unsigned in COBOL. Is there a practical difference? Or is
it just a difference e.g. for formatting output?
Gary Weinhold
Senior Application Architect
DATAKINETICS | Data Performance & Optimization
Phone:+1.613.523.5500 x216
Email: [email protected]
Visit us online at www.DKL.com
E-mail Notification: The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system.


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to