HLASM Language Reference
HLASM Language Reference HLASM Language Reference
Addressing If the symbol is the name entry of a START, CSECT, or RSECT instruction in the other source module, and thus names an executable control section, it is automatically identified as an entry symbol. If the symbol represents an address in the middle of a control section, you must identify it as an entry symbol for the external source module. You can also use a combination of an EXTRN instruction to identify, and an A-type address constant to contain, the external branch address. However, the V-type address constant is more convenient because: You do not have to use an EXTRN instruction. The external symbol you specify, can be used in the name entry of any other statement in the same source program. | It will work correctly even if the program is linked as an overlay module, so long | as the reference is not to a symbol in an exclusive segment. See z/OS MVS | Program Management: User's Guide and Reference, SA22-7643 for further | information. The following example shows how you use an A-type address constant to contain the address of an external symbol that you identify in an EXTRN instruction. You cannot use the external symbol name EXMOD1 in the name entry of any other statement in the source program. . . L 15,EX_SYM Load address of external symbol BASR 14,15 Branch to it . . EX_SYM DC A(EXMOD1) Address of external symbol EXTRN EXMOD1 Identify EXMOD1 as external symbol . . The following example shows how you use the symbol EXMOD1 as both the name of an external symbol and a name entry on another statement. . . L 15,EX_SYM Load address of external symbol BASR 14,15 Branch to it . . EXMOD1 DS H Using EXMOD1 as a name entry . . EX_SYM DC V(EXMOD1) Address of external symbol . . If the external symbol that represents the address to which you want to branch is to be part of an overlay-structured module, you should identify it with a V-type address constant, not with an EXTRN instruction and an A-type address constant. You can use the supervisor CALL macro instruction to branch to the address represented by the external symbol. The CALL macro instruction generates the necessary V-type address constant. 70 HLASM V1R5 Language Reference
Addressing | You may branch to external symbols in the same class using relative | branch instructions. | MYPROG CSECT , Define section MYPROG | CLASS_A CATTR RMODE(31) Define class CLASS_A | - - - | BRAS 14,ENTRYB Branch to external symbol | - - - | HISPROG CSECT , Define section HISPROG | CLASS_A CATTR RMODE(31) Define class CLASS_A | - - - | ENTRYB STM 14,12,12(13) Entry point referenced externally | - - - | END | You may also use a relative branch instruction to branch to an externally defined | symbol: | MYPROG CSECT , Define section MYPROG | MYCLASS CATTR RMODE(31) Define class MYCLASS | EXTRN TARGET Declare external symbol TARGET | - - - | BRAS 14,TARGET Branch to external symbol | - - - | END | A separate source module must define the entry point TARGET in class MYCLASS. | Establishing an external symbol alias You can instruct the assembler to use an alias for an external symbol in place of the external symbol itself, when it generates the object module. To do this you must code an ALIAS instruction which specifies the external symbol and the alias you want the assembler to use. The external symbol must be defined in a START, CSECT, RSECT, ENTRY, COM, DXD, external DSECT, EXTRN, or WXTRN instruction, or in a V-type address constant. The following example shows how you use the ALIAS instruction to specify an alias for the external symbol EXMOD1. . . L 15,EX_SYM Load address of external symbol BASR 14,15 Branch to it . . EXMOD1 DS H Using EXMOD1 as a name entry . . EX_SYM DC V(EXMOD1) Address of external symbol EXMOD1 ALIAS C'XMD1PGM' XMD1PGM is the real external name . . See “ALIAS Instruction” on page 109 for information about the ALIAS instruction. Chapter 3. Program Structures and Addressing 71
- Page 40 and 41: Assembler Language Coding Conventio
- Page 42 and 43: Assembler Language Structure Condit
- Page 44 and 45: Assembler Language Structure Machin
- Page 46 and 47: Assembler Language Structure Condit
- Page 48 and 49: Terms, Literals, and Expressions Te
- Page 50 and 51: Terms, Literals, and Expressions -
- Page 52 and 53: Terms, Literals, and Expressions As
- Page 54 and 55: Terms, Literals, and Expressions Se
- Page 56 and 57: Terms, Literals, and Expressions Fo
- Page 58 and 59: Terms, Literals, and Expressions I
- Page 60 and 61: Terms, Literals, and Expressions Th
- Page 62 and 63: Terms, Literals, and Expressions 1.
- Page 64 and 65: Terms, Literals, and Expressions
- Page 66 and 67: Terms, Literals, and Expressions
- Page 68 and 69: Terms, Literals, and Expressions Th
- Page 70 and 71: | Chapter 3. Program Structures and
- Page 72 and 73: Source Module A source module is co
- Page 74 and 75: The CSECT instruction can be used a
- Page 76 and 77: | in linker control statements for
- Page 78 and 79: This is not only convenient, but it
- Page 80 and 81: | SECT_A CSECT , Define section SEC
- Page 82 and 83: | For executable sections, the loca
- Page 84 and 85: Addressing | The System/390® and z
- Page 86 and 87: Addressing | Parts must always be r
- Page 88 and 89: Addressing Literal Pools ALPHA LR 3
- Page 92 and 93: Addressing External Symbol Dictiona
- Page 94 and 95: Addressing 74 HLASM V1R5 Language R
- Page 96 and 97: Part 2. Machine and Assembler Instr
- Page 98 and 99: General Instructions Chapter 4. Mac
- Page 100 and 101: Input/Output Operations For further
- Page 102 and 103: Branching with Extended Mnemonic Co
- Page 104 and 105: Symbolic Operation Codes variations
- Page 106 and 107: Operand Entries Registers You can s
- Page 108 and 109: Operand Entries “Program Structur
- Page 110 and 111: Operand Entries Format │ Coded or
- Page 112 and 113: Examples of Coded Machine Instructi
- Page 114 and 115: Examples of Coded Machine Instructi
- Page 116 and 117: Examples of Coded Machine Instructi
- Page 118 and 119: Examples of Coded Machine Instructi
- Page 120 and 121: Chapter 5. Assembler Instruction St
- Page 122 and 123: *PROCESS Statement *PROCESS Stateme
- Page 124 and 125: ACONTROL Instruction ►►──
- Page 126 and 127: ACONTROL Instruction FLAG(PAGE0) in
- Page 128 and 129: AINSERT Instruction character_strin
- Page 130 and 131: AMODE Instruction alias_string is t
- Page 132 and 133: CATTR Instruction Figure 25. AMODE/
- Page 134 and 135: CATTR Instruction | statements for
- Page 136 and 137: CCW1 Instruction data_count is an a
- Page 138 and 139: CEJECT Instruction If symbol is an
Addressing<br />
| You may branch to external symbols in the same class using relative<br />
| branch instructions.<br />
| MYPROG CSECT , Define section MYPROG<br />
| CLASS_A CATTR RMODE(31) Define class CLASS_A<br />
| - - -<br />
| BRAS 14,ENTRYB Branch to external symbol<br />
| - - -<br />
| HISPROG CSECT , Define section HISPROG<br />
| CLASS_A CATTR RMODE(31) Define class CLASS_A<br />
| - - -<br />
| ENTRYB STM 14,12,12(13) Entry point referenced externally<br />
| - - -<br />
| END<br />
| You may also use a relative branch instruction to branch to an externally defined<br />
| symbol:<br />
| MYPROG CSECT , Define section MYPROG<br />
| MYCLASS CATTR RMODE(31) Define class MYCLASS<br />
| EXTRN TARGET Declare external symbol TARGET<br />
| - - -<br />
| BRAS 14,TARGET Branch to external symbol<br />
| - - -<br />
| END<br />
| A separate source module must define the entry point TARGET in class MYCLASS.<br />
|<br />
Establishing an external symbol alias<br />
You can instruct the assembler to use an alias for an external symbol in place of<br />
the external symbol itself, when it generates the object module. To do this you<br />
must code an ALIAS instruction which specifies the external symbol and the alias<br />
you want the assembler to use. The external symbol must be defined in a START,<br />
CSECT, RSECT, ENTRY, COM, DXD, external DSECT, EXTRN, or WXTRN<br />
instruction, or in a V-type address constant.<br />
The following example shows how you use the ALIAS instruction to specify an alias<br />
for the external symbol EXMOD1.<br />
.<br />
.<br />
L 15,EX_SYM Load address of external symbol<br />
BASR 14,15 Branch to it<br />
.<br />
.<br />
EXMOD1 DS H Using EXMOD1 as a name entry<br />
.<br />
.<br />
EX_SYM DC V(EXMOD1) Address of external symbol<br />
EXMOD1 ALIAS C'XMD1PGM' XMD1PGM is the real external name<br />
.<br />
.<br />
See “ALIAS Instruction” on page 109 for information about the ALIAS instruction.<br />
Chapter 3. Program Structures and Addressing 71