Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Macro calls in simultaneously open syntax file hierarchies

&pagelevel(3)&pagelevel

With the aid of the OPNCALL macro, user programs open a syntax file hierarchy parallel to the syntax file hierarchy which was opened for the user task during LOGON processing. Parallel to the work context created by SDF for the user task, a new work context is thus created.

The new context is opened by the program and is used to analyze subsequent inputs. The context is closed again with the CLSCALL macro or when the program is terminated.

The contexts opened by the OPNCALL macro are therefore called “program contexts”. The user program determines the syntax file hierarchy. The context created by SDF when the user task is started is called the “system context”. This context uses the system administration defaults stored in the SDF parameter file.

  • The system context is used by the command processor to read and analyze commands before they are executed by the command processor. The syntax file hierarchy and the SDF options are processed as described (see "Syntax files and their processing with SDF-A"). The identifier of the system context in the various macros is the default NULL address.

  • The program context can be used by a program to read and analyze its statements before execution. The syntax file hierarchy is defined by the user program with OPNCALL for the level of the system and group syntax file(s). The SDF options can be modified locally within the program context by means of MODIFY-SDF-OPTIONS. The identifier of the program context is returned by the OPNCALL macro and is used by subsequent macro calls in this context.

The command processor can in no case execute a command that is being processed in a program context. It is not possible to create a program context with the CMD macro.

With the OPNCALL macro, a user program can

  • compile commands (i.e. analyze them without executing them)

  • read, compile or correct statements

  • retrieve information

in or from the program contexts.

The program context has the following characteristics:

  • The system syntax files may either be the current system syntax files of the system context of the user task, or the OPNCALL macro can specify explicitly that another basic system syntax file is to be opened. If system administration switches the current system syntax files of the system context dynamically with MODIFY-SDF-PARAMETERS, then this change also applies, after the next transaction, to the program context which has used the system syntax files in question.

  • The group syntax file may either be the current group syntax file of the system context of the user task or be specified explicitly with the OPNCALL macro. It cannot be switched in the generated program context.

  • The user syntax file is the current user syntax file of the user task. It is valid both for the system context and for the program context and can be dynamically switched using the MODIFY-SDF-OPTIONS command or statement. MODIFY-SDF-OPTIONS is read by CMDRST or, in the buffer, by CMDTST (EXECUTE=*YES).

  • If user-defined syntax files are opened in the program context, SDF standard statements from the program context are used. SDF takes standard statements which are not available in the program context out of the $CMDPGM program defined in the basic system syntax file in the system context.

Changes to the user syntax file and to the options in the program context have no effect on the system context. A user program may open up 255 contexts, including the system context, at any one time.

The following SDF macros may be used in a program context or may process a program context:

  • OPNCALL:
    creates the new context and determines the group and system syntax files to be activated. The identifier of the program context is returned to the user program in the form of a return code. This identifier is determined for each call which is processed in a program context.

  • CMDTST, CMDRST, CMDCST and CMDSTA:
    the identifier of the program context is determined whenever work is carried out in the context.

  • CLSCALL:
    closes the program context. If no CLSCALL is issued, all program contexts are released when the program is terminated.

Notes on the programming context

The program context provides a new SDF working environment with its own input and syntax memories. For this reason, the following points must be noted:

  • If blocked input is used for a list of statements, the input has only a local effect on the current context. Blocked input for CMDRST in a program context cannot call another context.

  • Blocked input of statements may also include records. These can then be read with RDATA (SYSFILE) after CMDRST, but only in the system context:

    RDATA (SYSFILE) can only read records from the terminal buffer of the system context. RDATA should therefore not be called after CMDRST in the program context.

  • The EOF condition for statement input and the spin-off mechanism work only in the context in which the statements are read.

  • The statements are not compiled in the environment of the current user task (CMDTST). The user must specify the simulated user task type (batch or dialog task) in the OPNCALL macro and the simulated procedure mode (procedure or primary) in the CMDTST macro.
    The default is that CMDTST does not need to check the user task type or the procedure mode when checking the input. CMDRST reads the statements in the environment of the current user task.

CHKPT and RESTART-PROGRAM for program contexts

After a checkpoint of a program in the program context, the following behavior of the reopened hierarchies must be expected after RESTART-PROGRAM:

  • If no special system syntax file was defined for the program context at the time of the CHKPT (see OPNCALL SFSYSTM=*STD), then the system syntax file of the current system context is used after the restart.
    If a special system syntax file was defined, then this file is reopened.

  • If no special group syntax file was defined for the program context at the time of the CHKPT (see OPNCALL SFGROUP=*STD), then the group syntax file of the current system context which is assigned to the current profile ID is used after the restart.If a special group syntax file was defined, then this file is reopened.

  • The user syntax files which were open at the time of the checkpoint are reopened after the restart.

After RESTART-PROGRAM, the contexts are reconstructed as if the system syntax file had been modified dynamically by system administration.