Processing BCD and Signed Integer Fields with Python

Gordon McMillan gmcm at hypernet.com
Tue Apr 11 10:54:48 EDT 2000


Chris Lada wrote:

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

You want the struct module.

- Gordon




More information about the Python-list mailing list