On a screen like this are representations of numbers, letters, and various other symbols in an easily recognizable form as it is the same as if the various characters had been written on paper.

The computer does not see the characters in this form. Typically on an IBM OS/390 or z/OS System, outside of the Open Systems (Unix) environment, the characters are represented in EBCDIC form. (EBCDIC means Extended Binary Coded Decimal Interchange Code.) In this form each character occupies one byte, but the logical view of that byte is off two components, a Zone and a Number. For instance internally in EBCDIC the letter A and the number 2 would look like:

 

Zone

Number

 

A is

C

1

 

2 is

F

2

 

Mathematics cannot be performed on Zoned Decimal numbers as illustrated above. Maths can only be performed on Packed Decimal Numbers (the commercial norm), Binary Integer Numbers, and Floating Point Numbers (the scientific norm). The latter are note covered in these tutorial notes.

Packed Decimal Numbers

Packed numbers are those where all the Zones, except that of the low order byte, have been stripped out. In a Packed Decimal number, the Zone and Number portions of the low order byte appear to have been reversed, i.e.

 

Zoned Decimal

Packed Decimal

 

1000 is

F1F0F0F0

01000F

 

Note that the Packed Decimal number occupies one byte less than the Zoned Decimal number even though it has been padded with a zero to make an even number of digits.

The sign of the Packed Decimal number, which will always be a letter in the range A to F, will vary according to whether the number is positive or negative. Letters B and D indicate negative, and A, C, E and F indicate positive. Packed Decimal numbers can be operated on directly in memory.

Binary Integer Numbers

Binary Integer Numbers can be stored in memory, but must be in a Register when being used in maths, and a Register can hold a 32-bit Binary Integer Number as a Register has a 4-byte capacity. Taking the earlier example of 1000 down to its binary form would result in something like:

 

Zoned Decimal

Packed Decimal

Binary Integer

 

1000 is

F1F0F0F0

01000F

000003E8

 

The bigger the number the less practical it is to write in strict binary, i.e. a string of 1s and 0s, instead a hexadecimal notation is used. Decimal notation is based on the number 10, whereas hexadecimal is based on the number 16. It can be seen from the Zone/Number format that each half byte has 4 bits. These 4 bits can be set to range from all 0, to all 1s. These various bit settings therefore assume the following meaning:

 

Decimal

Binary

Hexadecimal

Decimal

Binary

Hexadecimal

 
 

0

0000

0

8

1000

8

 
 

1

0001

1

9

1001

9

 
 

2

0010

2

10

1010

A

 
 

3

0011

3

11

1011

B

 
 

4

0100

4

12

1100

C

 
 

5

0101

5

13

1101

D

 
 

6

0110

6

14

1110

E

 
 

7

0110

7

15

1111

F

 

Copyright © KMS-IT Limited 2002