Registry / data / copybook

copybook

JSON →
library1.0.16pypypi✓ verified 81d ago

A Python library for parsing COBOL copybooks (data definition records). Current version 1.0.16. Development appears infrequent with no recent releases.

pip install copybook
INSTALL
IMPORT
SIG · COPYBOOK
C
copybook
datapythonv1.0.16
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

copybook
import copybook
from copybook import Copybook
Field
from copybook import Field
parse_file
from copybook import parse_file

Parse a COBOL copybook string and get field positions.

from copybook import Copybook cb = Copybook('') cb.parse( struct=" 01 RECORD. 05 NAME PIC X(30). 05 AGE PIC 9(3). " ) print(cb.layout) # Example output: {'NAME': (1, 30), 'AGE': (31, 33)}
Debug
Known issues
gotchaThe parse method does not accept file paths; you must read the copybook file yourself and pass the content as a string.
fix
Use open('copybook.cbl').read() to get the content, then pass it to parse.
affects: all
gotchaCopybook layout indices are 1-based, not 0-based.
fix
When using layout offsets, remember that the first byte is 1. Adjust if your downstream expects 0-based.
affects: all
Upgrade
Version history
1.0.16latest on PyPI · released Sep 15, 2022
Audit
Dependencies
pyparsingrequiredUsed for parsing copybook syntax
Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
1
Resources
copybook — pip install copybook · libregistry