Telling the system about the execution environment

To generate code that is correct for the environment in which the program runs, some macros need to know one or more of the following characteristics about that environment:

For macros that are sensitive to their environment, use the SYSSTATE macro to define the environment. During the assembly stage, SYSSTATE sets one or more global symbols. Later, in your source code, the macro checks the global symbols and generates the correct code, which might mean avoiding using a z/Architecture® instruction or an access register. Table 1 lists MVS™ macros and identifies macros that need to know the environmental characteristics.

IBM® recommends you issue the SYSSTATE macro before you issue other macros. Once a program has issued SYSSTATE, there is no need to reissue it, unless the program switches from one AMODE to another or one ASC mode to another or has code paths that are isolated according to architecture level or operating system release. If you switch AMODE or ASC mode to a different architecture code path, issue SYSSTATE immediately after the switch to indicate the new state. In general, Start of changespecify SYSSTATE ARCHLVL=2, and switch to SYSSTATE ARCHLVL=3 before issuing macros in sections of code that only run when z/OS® 2.1 capabilities are available.End of change If you do not issue the SYSSTATE macro, the system assumes the macro is issued as follows:

Table 1 describes the relevant characteristics, the corresponding parameters on the SYSSTATE macro, and the global symbols the macro checks.

Table 1. Execution environment characteristics and corresponding SYSSTATE parameters and global symbols
Characteristic Parameter on SYSSTATE Global symbol
AMODE of 64-bit, or either 24-bit or 31-bit AMODE64=YES or NO &SYSAM64
Primary or AR ASC mode ASCENV=P or AR &SYSASCE
Architectural level of z/Architecture ARCHLVL=0, 1, 2Start of change, 3 or OSRELEnd of change &SYSALVL
Start of changeOperating system releaseEnd of change Start of changeZOSVvRrEnd of change Start of change&SYSOSRELEnd of change

You can issue the SYSSTATE macro with the TEST parameter in your own user-written macro to allow your macros to generate code appropriate for their execution environment.

Callable services do not check the global symbols described in this topic. To determine whether a callable service is sensitive to the AMODE, ASC mode, or the Architecture level, see the description of the individual callable service.

In early releases of MVS, the SPLEVEL macro performs a function similar to SYSSTATE. The SPLEVEL macro identifies the level of the operating system, so that you can tune a macro expansion based on that level. You can use this where macro expansions change incompatibly. Because SPLEVEL applies to levels that the system no longer supports, it is not described in this topic.