Rational Developer for System z

Extracting a paragraph in a COBOL program

The System z® LPEX Editor and the COBOL Editor let you extract contiguous COBOL statements into a new paragraph.

Before you begin

Before you begin, you must open a file with the System z LPEX Editor or the COBOL Editor, and the file must contain COBOL code that includes a Procedure Division.

About this task

The action is enabled based on the validity and the completeness of selected text:
Validity
Means that the action is enabled only when text is selected in the Procedure Division of the COBOL source. Furthermore, if you select a COBOL word or variable name, the action is disabled.
Completeness
Means that the selected text contains one or more valid COBOL statements. It also means that if you select a partial statement such as an IF statement or a partial PERFORM statement, the action is disabled until you extend the selection to select the complete IF or PERFORM statement.

Procedure

To extract a paragraph, complete the following steps:

  1. Select valid text and right-click. A menu is displayed.
  2. Click Refactor > Extract Paragraph. An Extract Paragraph wizard is displayed.
  3. In the Extract Paragraph wizard, perform the following tasks:
    1. Fill in the New paragraph name field.
    2. Optionally fill in the End paragraph name and Comment fields.
    3. Specify the extraction location: Closest valid location or At the end.
    4. If you want to extract the paragraph into a new section, select the Extract into a new section check box, and type the new section name, and specify the section after which the new section is to be placed.
    5. If you want to generate a list of input and output variables for the extracted paragraph, select the Generate paragraph comments check box.
    6. If you want to force a preview of the refactoring before the new paragraph is inserted, select the Force preview check box.
    7. Optionally (or necessarily, if you selected Force preview), click Preview. The Extract Paragraph wizard compares the original source with the refactored source in a preview window.
    8. If you are in the preview window and want to return to the previous display, click Back.
    9. Click OK. The wizard inserts the extracted paragraph into your COBOL file and exits, returning you to the editor window.

Feedback