A while ago, there was a somewhat contentious thread about packed decimal: 
whether it had to include the sign nybble or could just be all "significant" 
nybbles, and like that. I don't intend to revisit what the formal definition of 
"packed decimal" is or should be, but rather would like to understand 
real-world usage:

1)      Do people use the "all significant" variant (e.g., a value of decimal 
1234 stored in a halfword, x'1234', as opposed to 3 bytes, x'01234C')?

2)      What languages do they use the "all significant" format from, if so?

3)      How often do you use the "unsigned" nybble format (x'01234F' for 
"unsigned 1234")?

4)      Which databases (DB2, yes;  ADABAS, IMS, IDMS?) support packed decimal, 
and is it the "all significant" format, or just the "sign nybble" format?

One of the meta-questions I'm trying to grok is why you would use packed 
decimal for things like SSNs. Sure, it's more compact than character; I get 
that (and we used to care about that, and maybe still do). But in either packed 
format, an SSN takes 5 bytes, but would fit in a fullword as binary. And you're 
not likely to be doing assembler EDIT/EDMK/ZAP/things like that on SSNs, so 
there's no benefit there. Is it that x'123456789C' is easier to read in memory 
or a dump when looking for SSN 123456789? Geographic prefix analysis (though I 
kind of thought only the SSA cared about that)? Something else?

The same applies in spades to credit card numbers, which you're even less 
likely to be doing math on, though I suppose there's a bit more prefix analysis 
or IINs and the like, so maybe x'04000123456789123' for CCN 4000123456789123 
might be a bit easier to process. Does COBOL make packed easier to work with? 
Yes, COBOL isn't my strongest language - "You say that like it's a negative 
thing", as Woody Allen would put it :)

Thanks in advance for any wisdom!
--
...phsiii

Phil Smith III

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

Reply via email to