Fixed point data fields, more commonly called Binary data fields, are defined using an F or an H in a DS or DC declarative. The F creates a fullword (4-byte) field containing a binary integer in 2s complement format. In this format, the integer can be positive or negative. The H designator is used to create halfword (2-byte) fields containing 2s complement signed integers. In both formats, the length indicator Ln is usually omitted since the length is understood to be 2 or 4. When the length indicators are absent, the fields will be aligned on either halfword or fullword boundaries. (A halfword boundary is an address that is evenly divisible by 2, while fullword boundaries are evenly divisible by 4.) In order to align a field properly, the assembler may generate from 1 to 3 unused bytes called slack bytes. Consider the example below. We assume that field X is located at address x1000 and that the addresses of the bytes are shown inside each byte.

 

LOCATION

 

1000 X DS CL1

1004 Y DS F

 

 

 

It is possible to code a length for fullword and halfword binary fields. Specifically, we may code FL4 and HL2. When a length is indicated, slack bytes will not be generated. Consider the following example which is similar to the example above, but generates no slack bytes.

 

LOCATION

 

1000 X DS CL1

1004 Y DS FL4

 

 

 

 

Fullword and halfword alignment can also be obtained with another technique: Coding a 0 duplication factor forces proper alignment for the succeeding field. For instance, the following example forces FIELDA to be fullword aligned.

 

DS 0F

FIELDA DS ...

 

Some Typical DSs and DCs:

J DS F A fullword field, properly aligned

K DS H A halfword field, properly aligned

L DS FL4 A fullword field, no slack bytes generated

M DS HL2 A halfword field, no slack bytes generated

N DC F2147483647 Maximum size of a binary fullword =

231 - 1

O DC H32767 Maximum size of a binary halfword =

215 - 1

P DC F-2147483648 Minimum size of a binary fullword =

-231 - 1

Q DC H-32768 Minimum size of a binary halfword =

-215 - 1

R DC F0 A fullword containing a zero

S DC H40000 Error - constant too large

DS 0F Provide fullword alignment for the

subsequent field

DS 0H Provide halfword alignment for the

subsequent field

T DC H20 T = x0014

U DC F-20 U = xFFFFFFEC - 2s complement integer

V DC H92 V = x005C

1. Remember that halfword fields are fairly small - between 32767 and -32768. Dont select a halfword if you think your results may exceed these values.

 

2. When defining fields in an input or output buffer, fullword and halfword fields are not usually aligned in order to conserve space on a file. Remember to code the length indicator in these cases.