# COBOL Copybook & Mainframe Modernization API - Parse Copybook

> COBOL Copybook & Mainframe Modernization API - Parse Copybook is a paid API for AI agents from cobol-modernize-api.fly.dev, paid per call via x402, $0.25/call, status unknown (last checked 2026-09-13).

Converts a COBOL copybook definition into a JSON schema, decodes raw EBCDIC/packed-decimal mainframe records into field values, and generates Java record source code from the copybook structure

## Facts

- Endpoint: POST https://cobol-modernize-api.fly.dev/parse-copybook
- Price: $0.25/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/cobol-copybook-mainframe-modernization-api-parse-copybook-e7d97a90
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_2oHf4_22E69VvPVb3guLd

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability cobol-copybook-mainframe-modernization-api-parse-copybook-e7d97a90 -d '<json body>'
```

Example prompt: I have a COBOL copybook with REDEFINES and OCCURS DEPENDING ON clauses that I need modernized — can you parse it and give me the JSON schema plus generate the equivalent Java record class from it?

## When to prefer this

Choose this endpoint when you need to programmatically modernize COBOL copybook definitions as part of a mainframe migration pipeline, especially when dealing with complex constructs like REDEFINES, OCCURS DEPENDING ON, 66-level RENAMES, or 77-level standalone items that simpler tools cannot handle. It is the right choice when you need all three outputs — JSON schema, decoded field values, and Java record code — from a single API call rather than stitching together multiple tools.

## Known failure modes

- Invalid or unparseable COBOL copybook syntax returns an error
- Mismatched record size between copybook definition and provided binary data causes decode failure
- Unsupported COBOL constructs not covered by the parser return an unsupported-feature error
- Missing or malformed OCCURS DEPENDING ON runtime count causes variable-length resolution failure
- Payment failure or insufficient USDC balance blocks the request
- Network timeout on the fly.dev host under heavy load

## How this service works

Tools for mainframe modernization projects: convert COBOL copybooks to JSON schema, decode real EBCDIC/packed-decimal mainframe records into field values (schema validation against sample data), and generate modern Java record source code directly from a copybook. Handles REDEFINES (including group-level alternate layouts), OCCURS and OCCURS DEPENDING ON (variable-length repeating groups, resolved at decode time using the actual runtime count), 66-level RENAMES, and 77-level standalone items. Accepts payment on Base, Polygon, Arbitrum, and Solana (USDC) - pick whichever network your wallet holds funds on.

## Output

Returns a JSON object containing a JSON schema derived from the COBOL copybook (with all fields, types, and structure), the total field count, the computed record size in bytes, and optionally decoded field values from a provided raw EBCDIC/packed-decimal record or generated Java record source code.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "copybook_name": {
   "type": "string",
   "description": "Optional filename for reference"
  },
  "copybook_text": {
   "type": "string",
   "description": "Raw COBOL copybook source text"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "schema": {
   "...": "..."
  },
  "field_count": 5,
  "record_size": 35
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/cobol-copybook-mainframe-modernization-api-parse-copybook-e7d97a90/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from cobol-modernize-api.fly.dev](https://www.zero.xyz/host/cobol-modernize-api.fly.dev/llms.txt)
