On Fri, Mar 17, 2017 at 12:29 PM, Farley, Peter x23353 <
[email protected]> wrote:

> I cannot see a way to do the following, so any enlightenment you can
> provide is appreciated.
>
> I have created new versions of an existing set of macros and the new
> versions require a fairly large set of non-reentrant data areas defined in
> the CSECT in which they are used.  The first macro invoked (say, MACINIT)
> needs to define these areas in existing assembler programs that may or may
> not be close to exceeding their defined base registers.  This is old,
> non-reentrant code that has not been converted to "baseless" mode, and
> doing that conversion now is not on the table due to time and resource
> constraints.
>
> Rather than defining the new data areas at the place where MACINIT is
> invoked (there is code as well as data in MACINIT, and the code has to be
> positioned near the start of the program), I would like to be able to have
> MACINIT place all of the new data areas AFTER all other data or code
> defined in the CSECT.
>
> All of the new data areas are referred to in the new macro versions by
> "relative long" instructions in the generated code, so they will work
> correctly even if the data areas are totally outside of the defined base
> register coverage areas.
>
> I have looked at the LOCCTR assembler instruction thinking that it might
> be a way to accomplish what I want to do, but I am not really clear on how
> to use it, or even if that is a way for me to do what I want to do.
>
> So far the only way to accomplish this that I can see is to have a
> separate "MACDATA" macro to be manually inserted into the old code at the
> appropriate position.  I would prefer an automated solution that does not
> require a new "data" macro, if at all possible.
>
> TIA for any help you can provide.
>
> Peter
>


​I think that LOCTR is definitely the way to go. You MACINIT has two parts
to it: the code part and the data part. The relative positions of the
"contents" of the various LOCTRs are in the relative definition sequence.
The initial LOCTR has the same name as your
START/CSECT/DSECT/RSECT/CATTR/COM (whichever you're doing). ​So your
MACINIT could look (for use in a CSECT):

        MACRO
&LBL    MACINIT ...
&HOLD   SETC    '&SYSLOC' SAVE CURRENT LOCTR NAME
&LBL    DS       0H
        LARL     R??,MACINIT_DATA SELECT UNUSED REGISTER
        USING    MACINIT_DATA,R?? ADDRESS DATA
... SOME MORE CODE
MACINIT LOCTR    , DATA LOCATION
... DEFINE DATA
&HOLD   LOCTR    , RESUME PREVIOUS LOCATION
... MORE CODE
MACINIT LOCTR    , RESUME DATA LOCATION
.... MORE DATA
&HOLD   LOCTR    , RESUME PREVIOUS LOCATION
        DROP     R?? FORGET MAPPING
     ​   MEND

​At the end of your code, before any DSECTs or other such things:

... END OF CODE
MACINIT LOCTR  , FINISH UP MACINIT DATA
... REGULAR DATA FOR MACINIT USE, IF ANY
&SYSECT LOCTR , RESUME CSECT LOCTR
... DSECT DEFINITIONS, ET AL.
     END ​


​Now, the stuff generated while the MACINIT LOCTR was in effect will go
after all the code / data defined at the CSECT level LOCTR. If you don't
use any other LOCTRs in your code, this means it will be at the _end_ of
the CSECT. You can access the MACINIT data via register R??, which is
loaded each time in the MACINIT via the LARL (Load Address Relative Long).


-- 
"Irrigation of the land with seawater desalinated by fusion power is
ancient. It's called 'rain'." -- Michael McClary, in alt.fusion

Maranatha! <><
John McKown

Reply via email to