HLASM Language Reference
HLASM Language Reference HLASM Language Reference
DS Instruction The size of a storage area that can be reserved by a DS instruction is limited only by the size of virtual storage or by the maximum value of the location counter, whichever is smaller. How to Use the DS Instruction Use the DS instruction to: Reserve storage Force alignment of the location counter so that the data that follows is on a particular storage boundary Name fields in a storage area. To Reserve Storage: If you want to take advantage of automatic boundary alignment (if the ALIGN option is specified) and implicit length calculation, you should not supply a length modifier in your operand specifications. Instead, specify a type subfield that corresponds to the type of area you need for your instructions. Using a length modifier can give you the advantage of explicitly specifying the length attribute value assigned to the label naming the area reserved. However, your areas are not aligned automatically according to their type. If you omit the nominal value in the operand, you should use a length modifier for the binary (B), character (C), graphic (G), hexadecimal (X), and decimal (P and Z) type areas; otherwise, their labels are given a length attribute value of 1 (2 for G and CU type). When you need to reserve large areas, you can use a duplication factor. However, in this case, you can only refer to the first area by its label. You can also use the character (C) and hexadecimal (X) field types to specify large areas using the length modifier. Duplication has no effect on implicit length. Although the nominal value is optional for a DS instruction, you can put it to good use by letting the assembler compute the length for areas of the B, C, G, X, and decimal (P or Z) type areas. You achieve this by specifying the general format of the nominal value that is placed in the area at execution time. If a nominal value and no length modifier are specified for a Unicode character string, the length of the storage reserved is derived by multiplying by two the number of characters specified in the nominal value (after pairing). To Force Alignment: Use the DS instruction to align the instruction or data that follows, on a specific boundary. You can align the location counter to a doubleword, a fullword, or a halfword boundary by using the correct constant type (for example, D, F, or H) and a duplication factor of zero. No space is reserved for such an instruction, yet the data that follows is aligned on the correct boundary. For example, the following statements set the location counter to the next doubleword boundary and reserve storage space for a 128-byte field (whose first byte is on a doubleword boundary). DS D AREA DS CL128 Alignment is forced whether or not the ALIGN assembler option is set. To Name Fields within an Area: Using a duplication factor of zero in a DS instruction also provides a label for an area of storage without actually reserving the area. Use DS or DC instructions to reserve storage for, and assign labels to, fields 176 HLASM V1R5 Language Reference
DS Instruction within the area. These fields can then be addressed symbolically. (Another way of accomplishing this is described in “DSECT Instruction” on page 178.) The whole area is addressable by its label. In addition, the symbolic label has the length attribute value of the whole area. Within the area, each field is addressable by its label. For example, assume that 80-character records are to be read into an area for processing and that each record has the following format: Positions 5-10 Positions 11-30 Positions 31-36 Positions 47-54 Positions 55-62 Payroll Number Employee Name Date Gross Wages Withholding Tax The following example shows how DS instructions might be used to assign a name to the record area, then define the fields of the area and allocate storage for them. The first statement names the whole area by defining the symbol RDAREA; this statement gives RDAREA a length attribute of 80 bytes, but does not reserve any storage. Similarly, the fifth statement names a 6-byte area by defining the symbol DATE; the three subsequent statements actually define the fields of DATE and allocate storage for them. The second, ninth, and last statements are used for spacing purposes and, therefore, are not named. RDAREA DS CL8 DS CL4 PAYNO DS CL6 NAME DS CL2 DATE DS CL6 DAY DS CL2 MONTH DS CL2 YEAR DS CL2 DS CL1 GROSS DS CL8 FEDTAX DS CL8 DS CL18 Additional examples of DS statements are shown below: ONE DS CL8 One 8-byte field, length attribute of 8 TWO DS 8C 8 1-byte fields, length attribute of 1 THREE DS 6F 6 fullwords, length attribute of 4 FOUR DS D 1 doubleword, length attribute of 8 FIVE DS 4H 4 halfwords, length attribute of 2 SIX DS GL8 One 8-byte field, length attribute of 8 SEVEN DS 8G 8 2-byte fields, length attribute of 2 To define four 10-byte fields and one 100-byte field, the respective DS statements might be as follows: FIELD DS 4CL1 AREA DS CL1 Although FIELD might have been specified as one 40-byte field, the preceding definition has the advantage of providing FIELD with a length attribute of 10. This would be pertinent when using FIELD as an SS machine instruction operand. Chapter 5. Assembler Instruction Statements 177
- Page 146 and 147: DC Instruction ROUTINE B GAMMA DXD
- Page 148 and 149: DC Instruction duplication_factor c
- Page 150 and 151: DC Instruction Figure 33 (Page 2 of
- Page 152 and 153: DC Instruction With EBCDIC spaces
- Page 154 and 155: DC Instruction Further information
- Page 156 and 157: DC Instruction | Symbols used in su
- Page 158 and 159: DC Instruction The length attribute
- Page 160 and 161: DC Instruction Notes: 1. Don't conf
- Page 162 and 163: DC Instruction—Character Constant
- Page 164 and 165: DC Instruction—Character Constant
- Page 166 and 167: DC Instruction—Graphic Constant r
- Page 168 and 169: DC Instruction—Fixed-Point Consta
- Page 170 and 171: DC Instruction—Fixed-Point Consta
- Page 172 and 173: DC Instruction—Decimal Constants
- Page 174 and 175: DC Instruction—Address Constants
- Page 176 and 177: DC Instruction—Address Constants
- Page 178 and 179: DC Instruction—Offset Constant re
- Page 180 and 181: DC Instruction—Length Constant Le
- Page 182 and 183: DC Instruction—Hexadecimal Floati
- Page 184 and 185: DC Instruction—Hexadecimal Floati
- Page 186 and 187: DC Instruction—Hexadecimal Floati
- Page 188 and 189: DC Instruction—Binary Floating-Po
- Page 190 and 191: DC Instruction—Binary Floating-Po
- Page 192 and 193: DROP Instruction DROP Instruction T
- Page 194 and 195: DS Instruction USING DSECTA,14 ALBL
- Page 198 and 199: DSECT Instruction DSECT Instruction
- Page 200 and 201: DXD Instruction ASEMBLY2 CSECT USIN
- Page 202 and 203: END Instruction change but no addit
- Page 204 and 205: EQU Instruction EQU Instruction The
- Page 206 and 207: EQU Instruction 5. The length attri
- Page 208 and 209: EXITCTL Instruction sequence_symbol
- Page 210 and 211: ISEQ Instruction must be greater th
- Page 212 and 213: LOCTR Instruction A CSECT , See not
- Page 214 and 215: LTORG Instruction If symbol is an o
- Page 216 and 217: MNOTE Instruction When two literals
- Page 218 and 219: OPSYN Instruction ,ERROR, SEV 1 An
- Page 220 and 221: ORG Instruction AFTER is defined in
- Page 222 and 223: ORG Instruction If you specify mult
- Page 224 and 225: POP Instruction POP Instruction The
- Page 226 and 227: PRINT Instruction Note: If the next
- Page 228 and 229: Process Statement Process Statement
- Page 230 and 231: REPRO Instruction NOPRINT instructs
- Page 232 and 233: RSECT Instruction 4. AMODE or RMODE
- Page 234 and 235: START Instruction START Instruction
- Page 236 and 237: TITLE Instruction The name value is
- Page 238 and 239: USING Instruction Only the characte
- Page 240 and 241: USING Instruction Base Registers fo
- Page 242 and 243: USING Instruction If register 0 is
- Page 244 and 245: USING Instruction A variable symbo
DS Instruction<br />
The size of a storage area that can be reserved by a DS instruction is limited only<br />
by the size of virtual storage or by the maximum value of the location counter,<br />
whichever is smaller.<br />
How to Use the DS Instruction<br />
Use the DS instruction to:<br />
Reserve storage<br />
Force alignment of the location counter so that the data that follows is on a<br />
particular storage boundary<br />
Name fields in a storage area.<br />
To Reserve Storage: If you want to take advantage of automatic boundary<br />
alignment (if the ALIGN option is specified) and implicit length calculation, you<br />
should not supply a length modifier in your operand specifications. Instead, specify<br />
a type subfield that corresponds to the type of area you need for your instructions.<br />
Using a length modifier can give you the advantage of explicitly specifying the<br />
length attribute value assigned to the label naming the area reserved. However,<br />
your areas are not aligned automatically according to their type. If you omit the<br />
nominal value in the operand, you should use a length modifier for the binary (B),<br />
character (C), graphic (G), hexadecimal (X), and decimal (P and Z) type areas;<br />
otherwise, their labels are given a length attribute value of 1 (2 for G and CU type).<br />
When you need to reserve large areas, you can use a duplication factor. However,<br />
in this case, you can only refer to the first area by its label. You can also use the<br />
character (C) and hexadecimal (X) field types to specify large areas using the<br />
length modifier. Duplication has no effect on implicit length.<br />
Although the nominal value is optional for a DS instruction, you can put it to good<br />
use by letting the assembler compute the length for areas of the B, C, G, X, and<br />
decimal (P or Z) type areas. You achieve this by specifying the general format of<br />
the nominal value that is placed in the area at execution time.<br />
If a nominal value and no length modifier are specified for a Unicode character<br />
string, the length of the storage reserved is derived by multiplying by two the<br />
number of characters specified in the nominal value (after pairing).<br />
To Force Alignment: Use the DS instruction to align the instruction or data that<br />
follows, on a specific boundary. You can align the location counter to a<br />
doubleword, a fullword, or a halfword boundary by using the correct constant type<br />
(for example, D, F, or H) and a duplication factor of zero. No space is reserved for<br />
such an instruction, yet the data that follows is aligned on the correct boundary.<br />
For example, the following statements set the location counter to the next<br />
doubleword boundary and reserve storage space for a 128-byte field (whose first<br />
byte is on a doubleword boundary).<br />
DS<br />
D<br />
AREA DS CL128<br />
Alignment is forced whether or not the ALIGN assembler option is set.<br />
To Name Fields within an Area: Using a duplication factor of zero in a DS<br />
instruction also provides a label for an area of storage without actually reserving the<br />
area. Use DS or DC instructions to reserve storage for, and assign labels to, fields<br />
176 <strong>HLASM</strong> V1R5 <strong>Language</strong> <strong>Reference</strong>