Activating the Optimizer Compiler

#### Search Results

Search

# Activating the Optimizer Compiler

To activate the Natural Optimizer Compiler (NOC), use one of the methods described in the following sections. The methods are listed from most static to most dynamic.

Before you activate the Natural Optimizer Compiler, you must have a valid license file for the NOC installed. Trying to activate the NOC without a valid license file results in warnings or errors at session start. In addition, the NOC is switched off (MCG=OFF) if the license key does not allow to use the NOC. For information about the steps for installing the Natural Optimizer Compiler on z/OS, see Installing Natural Optimizer Compiler on z/OS.

- Macro NTOPT

- Dynamic Profile Parameter OPT

- System Command NOCOPT

- Natural Statement OPTIONS

All alternatives use the Optimizer options as described in the section Optimizer Options. Using these options you can control how and when machine code is generated, what tracing options are to be used and what the target architecture will be. The Optimizer options are the only control mechanism for the Natural Optimizer Compiler.

## Macro NTOPT

With the macro `NTOPT` in the Natural parameter module, you can activate the Natural Optimizer Compiler statically for a linked Natural nucleus. Every time this Natural nucleus is started, the same Optimizer options are used again.

#### Example 1:

             NTOPT 'INDX,OVFLW,ZD=OFF'

#### Example 2:

             NTOPT 'INDX,OVFLW,ZD=OFF,TRGPT',                              *
                   'TRSTMT,OPTLEV03'

Note the continuation character "*" in column 72.

See the section Optimizer Options for an explanation of the options setting used.

## Dynamic Profile Parameter OPT

When starting a Natural session, you can dynamically activate the Optimizer Compiler by specifying the Natural profile parameter `OPT`. As a synonym for `OPT`, you can use `MCG`. The specification of the parameter module is overwritten. The options are only valid for the current session.

#### Example:

    OPT=(INDX,OVFLW,ZD=OFF)

or

    MCG=(INDX,OVFLW,ZD=OFF)

See the section Optimizer Options for an explanation of the option setting used.

## System Command NOCOPT

When you have started a Natural session, you can invoke the Optimizer command screen with the Natural system command `NOCOPT`. The screen monitors the current setting of the Natural Optimizer Compiler options as they were specified during Natural startup. You can now modify the setting online.

The updated parameter setting is only valid for the current session.

## Natural Statement OPTIONS

The `MCG` parameter of the Natural compiler statement `OPTIONS` provides the most flexible and powerful control over machine code generation, since different options can be set for individual statements in a program. So, within one Natural program, the Natural Optimizer Compiler can be activated and deactivated several times to enclose ranges of statements with different options settings.

#### Example

    OPTIONS MCG=(OVFLW,INDX,ZD=OFF)

or

    OPTIONS MCG=OVFLW,INDX,ZD=OFF

The options string of the `MCG` parameter may start with a plus (+) or minus (-) sign, indicating that the values of options not mentioned should be left unaltered, and only the options present should be set (+) or reset (-), for example:

#### Example:

        OPTIONS MCG=+PGEN         /* turns tracing on

       (statements to be traced)

      OPTIONS MCG=-PGEN         /* turns tracing off

If the string starts with anything other than "+" or "-", all options are reset before the string is parsed.

Note
The Natural statement `OPTIONS` also provides other Natural compiler parameters than `MCG`.

See the section Optimizer Options for an explanation of the options setting used.

Activation of the Optimizer Compiler with OPTIONS MCG results in error NAT7049 if the license file does not allow to use the Optimizer Compiler.

### On this page

- Macro NTOPT
- Dynamic Profile Parameter OPT
- System Command NOCOPT
- Natural Statement OPTIONS