Formatting COBOL code elements

Use the Formatter preference to specify preferences for formatting code in the editor. The Preview section on the right shows the effect of the preferences.

Before you begin

For a video demonstration of the COBOL formatter, see COBOL Code Formatter.
Restriction: Indentation formatting is not available when you edit EBCDIC DBCS code.

Procedure

  1. In the Preferences window, click COBOL > Editor > Formatter. The Formatter page opens.
  2. On the Formatter page, expand the sections to see available options.
    Data Division: Choose indentation options for the Data Division.
    • Enable indentation of record descriptions is enabled by default. Specify integer values for Start of Area A and Indent length.
    • Align PICTURE Clauses controls whether PICTURE clauses are aligned in data element declarations.
    • Align VALUE Clauses controls whether VALUE clauses are aligned in data element declarations.
    Procedure Division: Choose indentation options for the Procedure Division.
    • Enable indentation of procedure division is enabled by default. Specify integer values for Start of Area A and Start of Area B.
    • Indent multi-line statements controls whether nonblock statements that span multiple lines are indented. Specify an integer from 0 to 10 for Multi-line indent length.
    • Align lists controls whether lists within COBOL statements that span multiple lines are aligned.
    • Align TO clauses: controls alignment of TO clauses. When this option is selected, the Align INTO clauses options is enabled so that you can select it also. To specify the column to align the clauses with, type a column number into the Align TO clauses into column field.
    • Indent EXEC blocks and Indent END-EXEC phrase control the indentation of EXEC statements.
    • Fixed length or Custom length and the associated length options control block statement indentation.

    Line Length: Specify a column to use as the right margin when the formatter aligns code, and how the formatter behaves for code around the right margin. If indentation moves code beyond Area B, the default Wrap to the next line option moves statement tokens beyond the right margin to the next line.

    Capitalization Styles: Choose the type of capitalization to apply to language elements in the editor. For the following elements, you can select uppercase, lowercase, mixed case, or none:
    • Reserved words
    • User-defined words
    • Comments
    • Functions
    • Date formats
    • Compiler directives

    Copybook Capitalization Styles: Choose the type of capitalization to apply to copybook code or comments in a copybook file. Select uppercase, lowercase, mixed case, or none.

  3. Click Apply to save your changes.