James Allman | JA Technology Solutions LLC
Packed Decimal / COMP-3 Converter
Decode and encode packed decimal (COMP-3), zoned decimal, and trailing overpunch for IBM i and mainframe systems.
Packed Decimal / COMP-3 Converter
Convert between packed decimal (COMP-3), zoned decimal (DISPLAY), trailing overpunch, and readable numeric values. Used on IBM i (RPG packed/zoned fields) and mainframes (COBOL COMP-3/DISPLAY). Visual nibble breakdown, configurable decimal places, RPG and COBOL definition display. Supports positive, negative, and unsigned values.
Learn more ↓
Loading interactive explorer...
What Is Packed Decimal (COMP-3)?
Packed decimal is a binary-coded decimal format that stores two digits per byte, with the last nibble (half-byte) reserved for the sign (C for positive, D for negative, F for unsigned). The value +12345 is stored as three bytes: 12 34 5C. On IBM mainframes running COBOL, this format is called COMP-3; on IBM i (AS/400) running RPG, it is simply “packed.” Zoned decimal (DISPLAY in COBOL, zoned in RPG) stores one digit per byte with the sign embedded in the zone nibble of the last byte using an overpunch convention inherited from punch card encoding.
Packed Decimal in IBM i and COBOL
Packed decimal is the default numeric storage format on IBM i and mainframe systems because it is compact and supports exact decimal arithmetic without floating-point rounding errors, essential for financial calculations. A 9-digit packed field uses only 5 bytes versus 9 bytes for zoned decimal. When you extract data from these systems as raw binary files, numeric fields appear as unintelligible hex bytes unless you know the field layout (position, length, decimal places, and format). Misinterpreting a packed field as text (or applying EBCDIC-to-ASCII conversion to it) destroys the numeric data.
Legacy Data Extraction and Migration
This tool decodes individual packed and zoned values for inspection and debugging. When the decoded number is actually a date (a packed CYYMMDD or Julian field, which is most of them), the IBM i Date Format Converter turns it into a calendar date and generates the RPG, COBOL, or SQL to do the same in code. Production data extraction requires processing entire files with mixed text and numeric fields, applying the correct conversion to each field based on the record layout. I build data extraction and migration pipelines that parse fixed-width records from IBM i and mainframe systems, decode packed decimal, zoned decimal, and binary fields, and deliver clean data to modern databases and applications. Learn about IBM i services, explore migration capabilities and ETL development, or get in touch.
For a deeper explanation of how packed decimal and zoned decimal fit inside fixed-width records alongside character fields, how implied scale silently breaks ETL pipelines, and how to approach a full extraction correctly, see the article Packed Decimal and COMP-3: Reading Mainframe Numbers Correctly.
All tools run entirely in your browser. Your data never leaves your machine. Need help? Ask James.