Processing BCD and Signed Integer Fields with Python
Nick Maclaren
nmm1 at cus.cam.ac.uk
Tue Apr 11 10:39:17 EDT 2000
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