Posts Tagged ‘Database’

pyCOBOL is now available on Sourceforge

July 6, 2010

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.

COBOL copybook parser

May 19, 2010

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

  1. Field Name (concatenated names based on level hierarchy)
  2. Data Type (‘Integer’, ‘Float’, ‘Double’ or ‘BCD’)
  3. Field Length
  4. 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.

(more…)


Follow

Get every new post delivered to your Inbox.