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

RE: gnubol: The sign-nibble question



The "problem" that "display" numerics in ASCII are X"30" thru X"39" (as
opposed to the mainframe X"F0" thru X"F9").  Therefore, the question becomes:

A) If you pack an (ASCII DISPLAY) X'393837'field - should you get
     X'9837'
       or
     X'98F7'
(given the fact that the MOST common packed-decimal routines "assume" IBM
compatible sign-nibbles, the latter MAY be desirable - but non-intuitive)

B) If the latter is what you want, then should X'3132' be considered
equivalent to X'F1F2' - or not?  Should both "pass" an IF NUMERIC test?

C) Also, it is common (but not universal) in ASCII COBOL implementations to
have X'3' as the sign nibble for BOTH unsigned and positive numbers.  What
should the GNU COBOL do about this?

> -----Original Message-----
> From: owner-gnu-cobol@wallace.lusars.net
> [mailto:owner-gnu-cobol@wallace.lusars.net]On Behalf Of Fred Mobach
> Sent: Friday, June 09, 2000 6:45 AM
> To: gnu-cobol@lusars.net
> Subject: Re: gnubol: The sign-nibble question
>
>
> "William M. Klein" wrote:
>
> > OBVIOUSLY, this also impacts the "rules" for packing and
> unpacking numbers.
> > If you use the same sign-nibbles in DISPLAY and PACKED-DECIMAL
> numbers, life
> > is easier for these rules - on the other hand, it (usually)
> means that the
> > usage display numeric signed and unsigned fields aren't the same
> - or have
> > other peculiarities.
>
> Display numeric fields without sign are filled with the numerals 0 - 9, in
> EBCDIC x"F0" - X"F9". Any other value is invalid.
>
> Display numeric fields with sign are filled in all bytes exept the
> byte at the
> highest address with the numerals 0 - 9, in EBCDIC x"F0" - X"F9".
> The last byte
> contains the sign in the left nibble as you have described.
>
> The PACK instruction places the sign nibble from the DISPLAY field
> in the right
> nibble of the receiving field, all other nibbles are filled with the right
> nibble values of the sending field. Conclusion : all possible sign
> values in a
> DISPLAY field are also used in packed decimal fields.
>
> If you are willing to support files coming from mainframes you
> should consider
> to support these sign values also.
>
> Regards,
>
> Fred Mobach
>
>
>
>
> --
> 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.


--
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.