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.

For explanations on the variables and functions that are generated in the code, see COBOL description of a generated Program, Screen, or Server.

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 level 99 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.

You can dispatch Macro lines inside a specific code block. To do so, you must frame the specific code lines with tags. A block that must be located before a Macro line must start with a line that contains the tag *{BEFORE FFFSSLIN (where FFSS is the function or subfunction code and LIN is the line number) and end with a line that contains the tag *}. A block that must be located after a Macro line must start with a line that contains the tag *{AFTER FFFSSLIN and end with a line that contains the tag *}.

The PDP editor includes many functions. For example, you can cut, copy, paste, filter the lines, debug or compare. You can display the content assist by pressing the Ctrl and space keys. If you select micropattern lines (declaration lines and generated lines), cut or copy them, and then paste them, the generated lines are not pasted. Only the declaration lines are pasted.
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.

If you right-click anywhere in the view, you can select Generate the code in the contextual menu. If you have updated the design of a Program, Screen, or Server, the newly generated code will integrate the changes in the design, while keeping any specific changes in the code.

The preference Structure checking before generation management, which is available from Window > Preferences > Pattern Driven Programming > Pacbase Patterns, checks that the nesting of subfunctions in the COBOL code is correct before the generation. By default, it blocks the generation if structure errors are detected.

Creating or updating specific functions or subfunctions

These actions are possible in the Pacbase facet only.

You insert functions or subfunctions in the PROCEDURE DIVISION. To open the creation wizard, right-click in the editor and select Function and subfunction actions > Create. 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, 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:
  • The title of the function or 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,
  • 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).
    Note: For explanations on the DO and CO execution conditions, see Particular cases of the DO and CO loops.

You can modify the title or level of a specific subfunction from the subfunction creation wizard. To do it, set the cursor inside the function or subfunction, right-click, and select Function and subfunction actions > Update.

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.
The create and update actions are also available from the contextual menu of the Generated Code Structure view. Moreover, this view also gives you the possibility to move, copy-paste, and delete functions or subfunctions.
Warning: Following copy-paste actions, the execution condition that is displayed as a comment (*.BL for example) on the title line of the function of subfunction in the PDP COBOL editor might no longer correspond to the actual execution condition.

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, Macro lines are khaki (Pacbase facet). The code lines that are generated from the design are gray. Micropattern declaration lines are pink and the code lines that are generated from micropattern insertions are blue. 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.

Symbols that are related to Rational Programming Patterns can be displayed in the margin and in the Problems view:
  • 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. These warnings have a PDP Reconciliation Marker type in the Problems view.

      In the Pacbase facet, quick fixes are available for the reconciliation warnings that indicate that the user code cannot be carried over because its initial position no longer exists.

    • On the lines where a difference is detected between the Pacbase generation and the local generation (Pacbase facet). For explanations on how to manage the Rational Programming Patterns warnings, see Managing the warnings in the Problems view or the PDP COBOL editor and Managing the warnings in the Validation Manager view.
    • On the lines where a micropattern has set a warning.
    • On the PROCEDURE DIVISION tag if Macro lines are overridden in the PROCEDURE DIVISION, or on the first line of the COBOL code if Macro lines are overridden outside the PROCEDURE DIVISION. Macro lines are overridden if they are present in two Macros, or if a Macro is called more than once in the same position.
    • On the PROCEDURE DIVISION tag of a Server if the position of a subfunction after a Macro merge seems to be abnormal. The warning asks you to verify the subfunction position.
  • Quick fix for reconciliation and migration warnings is displayed, in addition to the warning symbol warning, for the reconciliation and migration warnings. It indicates that quick fixes are available directly in the PDP COBOL editor. To display them, click the symbol. You can also display the quick fixes by right-clicking one of the lines with the warning and by selecting Quick fix, or by clicking one of these lines and by selecting Edit > Quick fix.
The following quick fixes are available for the reconciliation warnings that are related to the user code:
  • Insert the user code
  • Insert the user code with its context here
  • Leave the code as is (Remove the problem)
For example, in the Pacbase facet, if you replaced a Macro call with 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.

In some cases, you must reinsert the specific code lines manually in the right place.

Such is the case when Macro tags have been modified (subfunction code or line number). The Problems view then displays a warning for each block of misplaced specific code.

To correct the problem, proceed as follows:
  • Move the cursor to the warning. To do that, double-click the warning in the Problems view. You can also access the warning directly in the PDP COBOL editor. In both cases, the warning symbol is adorned with the quick fix symbol Quick fix for the migration reconciliation warnings.
  • Click the warning. The list of the quick fixes is displayed. Double-click Insert the user code with its context here. The specific code block is inserted.
  • Cut and paste the lines to move them to the right place. In the Problems view, the line number of the warning is modified.
  • Click the warning and double-click the quick fix Leave the code as is (Remove the problem). The warning is then removed.
You must proceed likewise for all the warnings with this type.

If specific code blocks must be split into several blocks and inserted in several places in the generated code, you must solve the problem manually. Select the quick fix Leave the code as is (Remove the problem) and move the specific code blocks manually to their appropriate places.

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


Feedback