Synchronous exits (SYNCH or SYNCHX macro)

In general, the SYNCH or SYNCHX macro is used when a program in supervisor state gives temporary control to a processing program routine (not necessarily running in supervisor state) where the processing program is expected to return control to the supervisor state program. The program to which control is given must be in virtual storage when the macro is issued.

When the processing program returns control, the supervisor state bit, the PSW key bits, the system mask bits, and the program mask bits of the program status word are restored to the settings they had before execution of the SYNCH or SYNCHX macro.

When a program is SYNCHed to, it will receive control with the caller's Floating Point Registers and Floating Point Control register. The S/390® linkage convention applies. For more information on the S/390 linkage convention, see "Linkage Conventions" in z/OS MVS Programming: Assembler Services Guide.

When the target program is AMODE 24 or AMODE 31, the SYNCH or SYNCHX macro is similar to the BALR in that you can use register 15 for the entry point address. When the target routine is AMODE 64, the SYNCH or SYNCHX macro is similar to LINKX or ATTACHX in that you are expected to use relative branching and register 15 contains a value that can be used to determine the addressing mode of the issuer of the SYNCH or SYNCHX macro as follows:
  • Issuer AMODE 24: X'FFFFF000'
  • Issuer AMODE 31: X'FFFFF002'
  • Issuer AMODE 64: X'FFFFF004'
Note: Start of changeFor assistance in converting a program to use relative branching, refer to the IEABRC and IEABRCX macros.End of change

SYNCH or SYNCHX processing does not save or restore registers when control is returned to the caller unless RESTORE=YES is specified. If you specify RESTORE=NO explicitly or by default, the register contents are unpredictable. When an authorized program uses SYNCH or SYNCHX to invoke an exit in an unauthorized program, the general registers returned from the exit might not contain expected data or correct addresses. Therefore, the authorized program must save the registers in a protected save area and then restore them, or validate the contents of the returned registers, or code RESTORE=YES.