On Mon, Jul 11, 2016 at 3:09 PM, Steve Thompson <[email protected]> wrote:
> I am trying to determine how I am supposed to know if a COBOL program is
> AMODE=31/ANY when they call an ALC subroutine.
>
> The routine getting control has just been through an upgrade from 1979
> style of NOREUS and data mixed in with instructions.
>
> Also, this routine is not LE conforming. It has never been.
>
> I'm used to doing a BSM to return as a subroutine to have addressing modes
> match. I had assumed that the caller did BSSM not just BASR or BALR
>
> So when the program ends and returns to the caller via BSM R14, wow, you
> would not believe all the ESTAEs that get driven (including this programs
> ESTAEX). LE throws a fit and thankfully, having set up SYSMDUMP with
> DISP=MOD, I get the dump I need and IPCS ignores the second dump. ;-)
>
> So, R14 does not have the hi-order bit on when I am called.
>
> COBOL being used is Enterprise COBOL 4.2 (which is currently supported).
>
> The environment, just so we are all on the same page is JES2, z/OS 2.2,
> z13EC.
>
> Regards,
> Steve Thompson
>
> PS. I have been scanning various manuals (including the LE one) and
> nothing is said about this. And I don't have any MVS/XA or MVS/ESA manuals
> around anymore.
>
I did this long ago for a COBOL program. Excerpts below.
... save ...
MAINLINE DS 0H
L R15,=A(DO31BIT+X'80000000') JM0803
BASSM R14,R15 FORCE 31 BIT MODE JM0803
* JM0803
* THE PREVIOUS TWO INSTRUCTIONS FORCE THE CPU INTO 31 BIT MODE
* WHILE BRANCHING TO THE LABEL 'DO31BIT'.
* JM0803
DO31BIT DS 0H JM0803
ST R14,MODE SAVE CURRENT MODE JM0803
NC MODE,=X'80000000' CLEAR BITS JM0803
* JM0803
* THE BASSM INSTRUCTION PLACED THE CURRENT PSW ADDRESS INTO R14.
* THIS INCLUDES THE THEN-CURRENT ADDRESSING MODE. IF THE HIGH BIT
* OF REG 14 IS 1, THEN THE CPU WAS ALREADY IN 31 BIT MODE. IF IT
* WAS ZERO, THEN THE CPU WAS IN 24 BIT MODE. IN EITHER CASE, THE
* CPU WILL BE IN 31-BIT MODE AFTER THE BASSM.
* WE SAVE THE HIGH-BIT OF R14 SO THAT WE CAN RETURN TO THE
* ORIGINAL CALLER IN HIS ORIGINAL ADDRESSING MODE.
* JM0803
...
... code
...
... return
* LET'S GO BACK TO THE CALLER. SINCE WE MAY NEED TO CHANGE BACK
* TO 24 BIT MODE, WE CAN'T USE THE RETURN MACRO. SO LET'S JUST
* ISSUE THE INSTRUCTIONS OURSELVES. THE MAIN DIFFERENCE BELOW
* IS THE USE OF THE BSM INSTRUCTION INSTEAD OF THE BR INSTRUCTION.
* THE BSM INSTRUCTION WILL CHANGE THE MODE AS APPROPRIATE.
* JM0803
LR R1,R13 SAVE REGISTER 13 JM0803
L R13,4(,R13) GET CALLER'S R13 JM0803
L R14,12(,R13) GET RETURN ADDRESS JM0803
O R14,MODE SET ORIGINAL JM0803
* ADDRESSING MODE JM0803
LM R0,R12,20(R13) RELOAD REGISTERS JM0803
SLR R15,R15 ZERO COND CODE JM0803
OI 15(R13),X'01' SET FLAG JM0803
BSM R0,R14 RETURN TO CALLER JM0803
* WHILE SETTING THE JM0803
* ADDRESS MODE JM0803
That is directly from my code.
--
"Pessimism is a admirable quality in an engineer. Pessimistic people check
their work three times, because they're sure that something won't be right.
Optimistic people check once, trust in Solis-de to keep the ship safe, then
blow everyone up."
"I think you're mistaking the word optimistic for inept."
"They've got a similar ring to my ear."
>From "Star Nomad" by Lindsay Buroker:
Maranatha! <><
John McKown