To format COBOL source code

If Automatically format on save is selected in your formatter preferences (Window > Preferences > Micro Focus > COBOL > Code Style > Formatter), you only need to save your code from within the COBOL editor for the entire program to be formatted according to the active formatter profile. To format only the current sentence when you terminate it with a period, use the Format sentence on period option available from Window > Preferences > Micro Focus > COBOL > Editor > Typing. These methods of formatting are only applicable for formatter profiles (not code clean up profiles).

If neither of these options are selected, you must select the code to be formatted manually:

  1. Open the COBOL source file in the editor.
  2. If you want to format only a portion of the code, mark a selection in the editor.
  3. Click Source, and then click one of the following commands:
    • Format - formats either the source code currently opened in the editor or just the selection you have made, according to the active formatter profile.
    • Format with Clean Up - formats either the source code currently opened in the editor or just the selection you have made, according to both the active clean up profile and active formatter profile.
    • Format Program - this opens the Format COBOL Program dialog box which shows all the files that comprise the compile unit - source files and any dependent copybooks.
  4. If you have selected Format Program, ensure you select the program and only the copybooks you want to format, then click OK.

    The IDE formats the code according to the contents of the active formatter profile.

The active profiles are specified in Window > Preferences > Micro Focus > COBOL > Code Style > Formatter and > Clean Up.