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.
  • Macro detail lines (Pacbase facet) if the text block that represents the node comes from a Macro detail line.
  • 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:
  • Synchronize the selection in the view with the cursor position in the PDP COBOL editor. By default, this synchronization is deactivated. To activate it, click Link with an editor.
  • Display the Macro detail lines (Pacbase facet), which are hidden by default. To do so, click Show or hide Macro detail lines in the toolbar. If you request the display of the specific code nodes (Show or hide user code) while the Macro detail lines are displayed, then the Macro detail lines disappear from the view. Moreover, the state of the Show or hide Macro detail lines button is reset to Show Macro detail lines.
  • Display only the nodes that represent specific code, and their upward hierarchy. To do so, click Show or hide user code in the toolbar. If you request the display of the Macro detail lines (Show or hide Macro detail lines) while the specific code nodes are displayed, then the specific code nodes disappear from the view. Moreover, the state of the Show or hide user code button is reset to Show user code.
  • 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.

The following columns are specific to the Pacbase facet:
  • The Level column displays the hierarchical level of functions or subfunctions.
  • The Type column displays the execution condition of functions or subfunctions. This column displays a tooltip whenever a specific subfunction is inserted relatively to an automatic subfunction of a Screen or Server. The relative insertion is indicated by 2 characters (*A for an insertion before, *P for an insertion after, or *R for a replacement).
  • The Condition column displays the COBOL conditions (contents of IF lines) of functions or subfunctions. The associated tooltip displays each condition as it was entered in the COBOL code and reflects the input on several lines when applicable.
You can modify the display order of the columns. To do so, click the title of a column, keep the mouse button pressed, and move the column.

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 the Rational® Programming Patterns versions between 9.1.2 and 9.6, relative insertions in the PDP COBOL editor were possible only through the high-priority Macro that was associated with the Screen or Business Component. This Macro was identified by the instance name, followed by SP. From version 9.6.1, relative insertions are specified directly from the COBOL code of Screens and Business Components. The changes undergone by the COBOL files that were generated before version 9.6.1 are explained in Generation upgrade.
    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.
    • The placement relative to the automatic functions in the Dialog or Business Component model, in the PDP COBOL editor only. The annotations *@BEFORE, *@AFTER, or *@REPLACE are displayed at the beginning of the insertion, followed by the element relatively to which the insertion is based. For an insertion in function F80, the customized access is indicated.

      In Business Components only, the *@ATTACH annotation is displayed at the beginning of the PROCEDURE DIVISION when a function is attached to a Logical View block, or is attached to the SQL cursors declaration block without position (value None in the Action type). All the subfunctions of this function will then automatically recognize this attachment. The function does not generate any code in the COBOL.

    See Creating specific functions or subfunctions for detailed explanations on the functions or subfunctions creation wizard.

  • 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, even if they contain generated code. If the subfunction to be deleted is a relative subfunction or if you request the deletion of its dependent subfunctions, a new generation is required after the deletion. In this case, only the OK + Generate button is available. In the other cases, a new generation is not required and you can also click OK.
  • 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 title, level, or execution condition of the function or subfunction.
    Note: If you update the execution condition in the function or subfunction update wizard, a new generation starts automatically when you click Finish. Then, the new execution condition is integrated into the code. The former condition lines, if any, are displayed as comment lines at the beginning of the new function or subfunction. You can delete them or reuse them.
  • 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 or execution conditions. 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