ArticleslgStudy

computer science

Signed overpunch

Signed overpunch is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Signed overpunch rather than just read about it. In short: In computing, a signed overpunch is a coding scheme which stores the sign of a number by changing (usually) the last digit. It is used in character data on IBM mainframes by languages such as COBOL, PL/I, and RPG.

Key takeaways

  • Signed overpunch belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Signed overpunch to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Signed overpunch from memory before moving on to harder problems.

Reference excerpt

In computing, a signed overpunch is a coding scheme which stores the sign of a number by changing (usually) the last digit. It is used in character data on IBM mainframes by languages such as COBOL, PL/I, and RPG. Its purpose is to save a character that would otherwise be used by the sign digit. 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. It is called an overpunch because the digit in that column has a 12-punch or an 11-punch above it to indicate the sign. The top three rows of the card are called zone punches, and so numeric character data which may contain overpunches is called zoned decimal. In IBM terminology, the low-order four bits of a byte in storage are called the digit, and the high-order four bits are the zone. The digit bits contain the numeric value 0–9. The zone bits contain either 'F'x, forming the characters 0–9, or the character position containing the overpunch contains a hexadecimal value indicating a positive or negative value, forming a different set of characters. (A, C, E, and F zones indicate positive values, B and D negative). 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.

Language support

PL/I 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. Assigning the value 1021 to the above picture will store the characters "1021" in memory; assigning -1021 will store "102J".

COBOL COBOL uses the picture character 'S' for USAGE IS DISPLAY data without SIGN IS SEPARATE CHARACTER to indicate an overpunch. SIGN IS LEADING indicates that the overpunch is over the first character of the field. SIGN IS TRAILING, locates it over the last character. SIGN IS TRAILING is the default.

C/C++ The C language has no provision for zoned decimal. The IBM ILE C/C++ compiler for System i provides functions for conversion between int or double and zoned decimal:

QXXDTOZ() — Convert Double to Zoned Decimal QXXITOZ() — Convert Integer to Zoned Decimal QXXZTOD() — Convert Zoned Decimal to Double QXXZTOI() — Convert Zoned Decimal to Integer

EBCDIC overpunch codes

Examples 10} is -100 45A is 451

ASCII representation Representation of signed overpunch characters "is not standardized in ASCII, and different compilers use different overpunch codes." In some cases, "the representation is not the same as the result of converting an EBCDIC Signed field to ASCII with a translation table." In other cases they are the same, to maintain source-data compatibility at the loss of the connection between the character code and the corresponding digit. An EBCDIC negative field ending with the digit '1' will encode that digit as 'D1'x, upper-case 'J', where the digit is '1' and the zone is 'D' to indicate a negative field. ASCII upper-case 'J' is '4A'x, where the hexadecimal value bears no relationship to the numeric value. An alternative encoding uses lower-case 'q', '71'x, for this representation, where the digit is '1' and the zone is '7'. This preserves the digit and the collating sequence at the cost of having to recognize and translate fields with overpunches individually.

Examples Gnu COBOL and MicroFocus COBOL use lower-case 'p' thru 'y' to represent negative '0' thru '9'. PL/I compilers on ASCII systems use the same set of characters ({, J–R) as EBCDIC to represent negative values.

References

Worked examples

Example 1 — a first encounter with Signed overpunch

Start with the simplest possible case. Write down what Signed overpunch claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Signed overpunch before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Signed overpunch ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Signed overpunch

In research
Signed overpunch appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Signed overpunch in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Signed overpunch is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer data, Computer programming, History of software, so understanding it makes those chapters shorter.
In everyday life
Look for Signed overpunch outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Signed overpunch in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Signed overpunch means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Signed overpunch out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Signed overpunch in simple terms?

In computing, a signed overpunch is a coding scheme which stores the sign of a number by changing (usually) the last digit. It is used in character data on IBM mainframes by languages such as COBOL, PL/I, and RPG.

Why does Signed overpunch matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Signed overpunch?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Signed overpunch.

Tags

  • Computer data
  • Computer programming
  • History of software
  • Punched card

Keep exploring