Skip to main content

A Python library to convert COBOL ebcdic file to CSV format

Project description

pycobol2csv

pycobol2csv is a Python library to convert COBOL ebcdic file to CSV format. The package is built to cater for advanced features in COBOL copybooks such as OCCURES x TIMES.

The CSV file is RDBMS friendly and all headers are ready to be used as database column names. CSV conversion is controlled by config file in csv_config.json

Install the python module:

pip install pycobol2csv

To use the module:

from pycobol2csv import convert_cobol_file

convert_cobol_file(copybook_file, data_file, output_file, config_file, codepage, debug=False)

  • copybook_file: copybook filename
  • data_file: data filename
  • output_file: output csv filename
  • config_file: csv configuration filename, refer to csv_config.json
  • codepage: codepage for edibic, refer to https://docs.python.org/3.7/library/codecs.html#standard-encodings for details
  • debug: enable for more debug information, default is OFF

test

2 sets of test data have been created from scratch. Each set includes a copybook and an EBCDIC data file.

To test:

python convert_cobol_test_main.py --copybook [COPYBOOK_FILE] --data [DATA_FILE] --output [CSV_FILE]

Repo: https://github.com/jasonli-lijie/pycobol2csv

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycobol2csv-0.1.4-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file pycobol2csv-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: pycobol2csv-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for pycobol2csv-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 318323b1cc3c1a02945cdbffb602c3aa0d51ffd3bbe6ddb258415ec5cba4d715
MD5 b41aecc6b3c240bfcf90116c89b67926
BLAKE2b-256 2d9926fa75f335fa48ffc6d9147366b868174ed7c3036077f90a9d99439484d8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page