ILE C/C++ Programmer's Guide


Changing Optimization Levels

Optimizing an object means looking at the compiled code, determining what can be done to make the run-time performance as fast as possible, and making the necessary changes. In general, the higher the optimizing request, the longer it takes to create an object. At run time, the highly optimized program or service program should run faster than the corresponding non-optimized program or service program.

Example:

This example shows you how to change the optimization level of module T1520IC4 from *FULL to *NONE to allow variables to be displayed and changed when the program is in debug mode. Once debug is complete, you can change the optimization level back to *FULL for improved run-time performance.

  1. Enter WRKMOD MODULE(T1520IC1). The Work with Modules display is shown.
  2. Select option 5 (Display) to see the attribute values that need to be changed. The Display Module Information display is shown:
    +--------------------------------------------------------------------------------+
    
    | Display Module Information | |
    Module . . . . . . . . . . . . : T1520IC1 | |
    Library . . . . . . . . . . : MYLIB | |
    Detail . . . . . . . . . . . . : *BASIC | |
    Module attribute . . . . . . . : CLE | |
    Module information: | |
    Module creation date/time . . . . . . . . . . . . . . : 93/09/93 12:00:00| |
    Source file . . . . . . . . . . . . . . . . . . . . . : QACSRC | |
    Library . . . . . . . . . . . . . . . . . . . . . . : MYLIB | |
    Source member . . . . . . . . . . . . . . . . . . . . : T1520IC1 | |
    Source file change date/time . . . . . . . . . . . . : 93/08/18 13:31:40| |
    Owner . . . . . . . . . . . . . . . . . . . . . . . . : SMITH | |
    Coded character set identifier . . . . . . . . . . . : 65535 | |
    Text description . . . . . . . . . . . . . . . . . . : | |
    Creation data . . . . . . . . . . . . . . . . . . . . : *YES | |
    Intermediate language data . . . . . . . . . . . . . : *NO | |
    More... | |
    Press Enter to continue. | |
    F3=Exit F12=Cancel | +--------------------------------------------------------------------------------+

    Note:
    In the display shown above, the Creation data value is *YES. This means that the module can be translated again once the optimization level value is changed. If the value is *NO, you must compile the module again in order to change the optimization level.
  3. Press the Roll Down key to see more information for the module as shown:
    +--------------------------------------------------------------------------------+
    
    | Display Module Information | |
    Module . . . . . . . . . . . . : T1520IC4 | |
    Library . . . . . . . . . . : MYLIB | |
    Detail . . . . . . . . . . . . : *BASIC | |
    Module attribute . . . . . . . : CLE | |
    Sort sequence table . . . . . . . . . . . . . . . . . : *HEX | |
    Language identifier . . . . . . . . . . . . . . . . . : *JOBRUN | |
    Optimization level . . . . . . . . . . . . . . . . . : *NONE | |
    Maximum optimization level . . . . . . . . . . . . . : *FULL | |
    Debug data . . . . . . . . . . . . . . . . . . . . . : *YES | |
    Compressed . . . . . . . . . . . . . . . . . . . . . : *NO | |
    Program entry procedure name . . . . . . . . . . . . : _C_pep | |
    Number of parameters . . . . . . . . . . . . . . . . : 0 255 | |
    Module state . . . . . . . . . . . . . . . . . . . . : *USER | |
    Module domain . . . . . . . . . . . . . . . . . . . . : *SYSTEM | |
    Number of exported defined symbols . . . . . . . . . : 1 | |
    Number of imported (unresolved) symbols . . . . . . . : 10 | |
    Press Enter to continue. | |
    More... | |
    F3=Exit F12=Cancel | +--------------------------------------------------------------------------------+
  4. Check the Maximum Optimization Level value. It may already be at the level you desire. If the module has the creation data, and you want to change the optimization level, press F12 (Cancel). The Work with Modules display is shown.
  5. Select option 2 (Change) for the module whose optimization level you want to change. The CHGMOD command prompt is shown.
  6. Type over the value specified for the field Optimize Module. Changing the module to a lower level of optimization allows you to display, and possibly change, the value of variables while debugging. The following command can be used to lower the optimization level to *NONE on the command prompt but it will NOT be put in the job log.

    CHGMOD MODULE(MYLIB/T1520IC4) OPTIMIZE(*NONE)
  7. Do steps 2 through 6 again for any additional modules you may want to change. Whether you are changing one module or several in the same ILE program, the program creation time is the same because all imports are resolved when the system encounters them.
    Note:
    Imports can be left unresolved using the *UNRSLVREF parameter of the CRTPGM command.
  8. Create the program again using the CRTPGM command.


[ Top of Page | Previous Page | Next Page | Table of Contents ]