I suggest you learn how to use LOCTR. It's a much simpler method than using
=S(xxxx) and certainly more readable. I'm not recommending in the way LOCTR was
used with DATA / CODE example although that is certainly one way.
My programs have the following in the program start macro (after the csect is
generated). &CSECT contains the CSECT name since &SYSECT and &SYSLOC are not set
when the CSECT is generated in the macro that generated the CSECT.
#EX LOCTR , Execute instructions inserted with this location
counter
DS 0H Instructions must be halfword aligned
&CSECT LOCTR , Back to program
If you use the DATA / CODE method, then you will want this just before the CODE
LOCTR. I'm not suggesting you use this method but just in case you do.
Here is a sample call to my #EX macro below
#EX R2,'MVC SOURCE(0),DEST'
and it generates (length is checked where length was calculated)
BCTR R2,0 Length relative to 0
EX R2,#EX_xxx Execute the instruction
LA R2,1(R2) Restore length (does not modify CC)
#EX LOCTR ,
#EX_xxx MVC SOURCE(0),DEST
MYPGM LOCTR , Back to program
Hope this helps, Jon.
.******************************************************************
.* Desc: Execute instruction
.*
.* Copyright: 2010-2012 Jon Perryman
.*
.* Function:
.* Makes the length relative to 0 and executes the
.* specified instruction using the specified length.
.* The register is restored back to a length relative
.* to 1.
.*
.* Change log:
.* 2/12/2010 JPP Created
.******************************************************************
MACRO ,
&LABEL #EX &RELATIVE=1 Specify 0 if reg already rel=0
AIF ('&LABEL' EQ '').NOLABEL
&LABEL EQU *
.NOLABEL ANOP *
AIF ('&RELATIVE' EQ '0').LEN_OK1
BCTR &SYSLIST(1),0 Relative to 0
.LEN_OK1 ANOP ,
EX &SYSLIST(1),#EX_&SYSNDX
AIF ('&RELATIVE' EQ '0').LEN_OK2
LA &SYSLIST(1),1(&SYSLIST(1)) Relative to 1
.LEN_OK2 ANOP ,
&WORK SETC DEQUOTE('&SYSLIST(2)')
&WORKN SETA INDEX('&WORK',' ')
&WORK2 SETC '&WORK'(&WORKN+1,99)
&WORK2 SETC DCVAL('&WORK2')
&WORK SETC '&WORK'(1,&WORKN-1)
#EX LOCTR , Group #EX
#EX_&SYSNDX &WORK &WORK2
&SYSLOC LOCTR , Restore location counter
MEXIT ,
MEND ,
-------------------------------------------------------------------------------------------------------------------
On Behalf Of Martin Truebner
Sent: Wednesday, June 06, 2012 11:46 AM
Subject: Re: Base registers