Indenting Structured Operations

Note: Calculations can only be indented if they are written with traditional syntax. The RPG compiler does not change the indentation of your free-form calculations (between /FREE and /END-FREE) in the listing. You may indent the free-form claculations directly in your source file.

If your source specifications contain structured operations (such as DO-END or IF-ELSE-END), you may want to have these indented in the source listing. The INDENT parameter lets you specify whether to show indentation, and specify the character to mark the indentation. If you do not want indentation, specify INDENT(*NONE); this is the default. If you do want indentation, then specify up to two characters to mark the indentation.

For example, to specify that you want structured operations to be indented and marked with a vertical bar (|) followed by a space, you specify INDENT('| ').

If you request indentation, then some of the information which normally appears in the source listing is removed, so as to allow for the indentation. The following columns will not appear in the listing:
  • Do Num
  • Last Update
  • PAGE/LINE

If you specify indentation and you also specify a listing debug view, the indentation will not appear in the debug view.

Figure 1 shows part of source listing which was produced with indentation. The indentation mark is '| '.

Figure 1. Sample Source Part of the Listing with Indentation
Line   <--------------------- Source Specifications ----------------------------------------------><---- Comments ----> Src Seq
Number ....1....+....2....+<-------- 26 - 35 -------->....4....+....5....+....6....+....7....+....8....+....9....+...10 Id  Number
    33 C********************************************************************                                                002000
    34 C*    MAINLINE                                                      *                                                002100
    35 C********************************************************************                                                002200
    36 C                   WRITE                      FOOT1                                                                 002300
    37 C                   WRITE                      HEAD                                                                  002400
    38 C                   EXFMT                      PROMPT                                                                002500
    39 C*                                                                                                                   002600
    40 C                   DOW                        NOT *IN03                                                             002700
    41 C     CSTKEY        | SETLL                    CMLREC2                            ----20                             002800
    42 C                   | IF                       *IN20                                                                 002900
    43 C                   | | MOVE                   '1'           *IN61                                                   003000
    44 C                   | ELSE                                                                                           003100
    45 C                   | | EXSR                   SFLPRC                                                                003200
    46 C                   | END                                                                                            003300
    47 C                   | IF                       NOT *IN03                                                             003400
    48 C                   | | IF                     *IN04                                                                 003500
    49 C                   | | | IF                   *IN61                                                                 003600
    50 C                   | | | | WRITE              FOOT1                                                                 003700
    51 C                   | | | | WRITE              HEAD                                                                  003800
    52 C                   | | | ENDIF                                                                                      003900
    53 C                   | | | EXFMT                PROMPT                                                                004000
    54 C                   | | ENDIF                                                                                        004100
    55 C                   | ENDIF                                                                                          004200
    56 C                   ENDDO                                                                                            004300
    57 C*                                                                                                                   004500
    58 C                   SETON                                                         LR----                             004600