[Santa Clara University]
Department of Mathematics
and Computer Science

Math 169

COBOL/IBM Card Information


THE IBM CARD and COBOL NEGATIVE NUMERIC INPUT

The so-called IBM card was invented by Hollerith in the early part of this century. It was in common use until the mid-1970's when time-sharing systems with large disk storage and individual password-protected accounts eliminated the necessity of individual users having to store their source codes on cards.

The punch card is 80 columns wide. In any one column there is room for 12 holes. The LOWER 10 hole places are numbered 0 through 9. The UPPER-most hole place is numbered 12 and if it alone is punched, it corresponds to the PLUS sign (+). The next hole (between the 12-hole and the 0-hole) is numbered 11, and if it alone is punched, it corresponds to the MINUS sign (-).

Because of the numbering of the punch holes, the upper edge is termed the 12-edge, and the lower edge is termed the 9-edge. Hence, card readers will frequently indicate whether the 9-edge or the 12-edge is to be inserted into the machine first.

Multiple punches are used in columns to indicate letters of the alphabet and special characters. Normally, one of the 0, 11 or 12 holes is used along with one of the holes 1-9. For example, A is designated by both the 12 hole and the 1 hole being punched, B by the 12 hole and the 2 hole, etc.

COBOL complicated the interpretation of these holes by allowing numeric entries to have double punched columns to indicate a negative number (i.e. the 11 hole was punched in addition to the 1 through 9 hole). This eliminated the need to use another column solely for indicating a negative number. Unfortunately, this double-punched column could also be interpreted as a letter of the alphabet! For example, J is an 11 and 1 hole, K is an 11 and 2 hole, etc. However, an 11 and 1 hole can be interpreted by COBOL as -1 (assuming an overpunch of the negative sign [hole 11] over the 1), and an 11 and 2 hole can be interpreted by COBOL as -2.

Because of this dual interpretation of the old double punched column, the ambiguity has been retained even when IBM cards are no longer used, and information is stored via ASCII code. Thus, when TYPing or PRINTing out COBOL input files, the system code will interpret the ASCII code as ALPHABETIC, corresponding to the standard interpretation given the corresponding punches on a IBM-card. However, when a COBOL program sees the same ASCII code, given the proper PICTURE, it will interpret the ASCII code as an OVER-PUNCHED NEGATIVE integer and process it accordingly.

Thus, do not be surprised if you see the letters J through R in a numeric field when typing out a file which is destined to be a COBOL input file!


My email address is dsmolarski@math.scu.edu

This page last updated 16 March 2000.