Need some python help (or maybe C )
Kevin O'Gorman
kogorman at gmail.com
Sat Dec 13 21:33:05 PST 2008
In python, if that's a string, as in
num='000123456D'
you can make it a number like so
digits = num[:-1]
sign = num[-1:]
if sign=='D': val = -int(digits)
else: val = int(digits)
I hope this helps
On Sat, Dec 13, 2008 at 9:40 AM, Ben Duncan <bend at linux4ms.net> wrote:
>
> I have a hex value as x'000123456D". It is a COMP-3 (Binary coded decimal)
> for a cobol program. That says to me and is in actuality the number 123456-,
> The LAST nibble D is negative and F or C would be postive.
>
> I need to get this to a "integer" or a string.
>
> Any ideas on this one ?
>
> --
> Ben Duncan - Business Network Solutions, Inc. 336 Elton Road Jackson MS,
> 39212
> "Never attribute to malice, that which can be adequately explained by
> stupidity"
> - Hanlon's Razor
>
> _______________________________________________
> Linux-users mailing list ( Linux-users at linux-sxs.org )
> Unsub/Password/Etc: http://linux-sxs.org/mailman/listinfo/linux-users
>
> Need to chat further on this subject? Check out #linux-users on
> irc.linux-sxs.org !
>
--
Kevin O'Gorman, PhD
More information about the Linux-users
mailing list