Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Packed Decimals
Message
From
07/12/2004 17:10:29
 
 
To
06/12/2004 22:35:24
Joel Hokanson
Services Integration Group
Bellaire, Texas, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00967378
Message ID:
00967605
Views:
11
Like me, old and not good looking but works hard:
**************************************** unpack a packed numeric field
FUNCTION ut_unpack(s)
LOCAL x,r,i
      x = 0
      r = 0
      i = 0
LOCAL j,k,l,m,n,o

for i = 1 to len(s)

    j = substr(s,i,1)
    k = asc(j)
    l = k
    m = bitand(l,240)
    n = bitrshift(m,4)
    x = n
    r=(r*10)+x

    if i < len(s)
       j = substr(s,i,1)
       k = asc(j)
       l = k
       m = bitand(l,15)
       x = m
       r=(r*10)+x


    endif
next

**** get sign
i = right(ut_getsign(s),1)
if at(i,"FACE")>0
else
   r = 0-r
endif
return r / 100.00

**************************************** get sign bits of a packed numeric field
FUNCTION ut_getsign(s)
LOCAL x,r,i
      x = 0
      r = 0
      i = 0
LOCAL j,k,l,m,n,o

i = len(s)

j = substr(s,i,1)
k = asc(j)
l = k
m = bitand(l,15)
x = m
return substr("123456789ABCDEF",x,1)
For specific questions you can email me direct.
Previous
Reply
Map
View

Click here to load this message in the networking platform