Generated Code Structure view

This view displays a hierarchical tree with the generated nodes of the instance. You can use it to easily navigate in the PDP COBOL editor and spot where specific code was entered. Moreover, if you modified the design of an instance that contains specific code, you must consult this view after each new generation. This view shows whether the reconciliation (which integrates the new design while keeping the specific code) has detected any potential problems. Finally, you can use this view to create and modify specific functions and subfunctions.

To see the content of this view, you must have generated a Program, Screen, or Server. Then, from the Design Explorer view or the result view of a local or server instance or reference search, open the generated file by right-clicking it and selecting the PDP COBOL editor. For example, for the generated file of a Program, select Open with > PDP COBOL editor in the contextual menu of the generated Program. The editor must remain opened and currently selected.

Display in the view

In the Pacbase facet, the nodes correspond to functions, subfunctions, sections, and divisions. By default, the tree displays the titles of the generated and specific functions and subfunctions. These titles are extracted from the comment that precedes the function or subfunction. Only the relevant characters are recognized. Characters such as *, +, or =, and the NOTE character string are not included in the titles. If you do not want to display the titles of the functions and subfunctions, clear the option Display the long labels of the nodes from Window > Preferences > Pattern Driven Programming > PDP framework.
Note: The nodes and their levels are also displayed in a tooltip in the first column.
The hierarchical tree displays the following symbols:
  • Generated code if the text block that represents the node is generated.
  • Reformatted code if the text block that represents the node contains specific changes: if the generated code was modified, if code was added or deleted. The following symbols specify the type of specific change:
    • Modified code is displayed where you modified the text of the node and no error was found by the reconciliation.
    • Added code is displayed where you added a block of text in the node or created a specific node.
    • Deleted code is displayed where you deleted the whole text of the node (if you deleted only part of it, it is considered as a modification).
    Note: You can perform one of the following actions on each level that contains a warning:
    • Keep the choices made by the reconciliation by right-clicking the node and selecting Remove warnings.
    • Overwrite the text modifications with the originally generated code by right-clicking the node and selecting Restore generated code. The node is then displayed like a generated node. Its block text is displayed with a Generated code symbol.
You can modify the display of the view through one of the following actions:
  • Display only the nodes that represent specific code, and their upward hierarchy. To do so, click Show user code in the toolbar.
  • Filter the nodes. To do so, type a name pattern in the Filters field of the view. When you start typing in the field, a button becomes available. Clicking it clears the field and restores the initial display.
    Note: The wildcard character * replaces a character string and ? replaces a character; they are optional at the end of the string.
  • Expand or collapse all the tree nodes. To do so, click Expand all or Collapse all in the view toolbar.
  • Display the nodes that are created when the micropatterns that retrieve the parameterized operators in Macros are expanded (Pacbase facet). These nodes are then hidden by default in order not to clutter the nodes tree. However, you can display them to detect problems, if any. To do so, clear the option Hide nodes owning the property "hidden" from Window > Preferences > Pattern Driven Programming > PDP framework.

From a Macro node (Pacbase facet), you can open the Macro in the Macro editor in the context of its call. To do so, right-click a Macro node and select Open the Macro with the Macro editor. Selecting this choice is identical to double-clicking a Macro in the -CP Lines tab of the calling instance.

In the Pacbase facet, the Condition column of this view displays the COBOL conditions (contents of IF lines) of functions and subfunctions. The associated tooltip displays each condition as it was entered in the COBOL code and reflects the input on several lines when applicable.

From this view, you can filter the text in the PDP editor and display or hide parts of the code.

You change the color of the nodes that come from the design and from Macro calls. To do so, select Window > Preferences > General > Appearence > Colors and fonts > PDP COBOL editor > Generated code foreground color. Click Edit. In the selection wizard, select another color and click OK. In the preferences page, click Apply and OK. The new color is automatically displayed in the Generated Code Structure when you open COBOL files with the PDP COBOL editor. However, if some COBOL files were already opened, you need to close them and open them again to see the new color.

Managing specific functions and subfunctions

You manage the specific functions and subfunctions by right-clicking and selecting Function and subfunction actions in the contextual menu. This choice is the same as in the PDP COBOL editor or Macro COBOL Source editor. You active it to complete the following actions:
  • Create a function or subfunction. This action is identical to the create action in the PDP COBOL editor and the Macro COBOL Source editor. When you select it, the function or subfunction creation wizard opens. 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.
  • Delete the selected function or subfunction. When you select this action, a dialog box prompts you to confirm the deletion. This dialog box also contains a check box that you can select to request the deletion of all the dependent subfunctions, only if they do not contain generated code. If they contain generated code, this check box is not available.
  • Update the selected function or subfunction. This action is identical to the update action in the PDP COBOL editor and the Macro COBOL Source editor. When you select it, the function or subfunction update wizard opens. You can update the level or the title of the function or subfunction.
  • Move or Copy-paste the selected function or subfunction. When you select either one of these actions, a dialog box prompts you to enter the new function or subfunction code.
    Restriction: The actions on a selected function or subfunction are available only on a terminal function of subfunction that does not contain code generated from the design or from Macros. To move or copy-paste a group of functions and subfunctions, you must then perform the action on each function or subfunction, one after the other.
    The actions on a selected function or subfunction update the whole structure of the function or subfunction, that is to say:
    • The function or subfunction code in column 8 and in the related processing (NEXT SENTENCE or GO TO for example),
    • The indexes related to a DO loop with the creation of indexes in the WORKING-STORAGE SECTION.
    These actions do not modify the specific code. So, for example, the comments and the creation of DISPLAY tags are kept as they are.
    Warning: After 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.
  • Reformat the CASE OF into EVALUATE for the dependent subfunctions of a CASE OF condition. This option can be selected only if the Generated language in the Definition tab of the Program, Screen, or Server Library is D : COBOL II, 85, LE. See Particular cases of the DO and CO loops.
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.

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 generatable instance (Program or Screen for example), 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.


Feedback