LOCTR worked just the way you described, and does just what I need to do. Thanks again!
Peter -----Original Message----- From: IBM Mainframe Assembler List [mailto:[email protected]] On Behalf Of John McKown Sent: Friday, March 17, 2017 2:43 PM To: [email protected] Subject: Re: How to automatically position generated data areas after all program-defined areas On Fri, Mar 17, 2017 at 1:31 PM, John McKown <[email protected]> wrote: > On Fri, Mar 17, 2017 at 1:22 PM, Farley, Peter x23353 < > [email protected]> 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 -- 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.
