Need some python help (or maybe C )

Ben Duncan bend at linux4ms.net
Sun Dec 14 10:25:20 PST 2008


The problem of those, is Binary Coded Decimal (COMP-3 Cobol Speak) is
that in the case of looking at x'001234567D' is that this IS truly
a NUMBER with a VALUE of 1234567. The D being the Sign of the field
where D = '-' can be  F or C for a Positive.

Kurt Wall wrote:
> On Sat, Dec 13, 2008 at 11:40:58AM -0600, Ben Duncan 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.
> 
> $ perl -e 'print unpack("I", 0x000123456D), "\n";'
> 942684465
> 
> Kurt
> _______________________________________________
> 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 !
> 


-- 
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




More information about the Linux-users mailing list