I thought of a better solution, perhaps a bit clearer (and telling the
assembler exactly what you want it to do):
Leave your mainline USING as it is, covering the entire module. Leave your
LA,exitname instructions as they are.
At the end of all mainline code and subroutines and private data:
END_OF_MAIN_CODE_AND_CONSTANTS DS 0H
After each label EXITX that starts an exit, code:
DROP R11
USING (EXITX_START,EXITX_END),R12
USING (MAIN_CSECT_NAME,END_OF_MAIN_CODE_AND_CONSTANTS),R11
At the end of each EXITX routine, code:
EXITX_END DS 0H
DROP R12
Now you are telling the assembler exactly which register to use for which
labels in the program.
Peter
From: IBM Mainframe Assembler List <[email protected]> On Behalf
Of Farley, Peter
Sent: Wednesday, November 8, 2023 5:57 PM
To: [email protected]
Subject: Re: Internal Exit Routine Handling
Oops, Tony is correct – you can use LARL even if the exit labels are outside of
the mainline USING I suggested. That’s a much better solution than my adcon
suggestion. If you decide to use my USING suggestions then change your LA’s to
LARL’s
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
ZjQcmQRYFpfptBannerEnd
Oops, Tony is correct – you can use LARL even if the exit labels are outside of
the mainline USING I suggested.
That’s a much better solution than my adcon suggestion. If you decide to use
my USING suggestions then change your LA’s to LARL’s for the exit addresses.
Peter
From: IBM Mainframe Assembler List
<[email protected]<mailto:[email protected]>> On
Behalf Of Tony Harminc
Sent: Wednesday, November 8, 2023 5:25 PM
To: [email protected]<mailto:[email protected]>
Subject: Re: Internal Exit Routine Handling
On Wed, 8 Nov 2023 at 17:13, Farley, Peter <
[email protected]<mailto:[email protected]>>
wrote:
> The “why” of using adcons instead of direct instruction reference with my
> suggested USING setup:
>
> Because the mainline USING that I suggested limits the use of R11 to just
> the mainline code and data, the labels on your exit routines are not
> addressable using R11 since they are outside of that range of addresses.
>
> Loading an A(exitname) constant means the assembler can resolve the adcon
> value to “offset from start of code” because it knows where that name is in
> the object code, but it won’t let you use that name directly in LA or LAY
> because there is no base register that covers the area where the exit name
> is coded. Then the loader can fully resolve the adcon value at program
> load time because the ESD entry is “CSECT start + offset”.
>
In the case where the routines are in the same assembly/CSECT, but don't
have addressibility via a register, LARL is your friend. For that matter
LARL is generally useful in all sorts of such cases. For example, where you
have a main routine and some sort of exits or callbacks that don't get
passed the original base register value, in old-style coding you might need
something like:
BALR Rx,EXIT
USING EXIT,Rx
L Rn,=A(MAIN)
USING MAIN,Rn
to establish a base. Now you can use
LARL Rn,MAIN
USING MAIN,Rn
to get the main base back.
Tony H.
--
This message and any attachments are intended only for the use of the addressee
and may contain information that is privileged and confidential. If the reader
of the message is not the intended recipient or an authorized representative of
the intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication
in error, please notify us immediately by e-mail and delete the message and any
attachments from your system.
This message and any attachments are intended only for the use of the addressee
and may contain information that is privileged and confidential. If the reader
of the message is not the intended recipient or an authorized representative of
the intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication
in error, please notify us immediately by e-mail and delete the message and any
attachments from your system.