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
The program doesn't use any macros other than the CEE ones I just added and ABEND. But I'll see if I can find a free register other than 14 (or 15 or 0 or 1!). It's pretty much used every other register at some point in the program, but hopefully I can get around that.
I've been reading about "baseless" programming and all new code I've added uses it, but at this point it don't want to make too many changes to it. So is your suggestion to use RC=RETCODE,MODIFIER=MOD and have those two as part of my automatic storage area? Actually, if I do that I can probably get away (for now) with leaving it using R15, since those fields will be based on R13.
I will try this out. Thanks for your help!!!!
Frank
>________________________________
> From: "McKown, John" <John....@healthmarkets.com>
>To: ASSEMBL...@LISTSERV.UGA.EDU
>Sent: Tuesday, June 12, 2012 2:53 PM
>Subject: Re: CEETERM and register 15
btw, did you know your posts and showing up twice? For me, anyway.
Frank
>________________________________
> From: "McKown, John" <John....@healthmarkets.com>
>To: ASSEMBL...@LISTSERV.UGA.EDU
>Sent: Tuesday, June 12, 2012 3:39 PM
I'm not sure how to set my "reply-to" in Yahoo mail. I haven't head that I have this issue on other listservs, though. Hmmm...
Frank
>________________________________
> From: Steve Comstock <st...@trainersfriend.com>
>To: ASSEMBL...@LISTSERV.UGA.EDU
>Sent: Tuesday, June 12, 2012 3:40 PM
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
>________________________________
> From: Tom Marchant <m42tom-...@YAHOO.COM>
>To: ASSEMBL...@LISTSERV.UGA.EDU
>Sent: Wednesday, June 13, 2012 6:54 AM
>Subject: Re: CEETERM and register 15
>