Start of change

INLINE

The INLINE directive lets you selectively prevent the compiler from considering procedures eligible for inlining. Specifying >>INLINE OFF prevents the compiler from inlining procedures referenced by PERFORM statements. If the NOINLINE compiler option is in effect, all INLINE directives are ignored. The relative location of an INLINE directive to the definition of a procedure name is important for determining the inlining behavior for that procedure.

Format

Read syntax diagramSkip visual syntax diagramFormat>>INLINE ONOFF
Read syntax diagramSkip visual syntax diagram>>INLINE ONOFF
ON
Start of changeSpecifies that the compiler determines if the procedures within the scope of the directive are inlined in a specific PERFORM statement when OPTIMIZE(1) or OPTIMIZE(2) is in effect. End of change
OFF
Start of changeSpecifies that procedures within the scope of the directive will not be inlined when referenced by PERFORM statements, no matter which optimization level setting is in effect.End of change
Note: Start of changeThe word inlining here implies that the compiler might choose to replace the PERFORM of a procedure (paragraph or section) that is performed more than once with a copy of that procedure's code. By inserting the procedure code at the location of the PERFORM, the compiler saves the overhead of branching logic to and from the procedure. Note that if a procedure is only performed once, the compiler might move the code for that procedure to the PERFORM site, even with >>INLINE OFF.End of change
Start of change

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:
  • Within a COPY or REPLACE statement
  • Between the lines of a continued character string
  • 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.
End of change
Start of change

Inlining eligibility of procedures for PERFORM statements

A procedure is "in the scope of" a particular INLINE directive when:
  • This INLINE directive appears before the definition of the procedure name
    • and
  • There are no other intervening INLINE directives between the definition of the procedure name and this particular INLINE directive
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

For a section that contains paragraphs, it is possible that this section is under the scope of one INLINE directive while some of its paragraphs are under the scope of another INLINE directive.

End of change

Example

Following is 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.
Notes:
  1. Procedure MY-SUBROUTINE will be eligible for inlining in any statements that PERFORM it.
  2. Procedure MY-PARAGRAPH-ONE will be eligible for inlining in any statements that PERFORM it.
  3. Procedure MY-PARAGRAPH-TWO will not be eligible for inlining in any statements that PERFORM it.
  4. Procedure MY-PARAGRAPH-THREE will not be eligible for inlining in any statements that PERFORM it.
  5. Procedures MY-PARAGRAPH-ONE through MY-PARAGRAPH-THREE will be eligible for inlining in any statements that PERFORM "MY-PARAGRAPH-ONE THRU MY-PARAGRAPH-THREE", because MY-PARAGRAPH-ONE is eligible for inlining in a PERFORM statement.

Start of change

related references  
INLINE compiler option (Enterprise COBOL Programming Guide)  
End of change

End of change