According to the 2004 POO (SA22-7832-03), which I believe predates z9, you can:
Simulate an LA to clear the high half contents of a register with ICMH
Rx,15,=XL4(00) or NG Rx,=XL8(FFFFFFFF)
Simulate an LA to increment the count in the high half with AG
Rx,=XL8(100000000)
Simulate a BCTR to decrement the count in the high half with AG
Rx,=X(FFFFFFFF00000000)
> -----Original Message-----
> From: IBM Mainframe Assembler List [mailto:ASSEMBLER-
> [email protected]] On Behalf Of Wendell Lovewell
> Sent: Friday, October 27, 2017 4:32 PM
> To: [email protected]
> Subject: Using the High Halfs of registers
>
> Hello,
>
> I've inherited a large (31-bit) application with little documentation and
> lots and lots of
> BASRs to subprograms. I can't tell how deep the calls can go, but I've seen
> over 20 levels
> deep. I'm looking for a way to keep track of the stack level of a routine
> that doesn't add
> much code. There are standard $SAVE and $RETN macros I think I can use to
> keep track
> of the stack level.
>
> There are also a large number of $TRACE calls where I've added an IIHF
> statement in the
> macro to load a global counter (for the number of trace statements in that
> assembly--there
> are over 4000 of those in some cases). For example, IIHF R2,&ZTSEQ, where
> &ZTSEQ is
> a GLBLA incremented once each time the $TRACE macro is encountered.
>
> Sorry for all the background. What I'm looking for are "high-half" versions
> of LA and
> BCTR commands, so that the incrementing and decrementing could be done with 2
> statements per CSECT--without affecting the low halves of the register. For
> example in 31-
> bit land if R2 was always available, I could say "LA R2,1(R2)" at the start
> of the modules,
> and "BCTR R2,0" at the end. In this case reg 2 would always be the stack
> level.
>
> I'd also need to keep the application compatible with z9 (OPCODE(ZS3)) or
> later machines.
>
> Can anyone tell me if such statements exist in OPCODE(ZS3)? I can't find
> them if they are
> there.