COBOL Formatter preferences

You configure the behavior of the COBOL formatting functionality from Window > Preferences > Micro Focus > COBOL > Editor > Formatter.

Use the controls at the bottom of this preference page, below the Preview pane, to:

General

Automatically format on save
Check this if you want Visual COBOL to format your code every time you save your changes in the editor.
Preserve left margin
Preserve the text in the left margin when multiple lines are merged into one during formatting.

In the following example, formatting is about to merge the following two lines that both have some text in the margin:

123456 copy "Copybook1.cpy"
654321 .

With this setting enabled, the text in the margin for the line which moves is preserved:

123456 copy "Copybook1.cpy".
654321 
Right margin on line insert (source format fixed only)
Specify your preferences for the right margin when a new line is inserted in a fixed source format code:
  • Keep - the margin text is preserved and remains on the same line.
  • Duplicate - the margin text is copied to the margin of any new line.
  • Move down - the margin text will move to the margin of the last line of the statement.
Directive alignment
Specify your preferences for aligning Compiler directives in the code:
  • None - do not align the directives.
  • Fixed - align the directives to a fixed column.
  • Indicator area - align directives to the indicator area.
  • Alignment column - specify the column to which directives should be aligned.
Wrap at column (source format free/variable only):
Specify the column at which you want the free or variable source code to wrap.

Identification Division

Keyword & value on separate lines
Check this for formatting to move the values of any keywords to a new line.

Data Division

Specify your preferences for formatting some of the elements within the Data Division:

Indent top level items
Specify an indent for the top level group items relative to the start of the code area for the specific source format.
Indent child level items
Specify the indent offset for child items from the column where the parent item starts.
Indent data item names
Specify the indent of the data item names from the start of the level number in the declaration.
Align data item clauses
Specify how data item clauses should be aligned:
  • Fixed - specify the column in which the data item clause should start.
  • Match siblings - align sibling data item clauses.

Procedure Division

Specify your preferences for formatting some of the elements within the Procedure Division:

Indent size
Specify the indent for COBOL verbs relative to the writing area.
Indent for wrapped statements
Specify the indent of the next line of a wrapped statement relative to the start of the statement.
Nested indent reference
Specify the indent of the content of multi-line statements:
  • Continuation indent - the contents starts in the same column as the statement.
  • Start of container - the contents starts in the same column as the wrapped lines of the multi-line statement, which is determined by the Indent for wrapped statements.
Position of period
Specify your preferences for the position of periods:
Fixed - specify the column where periods should be positioned.
Match previous line - align periods to the same start position as the previous line.
End of statement - position periods at the end of the statement.
EVALUATE
Configure the indentation for EVALUATE statements:
Indent WHEN labels
Specify the indent of WHEN clauses and contents relative to the EVALUATE statement.
Indent WHEN contents
Specify the indent for the contents of WHEN clauses relative to the WHEN label.
Whitespace options
Specify your preferences for managing whitespace and for aligning keywords and data items.
Format statement whitespace
Check this for the format command to remove any trailing line whitespace.
Align TO keywords
Check this to align any TO keywords of neighbouring statements. Applies only if Format statement whitespace is enabled.
Align signature parameters & arguments
Check this to align any parameters following a USING, RETURNING, or a GIVING statement. Applies only if Format statement whitespace is enabled.