# Ebcdic Overpunch Decoding

Reference for the EBCDIC "overpunch" / zoned-decimal sign convention where the units...

- Repository: https://github.com/benchflow-ai/skillsbench (1888 stars)
- Category: Engineering
- License: Apache-2.0
- Last updated: 2026-10-24
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add benchflow-ai/skillsbench --skill ebcdic-overpunch-decoding -g -a claude-code -y`
Codex: `npx skills add benchflow-ai/skillsbench --skill ebcdic-overpunch-decoding -g -a codex -y`
Cursor: `npx skills add benchflow-ai/skillsbench --skill ebcdic-overpunch-decoding -g -a cursor -y`
Gemini CLI: `npx skills add benchflow-ai/skillsbench --skill ebcdic-overpunch-decoding -g -a gemini-cli -y`

## Description

Reference for the EBCDIC "overpunch" / zoned-decimal sign convention where the units position of a numeric field is replaced with a letter that encodes both a digit and a sign. Useful when reading mainframe-style fixed-length tapes whose amount fields appear as digits followed by a letter (e.g. "0000000000123D" or "0000000000045M").

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# EBCDIC overpunch (zoned decimal sign)

On classic mainframe tapes, signed numeric amounts are stored as N-1 digits
followed by a single byte where the high-order bits carry the sign and the
low-order bits carry the final decimal digit. When the file is converted to
ASCII / printable form, the last byte is rendered as a letter (or a brace).

## Sign and digit table

| Char | Sign | Last digit |       | Char | Sign | Last digit |
|------|------|------------|-------|------|------|------------|
| `{`  |  +   | 0          |       | `}`  |  −   | 0          |
| `A`  |  +   | 1          |       | `J`  |  −   | 1          |
| `B`  |  +   | 2          |       | `K`  |  −   | 2          |
| `C`  |  +   | 3          |       | `L`  |  −   | 3          |
| `D`  |  +   | 4          |       | `M`  |  −   | 4          |
| `E`  |  +   | 5          |       | `N`  |  −   | 5          |
| `F`  |  +   | 6          |       | `O`  |  −   | 6          |
| `G`  |  +   | 7          |       | `P`  |  −   | 7          |
| `H`  |  +   | 8          |       | `Q`  |  −   | 8          |
| `I`  |  +   | 9          |       | `R`  |  −   | 9          |

Positive zero is `{`; negative zero is `}`. Both decode to magnitude 0, keep
the sign attached so downstream arithmetic doesn't drop a debit's polarity.

## A common defect

The positive half of the table (`{`, `A`, `I`) is the visible-looking case and
is often handled first. The negative half (`}`, `J`, `R`) looks like ordinary
letters and is easy to forget. If only the positive letters are decoded,
debits and credits both come through as positive, the totals look plausible
but signs are wrong on every negative row.

## Decoding pattern (placeholder names)

Split the field into the leading digits and the overpunch byte, look up the
sign + units digit from the table above, recombine, then build the signed
working-storage value. The shape below uses **generic** identifiers, substitute your own field names:

The rest: https://github.com/benchflow-ai/skillsbench/blob/HEAD/tasks-extra/cobol-gl-batch-reconcile/environment/skills/ebcdic-overpunch-decoding/SKILL.md
