Dependent addressing lets you minimize the number of base registers required to refer to data by making greater use of established addressability. For example, you may want to describe the format of a table of data defined in your source module with a dummy control section (see Dummy control sections). To refer to the data in the table using the symbols defined in the dummy section, you need to establish the addressability of the dummy section. To do this you must:
However, dependent addressing offers an alternative means of establishing addressability of the dummy section.
When you have established addressability of the control section in which the table is defined, you can establish addressability of the dummy section by simply coding a USING statement which specifies the name of the dummy section and the address of the table. When you subsequently refer to the symbols in the dummy section, the assembler makes use of the already established addressability of the control section when converting the symbolic addresses into their base-displacement form.
For example, suppose addressability has been established for a control section containing a data structure that is mapped by a dummy control section:
DATAMAP DSECT , DSECT describing data structure
FIELD1 DS F
FIELD2 DS CL32
FIELD3 DS CL24
- - -
CODE CSECT , Program code
BASR 12,0 Set base register
USING *,12 Provide addressability
- - -
USING DATAMAP,REALDATA Map DSECT onto REALDATA
L 2,FIELD1 Register 12 is base register
LA 3,FIELD3 Address of DATA3
- - -
REALDATA DS 0F Data mapped by DATAMAP
DATA1 DC F'32'
DATA2 DC CL32'Actual Data'
DATA3 DC CL24'Additional Data'
[ Top of Page | Previous Page | Next Page | Contents | Index ]