I have started releasing the COBOL data conversion tools to Sourceforge. Cobol2dms.py is not included in the package yet, but I plan to include it within the next few weeks. The project is located here.
Posts Tagged ‘Database’
pyCOBOL is now available on Sourceforge
July 6, 2010COBOL copybook parser
May 19, 2010This Python-based COBOL copybook parser command accepts stdin or a filename, it reads in the copybook text file and returns CSV to stdout in the following format:
- Field Name (concatenated names based on level hierarchy)
- Data Type (‘Integer’, ‘Float’, ‘Double’ or ‘BCD’)
- Field Length
- Implied decimal position (unit-based, i.e 1st char. = 1)
Handles repeating nested field groups (layered OCCURS) and variable length records (OCCURS … DEPENDING ON). Looped fields are indented with ‘\t’ character(s), reference example output.
Keeping the copybook parser loosely coupled from the data record parser allows for post-processing of the file layout, such as piping to Unix commands for text manipulation, manual edits such as adding ‘*’ in front of field names to identify the key fields used when importing data into a relational database, etc.