HLASM Language Reference
HLASM Language Reference HLASM Language Reference
ORG Instruction If you specify multiple location counters with the LOCTR instruction, the ORG instruction can alter only the location counter in use when the instruction appears. Thus, you cannot control the structure of the whole control section using ORG, but only the part that is controlled by the current location counter. An ORG statement cannot be used to change sections or LOCTR segments. For example: AA CSECT X DS D Y DS F BB CSECT ORG Y is invalid, because the section containing the ORG statement (BB) is not the same as the section in AA in which the ORG operand expression Y is defined. With the ORG statement, you can give two instructions the same location counter values. In such a case, the second instruction does not always eliminate the effects of the first instruction. Consider the following example: ADDR DC A(ADDR) ORG –4 B DC C'BETA' In this example, the value of B ('BETA') is destroyed by the relocation of ADDR during linkage editing. | The following example shows some examples of ORG using the boundary and | offset operands: | origin csect | ds 235x Define 235 bytes | org origin,,3 Move location counter back to start + 3 | org ,8 Align on 8 byte boundary | org ,8,-2 Align to 8 byte boundary -2 bytes | translate dc cl256' ' Define aligned translate table | org translate+c'a' | dc c'ABCDEFGHI' | org translate+c'j' | dc c'JKLMNOPQR' | org translate+c's' | dc c'STUVWXYZ' | org translate+c'A' | dc c'ABCDEFGHI' | org translate+c'J' | dc c'JKLMNOPQR' | org translate+c'S' | dc c'STUVWXYZ' | org , | end Using Figure 57 on page 203 as an example, to build a translate table (for example, to convert EBCDIC character code into some other internal code): 1. Define the table (see ▌1▐ in Figure 57) as being filled with zeros. 2. Use the ORG instruction to alter the location counter so that its counter value indicates a specific location (see ▌2▐ in Figure 57) within the table. 202 HLASM V1R5 Language Reference
ORG Instruction 3. Redefine the data (see ▌3▐ in Figure 57) to be assembled into that location. 4. After repeating the first three steps (see ▌4▐ in Figure 57) until your translate table is complete, use an ORG instruction with a null operand field to alter the location counter. The counter value then indicates the next available location (see ▌5▐ in Figure 57) in the current control section (after the end of the translate table). Both the assembled object code for the whole table filled with zeros, and the object code for the portions of the table you redefined, are printed in the program listings. However, the data defined later is loaded over the previously defined zeros and becomes part of your object program, instead of the zeros. That is, the ORG instruction can cause the location counter to be set to any part of a control section, even the middle of an instruction, into which you can assemble data. It can also cause the location counter to be set to the next available location so that your program can be assembled sequentially. Source Module │ Object Code ─────────────────────────────────────────────────────┼──────────────────────── │ FIRST START │ . │ . │ ▌1▐ TABLE DC XL256'' │ TABLE (in Hex) ▌2▐ ORG TABLE+ │ + ┌────┐ ┌ DC C'' ▌3▐ │ │ F │ │ DC C'1' │ │ F1 │ │ . │ │ . │ │ . │ │ . │ │ ORG TABLE+13 │ +13 │ . │ │ DC C'D' │ │ C4 │ │ DC C'E' │ │ C5 │ │ . │ │ . │ │ . │ │ . │ ▌4▐ ─┤ ORG TABLE+C'D' │ │ . │ │ DC AL1(13) │ +196 │ 13 │ │ DC AL1(14) │ │ 14 │ │ . │ │ . │ │ . │ │ . │ │ ORG TABLE+C'' │ +24 │ . │ │ DC AL1() │ │ │ │ DC AL1(1) │ │ 1 │ │ . │ │ │ └ . │ +255 └────┘ ORG │ ▌5▐ GOON DS H │ ▲ . │ TABLE+256 . │ TR INPUT,TABLE │ . │ . │ INPUT DS CL2 │ . │ Figure 57. Building a Translate Table . │ END │ Chapter 5. Assembler Instruction Statements 203
- 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 196 and 197: DS Instruction The size of a storag
- 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 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
- Page 246 and 247: USING Instruction In this MVC instr
- Page 248 and 249: USING Instruction Range of a Depend
- Page 250 and 251: XATTR Instruction external_symbol i
- Page 252 and 253: XATTR Instruction SCOPE ►►─
- Page 254 and 255: XATTR Instruction 234 HLASM V1R5 La
- Page 256 and 257: Part 3. Macro Language &SYSDATC Sys
- Page 258 and 259: Introduction to Macro Language Chap
- Page 260 and 261: Introduction to Macro Language The
- Page 262 and 263: Introduction to Macro Language Macr
- Page 264 and 265: MACRO and MEND Statements The assem
- Page 266 and 267: Prototype Statement Macros that are
- Page 268 and 269: Model Statements generated from tha
- Page 270 and 271: Model Statements ▌5▐ ▌6▐
ORG Instruction<br />
If you specify multiple location counters with the LOCTR instruction, the ORG<br />
instruction can alter only the location counter in use when the instruction appears.<br />
Thus, you cannot control the structure of the whole control section using ORG, but<br />
only the part that is controlled by the current location counter.<br />
An ORG statement cannot be used to change sections or LOCTR segments. For<br />
example:<br />
AA<br />
CSECT<br />
X DS D<br />
Y DS F<br />
BB<br />
CSECT<br />
ORG Y<br />
is invalid, because the section containing the ORG statement (BB) is not the same<br />
as the section in AA in which the ORG operand expression Y is defined.<br />
With the ORG statement, you can give two instructions the same location counter<br />
values. In such a case, the second instruction does not always eliminate the<br />
effects of the first instruction. Consider the following example:<br />
ADDR DC A(ADDR)<br />
ORG –4<br />
B DC C'BETA'<br />
In this example, the value of B ('BETA') is destroyed by the relocation of ADDR<br />
during linkage editing.<br />
| The following example shows some examples of ORG using the boundary and<br />
| offset operands:<br />
| origin csect<br />
| ds 235x Define 235 bytes<br />
| org origin,,3 Move location counter back to start + 3<br />
| org ,8 Align on 8 byte boundary<br />
| org ,8,-2 Align to 8 byte boundary -2 bytes<br />
| translate dc cl256' ' Define aligned translate table<br />
| org translate+c'a'<br />
| dc c'ABCDEFGHI'<br />
| org translate+c'j'<br />
| dc c'JKLMNOPQR'<br />
| org translate+c's'<br />
| dc c'STUVWXYZ'<br />
| org translate+c'A'<br />
| dc c'ABCDEFGHI'<br />
| org translate+c'J'<br />
| dc c'JKLMNOPQR'<br />
| org translate+c'S'<br />
| dc c'STUVWXYZ'<br />
| org ,<br />
| end<br />
Using Figure 57 on page 203 as an example, to build a translate table (for<br />
example, to convert EBCDIC character code into some other internal code):<br />
1. Define the table (see ▌1▐ in Figure 57) as being filled with zeros.<br />
2. Use the ORG instruction to alter the location counter so that its counter value<br />
indicates a specific location (see ▌2▐ in Figure 57) within the table.<br />
202 <strong>HLASM</strong> V1R5 <strong>Language</strong> <strong>Reference</strong>