Formatting your program

To improve the appearance and readability of your source code, you can set format specifications. When you set format specifications, you can enter your code without concern about the format and then use the Format action in the editor to format the code according to the specifications.

Before you begin

Define format specifications on the Formatter preference page. For instructions, see the related topics.
Restriction:
  • You cannot format a source file after running a preprocessor.
  • Indentation formatting is not available when you edit EBCDIC DBCS code.

Procedure

  1. To format an entire source file, right-click in the editor and click Source > Format.
    When you choose to format an entire file in the COBOL and PL/I editors, the editor warns you that the format operation can take a few minutes and gives you the option of canceling the format operation.
  2. To format a selected block of code:
    1. Select the lines of code that you want to format.
      Note: If you press Ctrl+A to select all lines, formatting occurs without warning. If you are editing a large file, the format operation can take a few minutes.
    2. Right-click in the editor and click Source > Format.