If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Converts an argument in packed format

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-15-06, 17:48
arlf arlf is offline
Registered User
 
Join Date: May 2006
Posts: 16
Converts an argument in packed format

I am working with DB2 V7 in OS/390.
I have a table (TB1) with a varchar column (C1) which was redefine in order to store a group of numeric values (up to 1500, like quantities or amounts) in packet format, back to back:
C1 = dddddddddddddddddz40dddddddddddddddddz40dddddddddd dddddddz ...
d: digit, z: sign, 40: space separation (hex)

Each one item has 9 bytes and represents an specific concept, like a payment/deduction amount or number of items.

Actually, to operate with these arguments, the portion correspondig to the item required is extracted from the column C1 using a "SUBSTR" function and moved to a 9 bytes character field (A1), redefined like PIC 9 (15.2) COMP-3:
For third item, it would be
Select substr(C1, 31, 9) into A1 from TB1 where ...

What can I do in order to DB2 returns the numeric value of the argument (or their sum using a grouping function) ?

Thanks in advanced, ARLF.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On