× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: convert packed to alpha
  • From: "Simmerlein, Stefan" <S.Simmerlein@xxxxxxxxxxx>
  • Date: Mon, 9 Jul 2001 10:47:22 +0200

Title: convert packed to alpha

Hi, i have some problems with this code.


I've tested it with different numbers, (3617900 for example)
and it works fine.

In some cases i've got wrong results.
For Example:
hexstring = hex value of 3494402,  5240211
alphastring = 3494002 5200211

Hexstring contains the hex value from a packed field (fieldxyz  9p 0).
What's wrong ??????????

The code looks like this

d universal_ds e ds     extname(filexyz)
        ......
d universal         s         500a
        .....
d hexstring     s       500a                    (hexstring contains the hex value from a packed number)
d alphastring   s               500a    inz     (that's the result)
d l                     s                   3p 0        inz             (length oh hexstring)
            
d                    ds                             
d num                             30p 0            
d char16                         16     overlay(num)
        .......
c                   eval      universal = universal_ds
c                   eval      hexstring = %subst(universal:1:5)         (pos 1-5 = packed field 9p 0)
        .......
c                   eval      l = %len(hexstring)
c                   evalr     char16 = %subst(hexstring:1:l)
        .......                                                           
c     ' ':x'00'     xlate     char16        char16         
c                   eval      alphastring = %char(num) 
        .......


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.