HLASM Language Reference

HLASM Language Reference HLASM Language Reference

faculty.cs.niu.edu
from faculty.cs.niu.edu More from this publisher
22.02.2015 Views

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

Addressing<br />

If the symbol is the name entry of a START, CSECT, or RSECT instruction in the<br />

other source module, and thus names an executable control section, it is<br />

automatically identified as an entry symbol. If the symbol represents an address in<br />

the middle of a control section, you must identify it as an entry symbol for the<br />

external source module.<br />

You can also use a combination of an EXTRN instruction to identify, and an A-type<br />

address constant to contain, the external branch address. However, the V-type<br />

address constant is more convenient because:<br />

You do not have to use an EXTRN instruction.<br />

The external symbol you specify, can be used in the name entry of any other<br />

statement in the same source program.<br />

| It will work correctly even if the program is linked as an overlay module, so long<br />

| as the reference is not to a symbol in an exclusive segment. See z/OS MVS<br />

| Program Management: User's Guide and <strong>Reference</strong>, SA22-7643 for further<br />

| information.<br />

The following example shows how you use an A-type address constant to contain<br />

the address of an external symbol that you identify in an EXTRN instruction. You<br />

cannot use the external symbol name EXMOD1 in the name entry of any other<br />

statement in the source program.<br />

.<br />

.<br />

L 15,EX_SYM Load address of external symbol<br />

BASR 14,15 Branch to it<br />

.<br />

.<br />

EX_SYM DC A(EXMOD1) Address of external symbol<br />

EXTRN EXMOD1<br />

Identify EXMOD1 as external symbol<br />

.<br />

.<br />

The following example shows how you use the symbol EXMOD1 as both the name of<br />

an external symbol and a name entry on another statement.<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 />

.<br />

.<br />

If the external symbol that represents the address to which you want to branch is to<br />

be part of an overlay-structured module, you should identify it with a V-type address<br />

constant, not with an EXTRN instruction and an A-type address constant. You can<br />

use the supervisor CALL macro instruction to branch to the address represented by<br />

the external symbol. The CALL macro instruction generates the necessary V-type<br />

address constant.<br />

70 <strong>HLASM</strong> V1R5 <strong>Language</strong> <strong>Reference</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!