Signed overpunch

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

A signed overpunch is a code used to store the sign of a number by changing the last digit. It is used in character data on IBM mainframes by languages such as COBOL, PL/I, and RPG.[1] Its purpose is to save a character that would otherwise be used by the sign digit.[2] The code is derived from the Hollerith Punched Card Code, where both a digit and a sign can be entered in the same card column. Character data which may contain overpunches is called zoned decimal.

The PACK instruction on IBM System/360 architecture machines converts the sign of a zoned decimal number when converting to packed decimal, and the corresponding UNPK instruction will set the correct overpunched sign of its zoned decimal output.[3]

Language support[edit]


PL/I uses the PICTURE attribute to declare zoned decimal data with a signed overpunch. Each character in a numeric picture except V, which indicates the position of the assumed decimal point, represents a digit. A picture character of T, I, or R indicates a digit position which may contain an overpunch. T indicates that the position will contain {–I if positive and }–R if negative. I indicates that the position will contain {–I if positive and 0-9 if negative. R indicates that the position will contain 0–9 if positive and }–R if negative.

For example PICTURE 'Z99R' describes a four-character numeric field. The first position may be blank or will contain a digit 0–9. The next two positions will contain digits, and the fourth position will contain 0–9 for a positive number and }–R for negative.[4]

Assigning the value 1021 to the above picture will store the characters "1021" in memory; assigning -1021 will store "102J".

The codes[edit]

Code Digit Sign
} 0
J 1
K 2
L 3
M 4
N 5
O 6
P 7
Q 8
R 9
{ 0 +
A 1 +
B 2 +
C 3 +
D 4 +
E 5 +
F 6 +
G 7 +
H 8 +
I 9 +


10} is -100
45A is 451

Decimal points are usually implied and not explicitly stated in the text. Using numbers with two decimal digits:

1000} is -100.00


  1. ^ IBM Corporation (June 1994). RPG/400 Reference (PDF). p. 403. Retrieved Aug 7, 2018.
  2. ^ "Tech Talk, COBOL Tutorials, EBCDIC to ASCII Conversion of Signed Fields". Retrieved 2008-03-15.
  3. ^ IBM Corporation (Oct 2001). z/Architecture Principles of Operation (2nd ed.). pp. 7–112, 7–158. Retrieved August 7, 2018.
  4. ^ IBM Corporation (June 1995). IBM PL/I for MVS & VM Language Reference (PDF). pp. 294–296. Retrieved Aug 2, 2018.