I think you need to think more deeply about this part of what you said: "... you don't know what the application is going to be using the values for".
Given that statement, I would be pretty careful about duplicating the signedness or unsignedness of anything you are converting in both directions. For example, a "user" of your conversions who passed in an unsigned string of digits could reasonably expect to get back exactly what was passed in, i.e. not a positively signed value but an unsigned value. E.G., COBOL callers passing in to you unsigned display numbers like "12345" (X'F1F2F3F4F5') do not expect to get back "1234E" (X'F1F2F3F4C5'), which will not pass the COBOL "IF variable NUMERIC" test. If you know more about your callers and they guarantee that they can handle signed values even when they give you unsigned values to start with, then it does not matter. If on the other hand you are always receiving display numbers and passing back packed numbers, the signedness of the packed return value really shouldn't matter, BUT you still need to know how your callers are using them to guarantee that it does not make a difference. It should not matter, in most normal application scenarios I can imagine, but there are cases where it would definitely matter (e.g., if the packed return value is used as part of a VSAM key and you used to return unsigned values but now you return signed values ... oops!). HTH Peter -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of Phil Smith Sent: Wednesday, April 24, 2013 10:44 AM To: [email protected] Subject: Packed decimal and sign nibble 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 -- This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
