The reason for the L in CEETERM is because you can do CEETERM 
RC=VARNAME,MODIFIER=MODNAME where VARNAME and MODNAME are fullword areas.

In general, in z/OS, you should __never__ use R0 (impossible actually), R1, 
R14, or R15 for a CSECT/RSECT base register. Many (most) IBM macros use these 
registers. And occassionally other registers as well.

For LE enabled assembler (I have written some), when I use a base register at 
all (not often any more), I use R11 for my first, then R10, R9, and so as as 
the module grows in size. In "modern" programming, you can avoid the use of a 
"base register" for code in almost every case by using relative instructions 
instead of based instructions. E.g. use LARL instead of LA for areas in the 
CSECT, and Jxx instead of Bxx for branching. If you load constant values, try 
to use LHI if possible. Do try to write reentrant code. If you do that, you can 
keep the modifiable values in the DSA, which is addressed by R13 and which is 
set up for you with the CEEENTRY and CEEDSA macros. For a constant which does 
not fit into a halfword, or maybe is packed decimal or characters, you can 
replace somethin like: L R7,FULLWORD with 2 instructions: LARL R7,FULLWORD 
followed by L R7,0(,R7), and the same with packed and characters. OK, that is a 
bit ugly, I admit.


--
John McKown
Systems Engineer IV
IT

Administrative Services Group

HealthMarkets®

9151 Boulevard 26 . N. Richland Hills . TX 76010
(817) 255-3225 phone .
[email protected] . www.HealthMarkets.com

Confidentiality Notice: This e-mail message may contain confidential or 
proprietary information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. 
HealthMarkets® is the brand name for products underwritten and issued by the 
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance 
Company®, Mid-West National Life Insurance Company of TennesseeSM and The MEGA 
Life and Health Insurance Company.SM

> -----Original Message-----
> From: IBM Mainframe Assembler List
> [mailto:[email protected]] On Behalf Of Frank Swarbrick
> Sent: Tuesday, June 12, 2012 3:25 PM
> To: [email protected]
> Subject: CEETERM and register 15
>
> First off please realize that I'm an assembler beginner.
> I've fiddled with it here and there for 15 years, but I'm
> really just a COBOL programmer.  So please be gentle!  :-)
>
> We have a vendor written, code supplied, subroutine that does
> for us a few things that COBOL can't (bit fiddling; posting
> of an ECB; etc.).  This same exact routine is called both by
> batch COBOL program and CICS COBOL programs.  It is not
> reentrant.  In order to make it reentrant I have been working
> on "LE-enabling" it.  This seems to work quite well!  But I
> ran in to something "weird" with CEETERM.  CEETERM RC=0
> generates the following:
>
> 58F0 F098            013A0  1827+         L   15,=A(0)
>
> 5800 F098            013A0  1828+         L   0,=A(0)
> 58DD 0004            00004  1829+         L   13,4(13)
> 58E0 D00C            0000C  1830+         L   14,12(,13)
> 981C D018            00018  1831+         LM  1,12,24(13)
> 07FE                        1832+         BR  14
>
> Problem?  The program uses register 15 as the base register.
> Funny thing is that the code actually "works".  But it really
> doesn't. The first L sets R15 to 0.  Then the second L loads
> in to R0 from 152(,R15), but of course R15 is now 0, not the
> real base address it needs to be.  It's only coincidence that
> 152 bytes in to low core contains x'00000000'.  If I tried to
> use an RC of some other value it would still be set to 0.
>
>
> I changed the program to use 14 instead of 15 for the base
> register and all is now fine.  But I don't see it documented
> that CEETERM should not be used when the base is R15.  Or is
> it just common practice to not use R15 as the base?  Other
> than this one program I don't see that R15 is generally used
> for that purpose even though it starts out with the correct
> address, which is probably why it was used in this case.
> Specifically, the original code was this:
> SUBR     CSECT
>
>          USING *,RF
>          B     START
>          DC    CL8'SUBR'
> START    DS    0H
>          SAVE  (14,12)
>
> Anyway, I have to wonder why CEETERM doesn't take a page from
> the RETURN macro, and use LA from an offset into "R0", i.e.,
> if I had CEETERM RC=12,MODIFIER=8, we'd get something like this:
>
> LA  15,12(0)
> LA  0,8(0)
> L   13,4(13)
> L   14,12(,13)
> LM  1,12,24(13)
> BR  14
>
> No base register needed, correct?  (This is one of those
> cases where "register 0" is really just "zero", right, no
> matter what value it actually holds?)
>
>
> (Apologies to Russ Evans, if he is reading this, for taking
> an unexpected side trip to LE land.)
>
> Hope I've not shown too much ignorance.
>
>
> Thanks!
> Frank
>
>
>

Reply via email to