Please refer to the IBM documentation, z/OS MVS Programming: Assembler Services Guide, Linkage conventions, Saving the calling program’s registers. The following is a link to the documentation for z/OS 3.1:
https://www.ibm.com/docs/en/zos/3.1.0?topic=conventions-saving-calling-programs-registers
If a user exit routine uses AMODE64 or G-type instructions, it must preserve the high halves (bits 0-31) of general registers 2-14.
User exit routines are invoked with the following attributes:
31-bit addressing mode (AMODE31)
primary space mode
TCB mode
the same PSW key that Adabas was invoked with.
Additionally, user exit routines may be invoked in either problem state or supervisor state, depending on the configuration of Adabas.
While a user exit is processing, Adabas is waiting for the user exit to return control. During that time, Adabas cannot execute any commands it is sent. User exits should not perform complex operations that require a response from some other server, such as another Adabas database. In particular, user exits must not issue commands to the Adabas server that calls them, as this would directly lead to a deadlock.
All user exits must return the same program status word (PSW) fields to the calling program that were active when the user exit was called. In particular this applies to the following:
addressing mode (AMODE)
program mask
problem state flag
PSW key
PSW key mask (PKM)
address space control setting.
The condition code need not be preserved.
If any of these PSW fields is changed by the user exit, one way to ensure that their previous values are returned is to envelope the code where the change is in effect with a pair of the BAKR ... PR instructions. If BAKR ... PR instructions are not necessary, return using BSM 0,R14 after restoring all registers except for R15.
Refer to supplied sample exit UEX12 for more details on BAKR/PR.