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

Re: gnubol: The sign-nibble question



The X/Open standard specified that packed-decimal and comp-3 uses
the IBM mainframe format which is

x'f' - no sign (implied positive)
x'c' - positive
x'd' - negative

in the low("rightmost") nibble of the trailing byte.

Display format is specified as ASCII ie x'32'=2. 

On display format with a sign
:

... PIC s(5) usage display.

little is said. There are numerous options such as sign is
leading/trailing/separate character. 

Without separate character, it just says to change the leading or
trailing character, in an implementation dependent way. If it is
separate character I assume it would be a '+' or '-' character.

IBM signed display defaults to changing the last byte, e.g. +333
using the PIC above would be

x'f0f0f3f3C3'

The last F became C to signify positive. Maybe they swap the
nibbles too, I can't remember).

In ASCII you would have 

x'30303333c3'.

I like the idea of defining the various data formats as 

comp-701 = IBM format packed decimal, say
comp-702 = Intel native packed decimal, say
comp-703 = big-endian binary, say
comp=704 = little-endian binary, say
...
disp-801
disp-802
...

etc, to cover all the options.

Then these get mapped into the lower ranges like comp-3 based on
the dialect we are supporting. But if someone wants mainly IBM
formats, but little endian binary somewhere they can ask for that
specifically.

Tim Josling



--
This message was sent through the gnu-cobol mailing list.  To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body.  For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.