INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

unpack unsigned packed field in db2

unpack unsigned packed field in db2

(OP)
Does any know if there is a way to unpack an unsigned column to an A/N field in DB2?

RE: unpack unsigned packed 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.

RE: unpack unsigned packed field in db2

(OP)
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'.

RE: unpack unsigned packed field in db2

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.

RE: unpack unsigned packed field in db2

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

RE: unpack unsigned packed field in db2

(OP)
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

RE: unpack unsigned packed field in db2

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
www.syssoft-int.com

FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

RE: unpack unsigned packed field in db2

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close