Skip to main content

python copybook parser

Project description

Copybook

Copybook is a python module for parsing VSAM copybooks.

Features

  • Supports all numeric PIC variations including:
    • integers
    • floats described with dot notation
    • floats described with V notation
    • leading SIGNED
    • trailing SIGNED
  • Character PIC notations
  • Groups
  • OCCURS clauses
  • REDEFINES clauses

In addition, it provides indexes of column locations to help with parsing fixed width files based on positions within each line

Installation

pip install copybook

Usage

Copybook provides two methods for parsing copybooks: parse_file and parse_string. The result is a FieldGroup object that represents the root of the copybook tree.

Examples:

import copybook
text = """
       01  WORK-BOOK.                                  
        10  TAX-RATE        PIC S9(13)V9(2)                
                    SIGN LEADING SEPARATE.                                     
"""
root = copybook.parse_string(text)

Development

PRs are always welcome!

Support

If you encounter an unsupported copybook feature, please paste the copybook example along with whatever logs or error message you have received.

Gratitude

Copybook uses the awesome PyParsing library for tokenization

License

MIT

Project details


Download files

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

Source Distribution

copybook-1.0.1.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

copybook-1.0.1-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

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