Processing BCD and Signed Integer Fields with Python

Chris Lada chris.lada at westgroup.com
Tue Apr 11 11:01:57 EDT 2000


Nick,

 Being a newbie in python, I have to ask these questions: what functions can
I use to process these fields ?  What can I use to separate the number from
the sign ?   Is there a conversion for this type of data to strings ? What
data types would they be ?

Thanks,
Chris

Nick Maclaren wrote in message <8cvdel$lb9$1 at pegasus.csx.cam.ac.uk>...
>
>In article <38f334ea at wwwproxy3.westgroup.com>, "Chris Lada"
<chris.lada at westgroup.com> writes:
>|> We have been receiving record/field-based information from a data
provider.
>|> Some of the fields are BCD (Binary Coded Decimal), and some are signed
>|> integer. The data originates from a mainframe/Cobol(?) system. The
record
>|> layouts have definitions like "PIC S99999" (signed integer), and "PIC
S99999
>|> Comp-3" (BCD). Has anyone had to process this sort of data with Python ?
>|> Can Python handle this sort of data type ?  Anyone have suggestions on
how
>|> to approach this problem ?
>
>It's pretty easy handling anything like that, PROVIDED that you have
>the data intact.  Let us assume that is IBM 360/370/390 MVS or CMS,
>then it originated in a record-oriented system, where ALL characters
>are valid in records.  99% of people manage to mangle the data when
>transferring it to Unix or Unix-like systems (including Microsoft
>systems), and lose information.
>
>If you can avoid that, it is just like handling any field-oriented
>data, except in binary rather than human-readable text.  This remark
>applies to any sufficiently powerful language - C, Perl, Python and
>so on.
>
>
>Regards,
>Nick Maclaren,
>University of Cambridge Computing Service,
>New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
>Email:  nmm1 at cam.ac.uk
>Tel.:  +44 1223 334761    Fax:  +44 1223 334679





More information about the Python-list mailing list