Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unpack unsigned packed field in db2

Status
Not open for further replies.

gowster

Programmer
Aug 24, 2005
6
US
Does any know if there is a way to unpack an unsigned column to an A/N field in DB2?
 
I'm working with COBOL on DB2 and DECIMAL field in DB2 is signed packed field in COBOL. For example a field in DB2 table which is defined as DECIMAL(17,2) is defined in COBOL as S9(15)V99 COMP-3.

I don't understand what you exactly mean with unsigned packed field. Show an example what you have and what you want to have.
 
An assembler program creates a file with unsigned packed numbers which is then uploaded to DB2 as as an A/N field.
For example an account number will be represented as X'3899'. I want to unpack the field to '3899'.
 
Post the "input" value (in hex) and the desired output value also in hex.

Mention how many bytes are to be used for each value.

X'3899' is Not a an unsigned packed number because by definition a packed decimal number has a sigh in the low-order nibble.

Once you show what you "have" and what you "want" and we get the terminology straight, someone may have a suggestion.
 
I would suggest posting this in the relevant language forum, as this does not seem to be a DB2 issue.

It appears to me as if you are asking 'in such and such a language, how do I convert a xxxx field to a zzzzz field'.

We are all happy to help, and have between us a pretty extensive knowledge of DB2 and numerous languages that interact with it, but I think you may need to be a little more specific with your question, or even post in a more relevant forum.

Apologies for not being able to be overly helpful.

Marc
 
Hello

I have to re-state this situation, it involves an unsigned packed decimal number. These numbers can/are created in assembler. Is there a way, if anyone knows, for DB2 to unpack this type of numeric field? Does the new UNPACK function do this? I would like to do this without arithmetic. Again, there is such a thing a unsigned packed numbers.

Thank you
 
look at the load utility - with that you can convert the field on the load - be aware though that you do need to define the field correctly - and if your assembler program is not following the normal storage rules then you will have big problems. It is also possible that it is not a packed decimal, but a binary format e.g. COMP or BINARY or COMP-5 for example.

As some previously asked, if you wish to have a correct answer you need to supply more information, including source data and formatted data. Operating system and version of the software used are also, in many cases, a requirement for you to get the answer you seek.

Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
You still need to post the input value in Hex as well as the desired output in hex.

"if your assembler program is not following the normal storage rules then you will have big problems."From what you have posted, this is indeed what you are working with.

Once we know what you have as input and exactly what you want as output, there should be more usable suggestions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top