IBM Support

PI77981: COMPILER DIRECTIVE AND OPTION TO CONTROL INLINING

A fix is available

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as new function.

Error description

  • Part of cobol's optimization strategies is inlining of
    performed sections/paragraphs. This strategy fails to provide
    any benefit at execution time for certain programming styles,
    where the mainline code contains many performs to error
    checking routines, e.q. many SQL followed by Perform to common
    check routine:
    
    EXEC SQL ... END-EXEC
    If SQLCODE Not = 0 Perform 999-Check-SQLCODE End-If
    
    Another often used style is to Perform into a Section, which
    logs some error condition and eventually calls a common abend
    sub program to terminate the enclave.
    
    When such Performs are heavily coded in a program, the
    compilation with optimize(1|2) yields to a big increase of the
    code size (and the compilation time) while decreasing the
    efficiency of the code because the inlined code is very seldom
    executed at execution time and only pollutes the instruction
    cache.
    
    Adding Cobol Compiler Directive Statements to guide Cobol's
    optimization and increase execution efficiency of compiled
    cobol programs.
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED: Users of Enterprise COBOL who want to        *
    *                 exercise more control over the compiler      *
    *                 optimization process, specifically the       *
    *                 inlining of procedures (paragraphs or        *
    *                 sections) referenced by PERFORM              *
    *                 statements.                                  *
    *                                                              *
    ****************************************************************
    * PROBLEM DESCRIPTION: Part of COBOL's optimization strategy   *
    *                      is the inlining of performed sections   *
    *                      and paragraphs (procedures).  This      *
    *                      strategy fails to provide any benefit   *
    *                      at execution time for certain           *
    *                      programming styles, where the mainline  *
    *                      code contains many performs to error    *
    *                      checking routines, i.e. many SQL        *
    *                      statements followed by a PERFORM of a   *
    *                      common error checking routine:          *
    *                                                              *
    *                                                              *
    *                      EXEC SQL ...  END-EXEC                  *
    *                                                              *
    *                      If SQLCODE Not = 0                      *
    *                       PERFORM 999-Check-SQLCODE              *
    *                      End-If                                  *
    *                                                              *
    *                      Another often used style is to PERFORM  *
    *                      into a section which logs some error    *
    *                      condition and eventually calls a common *
    *                      ABEND sub program to terminate the      *
    *                      enclave.                                *
    *                                                              *
    *                      When such PERFORMs are heavily coded in *
    *                      a program, compilation with compiler    *
    *                      option OPT(1) or OPT(2) can lead to     *
    *                      a big increase in the resulting program *
    *                      size (and increase in compilation time) *
    *                      while decreasing the efficiency of the  *
    *                      program because the inlined code is     *
    *                      very seldom executed at run time but    *
    *                      has the negative side effect of         *
    *                      invalidating the instruction cache.     *
    *                                                              *
    ****************************************************************
    * RECOMMENDATION: Install the provided PTFs and use the        *
    *                 newly provided INLINE options and            *
    *                 >>INLINE directives, as appropriate.         *
    *                                                              *
    ****************************************************************
    New inlining compiler options and inlining directives are
    provided to guide COBOL's inlining optimization process.
    behavior when the COBOL program was migrated from COBOL V4 to
    For consistency with existing Enterprise COBOL options, a new
    compiler option INLINE|NOINLINE has been added.  If the
    INLINE option is in effect at compile time, it's scope will
    be the entire COBOL program, unless it is overridden by the
    inlining directives.  It only allows the optimizer to choose
    whether or not to inline procedures (performed paragraphs or
    sections).  If the NOINLINE option is in effect at compile
    time, no inlining will occur and all >>INLINE directives will
    be ignored.
    
    The syntax for the inlining option is as follows:
    
       .-INLINE---.
    >>-+----------+--------------------------------------------><
       '-NOINLINE-'
    
    
    New compiler directives have also been added to the Enterprise
    COBOL compiler to control inlining.  They have been
    implemented as a begin/end style of bracketing, similar to the
    existing CALLINTERFACE directive.
    
    The syntax for the inlining directives is as follows:
    
       >--->>INLINE----+--ON---+-------------------------------->
                       |       |
                       '--OFF--'
    
    Note:  The INLINE directive can appear multiple times in the
    program, but it can only be specified in the PROCEDURE
    DIVISION.
    

Problem conclusion

Temporary fix

Comments

  • The new inlining option and inlining directives will provide
    the compiler user with more control over the optimizer during
    the inlining phase of optimization.  It is only effective when
    either OPTIMIZE(1) or OPTIMIZE(2) are specified as compiler
    options.
    
    1. Programming Guide -> Debugging- > Getting listings ->
    Reading LIST output-> Signature information bytes
    
    Table 54. Signature information bytes (continued)
    
    --------------------------------------------------------------
    |Offset in decimal     |Signature byte |Bit    |Item         |
    --------------------------------------------------------------
    |30                    | 23            | 0     | COPY        |
    --------------------------------------------------------------
    |                      |               | 1     | BASIS       |
    --------------------------------------------------------------
    |                      |               | 2     | DBCS name in|
    |                      |               |       | program     |
    --------------------------------------------------------------
    |                      |               | 3     | Shift-out   |
    |                      |               |       | and Shift-in|
    |                      |               |       | in program  |
    --------------------------------------------------------------
    |                      |               | 4     | SUPPRESS    |
    |                      |               |       | NOSUPRESS   |
    --------------------------------------------------------------
    |                      |               | 5     | SSRANGE ZLEN|
    --------------------------------------------------------------
    |                      |               | 6     | SSRANGE ABD |
    --------------------------------------------------------------
    |                      |               | 7     | INLINE      |
    |                      |               |       | NOINLINE    |
    --------------------------------------------------------------
    
    2. Language Reference -> Compiler Directives -> INLINE
    
    Use the INLINE directive to instruct the compiler to inline
    procedures referenced by PERFORM statements in the source
    program.  If the NOINLINE option is in effect at compile time,
    then INLINE directives are ignored.
    
       >--->>INLINE----+--ON---+--------------------------------->
                       |       |
                       '--OFF--'
    
    ON
    
    If OPTIMIZE(1) or OPTIMIZE(2) is in effect, inlining of
    procedures referenced by PERFORM statements is allowed.  The
    decision to inline procedures in a specific PERFORM block is
    made by the compiler.
    
    OFF
    
    Regardless of the optimization level setting in effect, no
    inlining of PERFORM procedures will occur.
    
    
    Syntax and general rules
    
    You must specify >>INLINE ON or >>INLINE OFF on a line by
    itself, in either Area A or Area B.
    
    You cannot specify >>INLINE ON or >>INLINE OFF in the following
    cases:
    
      1. Within a COPY or REPLACE statement
      2. Between the lines of a continued character string
      3. In the middle of a COBOL statement
    
    The >>INLINE ON or >>INLINE OFF specification is limited to the
    current compilation unit.
    
    Note:  The INLINE directive can appear multiple times in the
    program and will be implemented as a begin/end type of
    bracketing.
    
    
    Inlining eligibility of procedures for PERFORM statements:
    
    A procedure is "in the scope of" an INLINE directive if the
    INLINE directive appears in the program before the definition
    of the procedure name and there are no other intervening INLINE
    directives between the definition of the procedure name and the
    INLINE directive in question.1
    
    A procedure is eligible for inlining for statements of the form
    "PERFORM procedure-name-1  THROUGH procedure-name-2 " if and
    only if:
    
      the procedure is in the scope of an INLINE ON directive; or
    
      The INLINE compiler option is in effect and the procedure is
      not in the scope of an INLINE OFF directive.
    
    Notes:
    
    1. For sections that are contain paragraphs, it is possible for
    the section to be under the scope of one INLINE directive while
    one or more of its paragraphs are under the scope of a
    different INLINE directive.
    
    An example of the effect of the INLINING directive on a SECTION
    that is comprised of one or more paragraphs:
    
    >>INLINE ON
    MY-SUBROUTINE    SECTION.
    MY-PARAGRAPH-ONE.
    :
    >>INLINE OFF
    MY-PARAGRAPH-TWO.
    :
    MY-PARAGRAPH-THREE.
    :
        EXIT.
    
    1. Procedure MY-SUBROUTINE will be eligible for inlining in the
    statement "PERFORM MY-SUBROUTINE".
    
    2. Procedure MY-PARAGRAPH-ONE will be eligible for inlining in
    the statement "PERFORM MY-PARAGRAPH-ONE".
    
    3. Procedure MY-PARAGRAPH-TWO will not be eligible for inlining
    in the statement "PERFORM MY-PARAGRAPH-TWO".
    
    4. Procedure MY-PARAGRAPH-THREE will not be eligible for
    inlining in the statement "PER-FORM MY-PARAGRAPH-THREE".
    
    5. Procedures MY-PARAGRAPH-ONE through MY-PARAGRAPH-THREE will
    be eligible for inlin-ing in the statement "PERFORM
    MY-PARAGRAPH-ONE THRU MY-PARAGRAPH-THREE" since
    MY-PARAGRAPH-ONE is eligible for inlining in a PERFORM
    statement.
    
    
    3. Programming Guide -> Compiling and debugging your program
    -> Compiler Options -> INLINE
    
    Use the NOINLINE option to prevent the compiler from inlining
    procedures (paragraphs or sections) referenced by PERFORM
    statements in the source program.
    
    INLINE option syntax
    
       .-INLINE---.
    >>-+----------+---------------------------------------------><
       '-NOINLINE-'
    
    
    Default is: INLINE
    
    Abbreviations are: INL|NOINL
    
    INLINE
    If OPTIMIZE(1) or OPTIMIZE(2) is in effect, inlining of
    procedures referenced by PERFORM statements is allowed.  The
    decision to inline procedures in a specific PERFORM block is
    made by the compiler.  This decision can be overridden by use
    of the >>INLINE OFF compiler directive.
    
    NOINLINE
    Regardless of the optimization level setting in effect, no
    inlining of PERFORM procedures will occur.  This decision
    cannot be overridden by use of the >>INLINE ON directive.
    
    
    4. Enterprise COBOL Customization Guide -> Enterprise COBOL
    compiler Options
    
    Use the INLINE=YES option to allow the compiler to inline
    procedures (paragraphs or sections) referenced by PERFORM
    statements in the source program.
    
    INLINE option syntax
    
                          '-NO--'
      >>--INLINE=--+---+--+-YES-+------------------------------><
                   '-*-'
    
    Default
    INLINE=YES
    
    Yes
    When OPTIMIZE(1) or OPTIMIZE(2) are in effect, the compiler may
    choose to inline procedures referenced by PERFORM statements in
    the source program.
    
    No
    The compiler is prevented from inlining procedures referenced
    by PERFORM statements in the source program.
    

APAR Information

  • APAR number

    PI77981

  • Reported component name

    ENT COBOL FOR Z

  • Reported component ID

    5655EC600

  • Reported release

    610

  • Status

    CLOSED UR1

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    YesSpecatt / New Function / Xsystem

  • Submitted date

    2017-03-10

  • Closed date

    2017-04-25

  • Last modified date

    2017-05-01

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Modules/Macros

  •    IGYCRCTL
    

Publications Referenced
SC27871200    

Fix information

  • Fixed component name

    ENT COBOL FOR Z

  • Fixed component ID

    5655EC600

Applicable component levels

  • R610 PSY UI46711

       UP17/04/29 P F704

Fix is available

  • Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SS6SG3","label":"Enterprise COBOL for z\/OS"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"6.1","Edition":"","Line of Business":{"code":"LOB70","label":"Z TPS"}}]

Document Information

Modified date:
05 September 2024