Learn it on Mainframe Path. Do it with Mainframe KIT.Learn on Mainframe Path ▸
Mainframe KIT ● Nothing leaves this tab

Packed decimal calculator

Turn numbers into packed, zoned or binary hex, and back.Use this when you need the hex bytes of a COMP-3, zoned or binary field, or want to know what some hex means.

Checked against IBM rulesON THIS DEVICE · NOTHING UPLOADEDCounting requests…
How to use this tool

What it does

Turns a number into packed, zoned or binary hex for a field you describe, and turns hex from a dump back into the number.

How to use it

  1. Type the field's PIC and pick its USAGE.
  2. Type a number, or type the hex you saw in a dump.
  3. Read the bytes, or the number they hold, on the right.

What it cannot do

  • It does not convert floating point (COMP-1, COMP-2).
  • It does not know your compiler options or which sign your program expects.

This tool opens with an example already filled in.

Field

Where the sign sits: Trailing and Leading put it in the top half of the last or first digit byte (C plus, D minus, F unsigned). Trailing separate and Leading separate add one extra byte after or before the digits holding + (4E) or − (60), so the field is one byte longer.

What this does not do: the PIC, the number of decimal places and whether the field is signed come from your copybook, so type them in here; the bytes alone do not carry them. COMP-1 and COMP-2 (floating point) are not supported.

● NUMBER ▸ BYTES
● BYTES ▸ NUMBER
C = plusD = minusF = unsignedany other half-byte in a digit place → S0C7 (the abend a program gets when a number field holds invalid data)

ACCURACY · CHECKED AGAINST IBM RULES

Follows the z/Architecture packed and zoned decimal formats, including the sign half-byte; covered by known-answer tests. The PIC, scale and sign come from your copybook, and COMP-1 and COMP-2 (floating point) are not supported.

What it checks

  • ConfirmedNumber to the hex bytes of a packed (COMP-3) field, with the sign half-byte (C positive, D negative; F when the field has no sign).
  • ConfirmedHex back to a number, rejecting an invalid digit or sign half-byte the way a data exception (S0C7) would.
  • ConfirmedZoned decimal (DISPLAY) encoding and decoding, including the sign zone.
  • ConfirmedBinary (COMP) sizes by digits: 2 bytes for 1-4 digits, 4 for 5-9, 8 for 10-18.

What it does not check

  • UnsupportedFloating point (COMP-1, COMP-2) is not converted here.
  • Depends on your systemCompiler options such as TRUNC, which change how binary values are stored.
  • Depends on your systemWhether your program expects a particular sign nibble (C versus F) for positive values.

Source

  • IBM z/Architecture decimal format; Mainframe Path S0C7 page, as recorded in docs/FACTS.md
  • Enterprise COBOL storage rules (binary sizes, COMP-3 bytes), as recorded in docs/FACTS.md

Checked against IBM rules. Status labels: Confirmed Depends on your system Unsupported (a rule with an official source; depends on your catalog, security, installation defaults or compiler options; not parsed and shown instead of guessing).

Input limits and example

  • Each box: 200,000 characters.

EXAMPLE INPUT

PIC S9(7)V99, number -12345.67  ->  001234567D

Check it yourself in one minute

  1. Open your browser's developer tools: in Chrome or Edge press F12 or right-click and choose Inspect; in Firefox press Ctrl+Shift+E for the Network Monitor; in Safari first turn on Show features for web developers under Settings, Advanced. Then open the Network tab.
  2. Keep the log across page loads (Chrome: Preserve log; Firefox: Persist Logs), then use the tool: paste your text or open a file and press the button.
  3. Look at the list. You will see only this page and its own files, loaded when the page opened. Nothing new appears when you use the tool.
  4. Still unsure? Switch Wi-Fi off and try again. The tool still works.

What the badge counts: requests the browser logged after this page finished loading, other than the site's own files. It reads the browser's own record and makes no request of its own. If your browser cannot give that record, the badge says so. The badge is a convenience; the developer tools are the proof.

The rule that enforces it

Every page carries this Content Security Policy. The browser itself refuses any request outside it; connect-src 'none' blocks fetch, XHR and WebSocket.

default-src 'none';
script-src 'self';
style-src 'self';
img-src 'self' data:;
font-src 'self';
connect-src 'none';
object-src 'none';
form-action 'none';
base-uri 'none';
manifest-src 'self';
worker-src 'self'