COBOL Formatter preferences

When creating or editing a formatting profile, the following options are the ones that you can set in the profile.

These preferences are available from the Window > Preferences > Micro Focus > COBOL > Code Style > Formatter page.

General

Base indent
Change the default base indentation.
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.
Align inline comments
Aligns inline comments (starting with *>) to the indent column of the code block.
Preserve end of line comments
Preserves the end of line comments when you format the code.
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. (Only available when Fixed is selected.)
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
Select this for formatting to move the values of any keywords to a new line.

Environment Division

Ensure new line after paragraph in configuration section
Select this to ensure that a carriage return is inserted after each paragraph heading in the Environment section.

Data Division

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

Top Level Data Items
Specify an indent for the top level group items. Set the Level Number indent relative to the start of the code area, and the Name indent relative to the start of the level number in the declaration.
Child Data Items
Specify the indent offset for child items. Set the Level Number indent and Name indent relative to the column where the parent item or the parent name starts.
Align data item clauses
Specify how data item clauses should be aligned:
  • Off - no alignment formatting is performed.
  • 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:

Argument alignment
Specifies the alignment of arguments in a list if they are wrapped over multiple lines. Adjacent positions the argument on the wrapped line directly underneath the previous argument, and By continuation indent positions the argument as per the settings for Indent for wrapped statements.
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
Select this for the format command to remove any trailing line whitespace.
Align TO keywords
Select this to align any TO keywords of neighbouring statements. Applies only if Format statement whitespace is enabled.
Align signature parameters & arguments
Select this to align any parameters following a USING, RETURNING, or a GIVING statement. Applies only if Format statement whitespace is enabled.

Additional options are available that help when selecting the preferences:

  • Show original code - toggle this option to see how the edited values compare against the original formatting, as shown in the Preview pane.
  • Source format - specify a source format for which you want to preview your formatting settings; this setting is only applicable to the preview.
  • Restore Defaults - reset all settings to their previously saved values.