Create a function or subfunction

Some functions or subfunctions are independent of any automatic functions or subfunctions. Others are inserted relatively to automatic functions or subfunctions that are specific to a model: Standard or client Dialog or Business Component. The information that is displayed in the wizard varies accordingly.

The insertion of the various types of functions and subfunctions depends on the entities in which you want to insert them:
  • The insertions of functions or subfunctions that are associated with the two models are impossible in the same Macro.
  • An insertion in absolute mode is always available. For a Program, this insertion type is the only available type.
  • In a standard or client Screen, an insertion relative to the Business Component model is impossible.
  • In a Business Component, an insertion relative to the Standard or client Dialog model is impossible.
Function code
This code is required. It is constituted of 2 characters, which can be digits or letters only.

You can parameterize it by entering $ followed by a digit or a letter.

A function code cannot be modified if at least one line depends on this function.

It determines the placement of the source lines in the sequence of functions.

The automatic functions have preset codes. So, if you select a model in the Model field, you must choose the new function code relatively to the codes of the automatic functions.

Note: See the VisualAge Pacbase documentation site for information about the automatic functions. All the automatic functions of a Program are documented in the Batch Applications manual, chapter Example of a generated Program. All the automatic functions of a Business Component are documented in the Pacbench C/S Applications Business Logic manual, chapter Appendix.
For the Standard or client Dialog model, you must enter one of the following automatic functions:
  • 20: Data Element validations
  • 25: Segment access for validation
  • 30: Data Element transfer
  • 35: Segment access for update
  • 60: Segment access for display
  • 65: Data Element transfer
  • 80: Physical access to Segments
Note: The automatic functions of a Screen are documented on the VisualAge Pacbase documentation site, in the OnLine Systems Development manual, chapter Appendix.
Subfunction code
This code is constituted of 2 characters. In a Macro, you can enter digits or letters. In a Program, Screen, or Business Component, you must enter letters only.

You can parameterize it by entering $ followed by a digit or a letter.

This code determines the placement of the source lines in the sequence of functions.

For the Standard or client Dialog model, the subfunction code is required.

For the Business Component model, the subfunction code cannot be entered for an Insertion relative to the 05 hierarchical level. However, it is required for an Insertion relative to the SQL processing, an Insertion relative to the Logical View processing, and an Insertion relative to the physical access level. It is optional for an Insertion relative to the logical access level.

Level
The level is constituted of 2 digits.

You can parameterize it by entering $ followed by a digit or a letter.

It is displayed differently according to the entity:
  • For a Macro, it is displayed in the tree of the Macro code structure view, on the node that represents the function or subfunction. In the Macro code, it is identified as LV=nn (where nn represents the level).
  • For a Program, Screen, or Business Component it is displayed from the column 73 as lvnn (where nn is the level).

The level value depends on the created element. For a function, the level is 05. For a subfunction, the level must be between 06 and 98. The default level of subfunctions is 10.

Within a function, a subfunction with a level n is part of the preceding subfunctions whose levels are lower than n. For example, a subfunction with a level 15 is part of any preceding subfunction whose level is included between 06 and 14. A dependent subfunction is run only if the function or all the subfunctions it depends on are run.

Title
You can optionally enter the title of the function or subfunction. The default value is a series of dashes.

For an insertion in a Program, Screen, or Business Component, the character string you enter will constitute the title of a function or a comment on the first line of the subfunction. The default value is a series of dashes. If you leave the default value and if you want to modify it in the code, double-click it and enter another value.

Condition
This field is available for a function or subfunction that is not related to a model (value None in the Model field).
Note: For an insertion in a Macro, all the conditions are available. However, for an insertion in a Program, Screen, or Server, only the conditions None, IT, DU, and DW are available.
You indicate whether the execution of the function or subfunction is conditioned in one of the following ways:
  • None: The function or subfunction is always run.
    Note: To create this type of function or subfunction, you can also insert a snippet: Subfunction without condition.
  • IT: The function or subfunction is run if the condition is met.

    After you insert the function or subfunction, create a line without any line number directly in the code and enter the condition. You can enter code on the following lines by creating lines that start with a line number.

    Note: To create a function or subfunction with an IT condition, you can also insert a snippet: Subfunction with condition.

    The COBOL statements IF THEN condition and NEXT SENTENCE GO TO Fffnn-FN are automatically generated after the generation of the instance that calls the Macro.

  • EL: This condition cannot be selected for a function.. The subfunction is run if the preceding subfunction with an IT condition was not run.

    After you insert the subfunction, create a line without any line number directly in the code and enter the condition. You can enter code on the following lines by creating lines that start with a line number

    The COBOL statements Fffnn-900 and GO TO Fffnn-FN are automatically generated after the generation of the instance that calls the Macro. ffnn is the associated subfunction that contains the IT condition.

  • DW: This condition cannot be selected for a function. The subfunction is run only while the condition is met.

    After you insert the subfunction, create a line without any line number directly in the code and enter the condition. You can enter code on the following lines by creating lines that start with a line number

    The COBOL statements Fffnn-900 and GO TO Fffnn are automatically generated after the generation of the instance that calls the Macro.

  • DU: This condition cannot be selected for a function. The subfunction is run in a repetitive way until the condition is met. It is then run at least once.

    After you insert the subfunction, create a line without any line number directly in the code and enter the condition. You can enter code on the following lines by creating lines that start with a line number

    No COBOL statement is automatically generated.

Note: The DO condition is not available in this wizard. To indicate that a processing must be run in a repetitive way, you must insert the Loop insertion snippet. This snippet is available from the Snippets view, in the RPP Snippets category. This snippet inserts a PERFORM COBOL statement.

Specific positioning

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.
Model
The information that you must enter in the wizard varies according to the model that is selected in this field. Three values are possible:
  • None: The functions and subfunctions that are created in the wizard are not inserted relatively to automatic functions or subfunctions.
  • Standard or client Dialog: You can create subfunctions only. These subfunctions are inserted relatively to the automatic subfunctions of the model.
  • Business Component: The functions and subfunctions that are created in the wizard are inserted relatively to the automatic functions and subfunctions of the model.
Insertion type
This field is associated with the Business Component model.
You must indicate the automatic processing relative to which your specific processing is to be inserted. The following insertions are possible:
  • Insertion relative to the 05 hierarchical level: Insertion relative to the Business Component initialization and end blocks, the SQL declarations block, and the Logical View blocks (in a Macro only).
  • Insertion relative to SQL processing: Insertion relative to the SQL processing with a 10 hierarchical level in the SQL declarations block. These insertions are relative to the SQL statements DECLARE CURSOR and WHENEVER.
    Note: Before you insert SQL specific processing, you must first attach a function with a 05 hierarchical level to the FSQL block. The insertions will then be specified in subfunctions with hierarchically lower levels.
  • Insertion relative to the Logical View processing: Insertion in the body of the program or in the elementary processing that is run by PERFORM.This insertion is possible in a Macro only.
  • Insertion relative to the logical access level: Insertion in the Segment access processing for check, update, or selection. This insertion is possible in a Macro only.
  • Insertion relative to the physical access level: Insertion in function 80.This insertion is possible in a Macro only.

Feedback