









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of the basic data types used on the ibm 370 system, including two's-complement binary numbers, ebcdic (extended binary coded decimal interchange code), zoned decimal data, packed decimal data, and the ieee-754 floating point standard. The document also covers ibm 370 terminology and notation, parity bits, binary arithmetic, character data, and zoned decimal data.
Typology: Study notes
1 / 17
This page cannot be seen from the preview
Don't miss anything!










This lecture discusses the basic data types used on the IBM 370,
The IBM 370 is a byte–addressable machine; each byte has a unique address. The standard storage sizes on the IBM 370 are byte, halfword, and fullword. Byte 8 binary bits Halfword 16 binary bits 2 bytes Fullword 32 binary bits 4 bytes. In IBM terminology, the leftmost bit is bit zero, so we have the following. Byte 0 1 2 3 4 5 6 7 Halfword 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Fullword 0 – 7 8 – 15 16 – 23 24 – 31 Comment: The IBM 370 seems to be a “big endian” machine. Reference: Textbook, Chapter 5 (page 103) and Chapter 9 (pages 208 & 209).
The IBM 370 uses standard two’s–complement integer arithmetic. Binary integers come in three sizes: byte, halfword, and fullword. B 8–bit signed integers – 7 to 2 7
The IBM series computers store character data in EBCDIC form. As the name suggests, this is an extension of an earlier format, BCD ( B inary C oded D ecimal). EBCDIC is an 8–bit code; each character is represented by eight bits. These codes are conventionally represented as two hexadecimal digits. This table shows the hexadecimal form of the EBCDIC for a number of characters. The ASCII codes are also given, just for comparison. Character EBCDIC ASCII blank 40 20 0 – 9 F0 – F9 30 – 39 A – I C1 – C9 41 – 49 J – R D1 – D9 4A – 52 S – Z E2 – E9 53 – 5A a – i 81 – 89 61 – 69 j – r 91 – 99 6A – 72 s – z A2 – A9 73 – 7A NOTE: For these EBCDIC characters, the second digit is always a decimal digit. This shows the origin as punch card codes.
The zoned decimal format is a modification of the EBCDIC format. The zoned decimal format seems to be a modification to facilitate processing decimal strings of variable length. The length of zoned data may be from 1 to 16 digits, stored in 1 to 16 bytes. We have the address of the first byte for the decimal data, but need some “tag” to denote the last (rightmost) byte. The assembler places a “sign zone” for the rightmost byte of the zoned data. The common standard is X’C’ for non–negative numbers, and X’D’ for negative numbers. The format is used for constants possibly containing a decimal point, but it does not store the decimal point. As an example, we consider the string “–123.45”. Note that the format requires one byte per digit stored. Zoned Decimal format is not much used.
Here is how the assembler generates the zoned decimal format. Consider the string “–123.45”. The EBCDIC character representation is as follows. Character – 1 2 3. 4 5 Code 6D F1 F2 F3 4B F4 F The decimal point (code 4B) is not stored. The sign character is implicitly stored in the rightmost digit. The zoned data representation is as follows. 1 2 3 4 5 F1 F2 F3 F4 D The string “F1 F2 F3 F4 C5” would indicate a positive number.
The first thing to note is that business data tend to be variable length. A list of debits might include the strings 3.12, 1003.47, 67.18, etc. Consider the problem of reading a list of signed integers. We specify that each integer will have between 1 and 7 digits and be found in columns 1 – 8 of the punch card. Here is a typical list. 123
- 17765 - A list such as this is easily processed by a program written in a modern high–level programming language. It is a bit of a trick to implement in assembly language. The program must scan left to right until it finds the first non–blank character. If the character is a “ - ”, the number is negative. Otherwise it is not. While one can write a program to interpret this list correctly, it is not trivial to do so. The earlier programmers sought a different solution.
All options for handling the input require the sign to be in a fixed location. Here is one option. Its limitations are obvious. 123
- 765 **17765
The exponent is stored in excess–64 format as a 7–bit unsigned number. This allows for both positive and negative exponents. A 7–bit unsigned binary number can store values in the range [0, 127] inclusive. The range of exponents is given by 0 (E + 64) 127, or
The first step in producing the IBM 370 floating point representation of a real number is to convert that number into hexadecimal format. The process for conversion has two steps, one each for the integer and fractional part. Example: Represent 123.90625 to hexadecimal. Conversion of the integer part is achieved by repeated division with remainders. 123 / 16 = 7 with remainder 11 X’B’ 7 / 16 = 0 with remainder 7 X’7’. Read bottom to top as X’7B’. Indeed 123 = 716 + 11 = 112 + 11. Conversion of the fractional part is achieved by repeated multiplication. 0.90625 16 = 14.5 Remove the 14 (hexadecimal E) 0.5 16 = 8.0 Remove the 8. The answer is read top to bottom as E8. The answer is that 123.90625 in decimal is represented by X’7B.E8’.
There are three available formats for representing floating point numbers. Single precision 4 bytes 32 bits: 0 – 31 Double precision 8 bytes 64 bits: 0 – 63 Extended precision 16 bytes 128 bits; 0 – 127. The standard representation of the fields is as follows. Format Sign bit Exponent bits Fraction bits Single 0 1 – 7 8 – 31 Double 0 1 – 7 8 – 63 Extended 0 1 – 7 8 – 127 NOTE: Unlike the IEEE–754 format, greater precision is not accompanied by a greater range of exponents. The precision of the format depends on the number of bits used for the fraction. Single precision 24 bit fraction 1 part in 2 24 7 digits precision * Double precision 56 bit fraction 1 part in 2 56 16 digits precision **
24 = 16,777,216 ** 2 56 (
)56 10
7 10 16 .
Consider a banking problem. Banks lend each other money overnight. At 3% annual interest, the overnight interest on $1,000,000 is $40.492. Suppose my bank lends your bank $10,000,000 (ten million). You owe me $404.92 in interest; $10,000,404.92 in total. With seven significant digits, the amount might be calculated as $10,000,400. My bank loses $4.92. I want my books to balance to the penny. I do not like floating point arithmetic. TRUE STORY When DEC (the Digital Equipment Corporation) was marketing their PDP– to a large New York bank, it supported integer and floating point arithmetic. At this time, the PDP–11 did not support decimal arithmetic. The bank told DEC something like this: “Add decimal arithmetic and we shall buy a few thousand. Without it – no sale.” What do you think that DEC did?