My COBOL experience dates from the mid 80s, but
- I would suggest to always use signed values with comp-3 (packed), and to
mark values as positive, that have no explicit sign information
And some questions:
- is it possible today to have comp-3 values in COBOL, that have no sign
nibble?
In PL/1, for example, it is NOT possible to do this ... you have the
UNSIGNED attribute
only for BIN FIXED numeric data, not (yet) for DEC FIXED (CP et al.
cannot handle
unsigned decimal data).
- if so, the generated CLC which compares such packed fields without
sign nibbles
with fields which have sign nibbles would yield very strange results ...
- I believe that you must make sure that CPs are generated for such
comparisons,
because it's always possible that you get F sign nibbles instead of C
for positive
signs (after PACK), and they should compare OK - and only CP tolerates
different
sign nibbles
Kind regards
Bernd
Am 24.04.2013 16:43, schrieb Phil Smith:
Suppose you have values that you're converting between character and packed
decimal, in both directions at various times. You're a middleman, so you don't
know what the application is going to be using the values for.
For a non-negative value, packed decimal could be either positive or unsigned.
What do folks usually do? Is it normal for code to actually care? That is, if we say "Heck
with it, we can't tell, so we'll just mark it positive", is that likely to cause problems? Or
is use of unsigned rare enough that this is essentially a non-issue? (Hint: I'd like that last to
be the case!) Obviously a "sign=" value could be passed around with the value, but that
kind of metadata isn't in the stream now, so I'd rather not add it.
Any and all ideas gratefully accepted...
...phsiii
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN