Description

The SYNCH macro allows a program to take a synchronous exit to a processing program. After the processing program has finished, the program that issued the SYNCH macro regains control. The SYNCH macro is intended for use by primary mode programs only. If your program is in access register (AR) mode, use SYNCHX, which provides the same function as SYNCH.

Descriptions of the SYNCH and SYNCHX macro in this information are:
Note: The SYNCH and SYNCHX macros have the same environment specifications, register information, programming requirements, restrictions and limitations, performance implications, and return and reason codes described below, except where noted in the explanation for SYNCHX.

Environment

The requirements for the caller are:

Environmental factor Requirement
Minimum authorization: Problem state and any PSW key.
Dispatchable unit mode: Task
Cross memory mode: PASN=HASN=SASN
AMODE: 24- or 31-bit for SYNCH; 24- or 31- or 64-bit for SYNCHX.
ASC mode: Primary
Interrupt Status: Enabled for I/O and external interrupts
Locks: No locks held
Control parameters: Must be in the primary address space.

Programming requirements

None.

Restrictions

None.

Input register information

Before issuing the SYNCH(X) macro, the caller does not have to place any information into any register unless using it in register notation for a particular parameter, or using it as a base register.

Output register information

When control returns to the caller, the GPRs contain:
Register
Contents
0-1
Values the processing program placed there before it returned to the caller
2-13
If RESTORE=YES, unchanged; if RESTORE=NO, values the processing program placed there before it returned to the caller
14
Used as a work register by the system
15
Value the processing program placed there before it returned to the caller

Some callers depend on register contents remaining the same before and after issuing a service. If the system changes the contents of registers on which the caller depends, the caller must save them before issuing the service, and restore them after the system returns control.

Performance implications

None.

Syntax

The standard form of the SYNCH macro is written as follows:

Syntax Description
   
   name name: Symbol. Begin name in column 1.
   
One or more blanks must precede SYNCH.
   
SYNCH  
   
One or more blanks must follow SYNCH.
   
entry point addr entry point addr: RX-type address, or register (2) - (12) or (15).
   
   ,RESTORE=NO Default: RESTORE=NO
   ,RESTORE=YES  
   
   ,AMODE=24 Default: AMODE=CALLER.
   ,AMODE=31 Note: AMODE=DEFINED can be specified only
   ,AMODE=DEFINED if the entry point address is provided in
   ,AMODE=CALLER a register.
   

Parameters

The parameters are explained as follows:

entry point addr
Specifies the address of the entry point of the processing program to receive control.
,RESTORE=NO
,RESTORE=YES
Specifies whether registers 2-13 are to be restored when control returns to the caller.
,AMODE=24
,AMODE=31
,AMODE=DEFINED
,AMODE=CALLER
Specifies the addressing mode in which the requested program is to receive control.

If AMODE=24 is specified, the requested program will receive control in 24-bit addressing mode.

If AMODE=31 is specified, the requested program will receive control in 31-bit addressing mode.

If AMODE=DEFINED is specified, the user must provide the entry point using a register and not an RX-type address. The requested program will receive control in the addressing mode indicated by the high order bit of the entry point address. If the bit is set to 0, the requested program will receive control in 24-bit addressing mode; if the bit is set to 1, the requested program will receive control in 31-bit addressing mode.

If AMODE=CALLER is specified, the requested program will receive control in the addressing mode of the caller.

Return and reason codes

None.

Example 1

Take a synchronous exit to PROGRAMA. Do not restore registers 2-13 when control returns.
LOAD   EP=PROGRAMA,DCB=LIB1     Load desired program
LR     R8,R0                    Obtain the entry point
SYNCH  (R8),RESTORE=NO

Example 2

Take a synchronous exit to a program labeled SUBRTN and restore registers 2-13 when control returns.
SYNCH  SUBRTN,RESTORE=YES

Example 3

Take a synchronous exit to the program located at the address given in register 8 and restore registers 2-13 when control returns. Indicate that this program is to execute in 24-bit addressing mode.
SYNCH (8),RESTORE=YES,AMODE=24

Example 4

Take a synchronous exit to the program located at the address given in register 8 and restore registers 2-13 when control returns. Indicate that this program is to receive control in the addressing mode defined by the high-order bit of its entry point address.
SYNCH (8),RESTORE=YES,AMODE=DEFINED

Example 5

Take a synchronous exit to the program located at the address given in register 8 and restore registers 2-13 when control returns. Indicate that this program is to receive control in the addressing mode as the caller.
SYNCH (8),RESTORE=YES,AMODE=CALLER