PDP COBOL editor

The PDP COBOL editor complements the functions of the standard COBOL editor. You can modify the COBOL code while clearly seeing the origin of all the code lines (generated lines or specific code lines for example), the deleted or overwritten lines, and the potential problems. To easily navigate in the code, you can use the Generated Code Structure view, which displays a hierarchical tree with the generated nodes of the instance.

You can open the generated file of a Program, Screen, or Server in the Pacbase facet, or a COBOL Program, COBOL Copybook in the COBOL facet. To do so, from the Design Explorer view or the result view of a local or server instance or reference search, right-click the generated file and select Open with > PDP COBOL editor. The display is identical (same colors), whether you open the file locally or on the server. However, if you open it on the server, you cannot update it.
Tip: For the Pacbase facet, you must be familiar with the concepts explained in The steps to generate the COBOL of a Program, Screen, or Server before you read this help.

Composition of the PDP COBOL editor lines

In the PDP COBOL editor, the code lines are constituted of two parts that are separated by a vertical line. The first part is the line code itself. The second part, which starts from column 73, displays information that varies according to the origin of the code line.

The information that is displayed from column 73 can be as follows:
  • The name of the Program, Screen, or Server for the lines that are generated from the instance design and from the micropatterns present in the called Macros.
  • The name of the Macro for the generated lines of a Macro.
  • The identifier of the micropattern call in the lines that are generated from a micropattern insertion in the specific code of a Program, Screen, or Server. The identifier is automatically generated upon the generation of the Program, Screen, or Server to differentiate the calls. This identifier corresponds to the order number of the call. The identifier of the first micropattern call is 000001 and this number is incremented by 1 for each new micropattern call.
  • A DOT annotation that replaces the 99BL notion that was indicated in the Pacbase Macros. You must not delete it because, upon generation, it adds a dot at the end of the previous significant line.
  • A dot annotation that replaces the 99BL notion that was indicated in the specific code of the Pacbase Programs, Screens, or Servers. You must not delete it because, upon generation, it adds a dot at the end of the previous significant line.
  • A COA annotation for the specific code lines that contained a COA operand in Pacbase.
  • The level of the function or subfunction on the tag line of a function or subfunction that is inserted in the specific code of the Program, Screen, or Server, or in the called Macro. The level is displayed as lvnn, where nn is the level number. The level is not displayed on the functions or subfunctions that are generated from the design of the Program, Screen, or Server.

You can enter some information from column 73. You can manually insert a subfunction with a level. You can also enter a DOT to add a dot at the end of the previous significant line, for example if the previous line comes from a Macro.

Modifying the generated code

You can modify the generated code to adapt it to your particular needs.

Important: In the Pacbase facet, the COBOL syntax check is disabled for all the instances whose type of COBOL code (indicated on the Definition tab) is not an IBM® type.
Tip: On the lines that contain characters from column 73, these characters are shifted to the right when you insert text or code before column 72. If you want these characters to retain their initial position, select the choice Manage Sequence Numbers in the menu Window > Preferences > COBOL > Editor > Sequence Numbers.

You can use micropatterns or snippets to insert code. It is strongly recommended not to modify the code that is generated by a micropattern. Warnings in the margin indicate where the insertion of specific code can disrupt the reconciliation. Such is the case if you override a line that is generated by a micropattern and add a micropattern call in the specific code that is generated by a micropattern.

The PDP editor includes many functions. For example, you can cut, copy, paste, filter the lines, debug, compare, and display the content assist by pressing the Ctrl and space keys.
Limit: The Undo and Redo functions of the editor are no longer available after a generation. The pile of changes to undo and redo is emptied after each generation. The changes that are made before a generation cannot be undone with the Undo function. To delete changes (including the generation) made before the generation, you can exit the editor without saving or use the Revert File function.
The PDP COBOL editor indicates a modified state with an asterisk (*) in the editor tab when the generated file is directly modified. To discard the changes, right-click and select Revert File.
Note: In the design editors, you can modify the designs that are involved in the generation. In this case, the PDP COBOL editor does not display a modified state. It only indicates the desynchronization between the design and the generated code with the Desynchronization between the design and the generated code icon. If you close the design editors without saving, then close the PDP COBOL editor and open it again, the desynchronized state is no longer indicated. You must be aware that if an instance is opened in several editors simultaneously, the modifications are held as long as you have not closed the last of these editors and saved.

Inserting functions or subfunctions

This insertion is possible in the Pacbase facet only.

You can insert functions or subfunctions in the PROCEDURE DIVISION by using a creation wizard. To open it, right-click in the editor and select Create a function or subfunction. The cursor position when you open the wizard is irrelevant. The new function or subfunction is correctly inserted according to the number you give it in the wizard.

Two insertion types are possible:
  • Insertion in absolute mode in Programs, Screens, and Servers,
  • Insertion in relation to the automatic functions of the Standard or client Dialog or Business Component model.
    Attention: In this Rational Programming Patterns version (V9.1.2), relative insertions in the PDP COBOL editor are possible only through the high-priority Macro that is associated with the Screen or Business Component. This Macro is identified by the instance name, followed by SP. For example, if you want to insert a relative function or subfunction in the SCR001 Screen, you must do it in the SCR001SP high-priority Macro.
The following elements are inserted in the code:
  • A title for a function or a comment for a subfunction,
  • The start and end tags,
  • The level,
  • The comment *<insert code for Fffnn here> (with Fffnn as the function or subfunction code) to indicate the possible beginning of a specific code insertion,
  • Information that varies according to the insertion:
    • For an insertion in absolute mode: the execution condition if it was indicated in the wizard. This condition is added at the end of the comment line that precedes the insertion (*.DU for example).
    • For an insertion in relative mode: the placement relative to the automatic function. The indications *@BEFORE, *@AFTER, or *@REPLACE are displayed at the beginning of the insertion, followed by the category, the Segment, or the Data Element relatively to which the insertion is based. For an insertion in function F80, the customized access is indicated.

You can modify the level of a specific subfunction from the subfunction creation wizard. To do it, put the cursor in the subfunction, right-click, and select Change the level of a subfunction. This action is also available from the Generated Code Structure view.

Attention: It is recommended to use the wizard to create functions or subfunctions, or change their levels. The wizard automatically reorganizes the end tags (Fffnn-FN) of the existing functions or subfunctions that are impacted by the update. A manual update requires the manual reorganization of these tags.

You can move, copy-paste, or delete functions or subfunctions from the contextual menu of the Generated Code Structure view.

Desynchronization between the design and the generated code

When the design of the generated instance is modified, the generated code is no longer synchronized. In this case, the icon Desynchronization between the design and the generated code is displayed, followed by a special character, in the title of the PDP editor tab. The default special character is > but you can change it by selecting Window > Preferences > Pattern Driven Programming > PDP Framework > Character to use to better visualize the need for regeneration in the PDP Editor. These signals alert you that a new generation is needed. You can regenerate all the desynchronized files in the Generation Manager view.
Note: The desynchronization is also indicated in the Design view of the instance. The color of the generation button changes (Generate is recommended) to inform you that Generate is recommended due to modifications in the design. When the generation is complete, the synchronization is restored and the button returns to its initial appearance.

Specific display of the PDP COBOL editor

The PDP coloring complements the standard COBOL editor coloring to identify the origin of the lines. By default, the Macro lines are khaki and the generated code lines are gray. Moreover, by default, the start and end tags of the Pacbase functions and subfunctions in the specific code and the code from the Macros have a special color and are in bold.

You can change these PDP default colors by selecting Window > Preferences > Pattern Driven Programming > Pacbase Patterns.

Two symbols that are related to Rational® Programming Patterns can be displayed in the margin:
  • Information is displayed if code lines were deleted or overwritten. If you place your mouse over this symbol, you can see the deleted line or the line that was overwritten by the current line.
  • Warning is displayed in the following cases:
    • On the lines where the reconciliation detects a potential problem. The reconciliation is the process that integrates, after a generation, the new design of an instance with the user-specific changes. A warning is displayed, for example, when the reconciliation is not sure where it must place the specific code because several places are possible, or when the overwritten generated code has changed.

      In the Problems view, these warnings have a PDP Reconciliation Marker type. You can manage them in the Problems view by right-clicking them and Quick fix.

      For example, in the Pacbase facet, if you replaced a Macro call by another Macro call, reconciliation warnings can be generated if the initial Macro contained specific code lines. You can then use the quick fixes to do the following actions:
      • Insert the specific code lines of the initial Macro where they used to be.
      • Insert the specific code lines of the initial Macro and their context to maintain the COBOL code consistency.
      • Leave the code as is. The specific code lines of the initial Macro are removed.
    • On the lines where a difference is detected between the Pacbase generation and the local generation (Pacbase facet). For explanations about how to manage these warnings, see Validating the migration
    • On the lines where a micropattern has set a warning.

You can change the display in the PDP editor with filters from the Generated Code Structure view.


Feedback