On Fri, Mar 17, 2017 at 1:31 PM, John McKown <john.archie.mck...@gmail.com>
wrote:

> On Fri, Mar 17, 2017 at 1:22 PM, Farley, Peter x23353 <
> peter.far...@broadridge.com> wrote:
>
>> Thanks John, that does look like it would work, though it does still
>> require adding that last "MACINIT LOCCTR" statement manually at the end of
>> the program code and data.
>>
>> But if I have to manually place a statement at the end of the program
>> anyway it may as well be a MACDATA macro that just defines all the data
>> areas there.
>>
>
> Sorry I wasn't clearer. You only need the last "MACINIT LOCTR" in open
> code if you want to add _more_ data into that LOCTR. Otherwise, just leave
> it off. It is _not_ needed to "generate the data" or tell HLASM "put the
> MACINIT data here". If you only have the CSECT and the MACINIT LOCTR, then
> everything defined in the MACINIT macro will be gathered together, in the
> same relative order, and placed at the very end; after all the things (data
> & code) generated in the CSECT (i.e. the stuff outside the MACINIT macro
> and the stuff within the MACINIT macro which is after the "&HOLD LOCTR"
> instruction, but before any "MACINIT LOCTR" instruction).
>
>
​Perhaps this will help. Note that the LOCTR works the same whether in open
code or in a macro, so I'll show some open code LOCTR and then the
equivalent without a LOCTR.

MYPROG   CSECT
... some code
*WITH LOCTR
* WE START IN THE &SYSECT LOCTR, PER THE MANUAL
         LH    R1,HALFWORD
DATA     LOCTR      , POSITION TO DATA
HALFWORD DC     H'0'
&SYSECT  LOCTR      , BACK TO CODE
         LARL   R1,FULLWORD
         L      R1,0(,R1) #LOAD VALUE OF FULLWORD
DATA     LOCTR      , DATA
FULLWORD DC     F'-1'
&SYSECT  LOCTR
... more code + data
         LTORG  *
         END    MYPROG


*WITHOUT LOCTR - GENERATES SAME BYTES AS ABOVE
MYPROG   CSECT
... some code
         LH      R1,HALFWORD
         LARL    R1,FULLWORD
         L       R1,0(,R1) #LOAD VALUE OF FULLWORD
... more code + data
         LTORG   *
HALFWORD DC      H'0
FULLWORD DC      F'-1'
         END     MYPROG



-- 
"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