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 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.
In Macros, you can parameterize it by entering $ followed by a digit or a letter.
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.
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
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.Note: For explanations on the automatic functions, see COBOL description of a generated Program, Screen, or Server.
- Subfunction code
- This code is constituted of 2 characters, which can be digits or letters only.
In Macros, 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. It must not correspond to the code of any of the automatically generated subfunctions, which is always numeric. Therefore, it is recommended to systematically use an alphabetic subfunction code.
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 a Replacement of a physical access. It is optional for an Insertion relative to the logical access level.
Some subfunction codes of the 80 function in Screens and Servers differ from the other subfunction codes of this function. Unlike the others, they are not used to replace the standard access to a Segment. They are used to override generated subfunctions.- The subfunction code 95 in Screens is used to override the processing of F80-HELP (screen backup for documentation call).
- The subfunction code 98 in Screens is used to override the processing of F80-LE00 (access to the error message file).
- The subfunction code 99 in Screens and Servers is used to override the processing of F80-OKKO (management of OK or KO on file access).
- Level
- The level is constituted of 2 digits.
In Macros, 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).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 in the Macro code) directly in the code and enter the condition. You can enter code on the following lines (with line numbers in the Macro code).
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.
The COBOL statements Fffnn-900 and GO TO Fffnn-FN are automatically managed and generated. ffnn is the associated subfunction that contains the IT condition. For example, if you modify the condition type or the level of a subfunction and if this modification entails the move of the -900 line, this move is automatic. If you specify an EL condition type after an existing IT condition, the -900 line will be automatically generated.
- 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 in the Macro code) directly in the code and enter the condition. You can enter code on the following lines (with line numbers in the Macro code).
The COBOL statements Fffnn-900 and GO TO Fffnn-FN are automatically managed and generated. ffnn is the associated subfunction that contains the IT condition. For example, if you modify the condition type or the level of a subfunction and if this modification entails the move of the -900 line, this move is automatic. If you specify an EL condition type after an existing IT condition, the -900 line will be automatically generated.
- 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 in the Macro code) directly in the code and enter the condition. You can enter code on the following lines (with line numbers in the Macro code).
The COBOL statements Fffnn-900 and GO TO Fffnn are automatically managed and generated.
- 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 in the Macro code) directly in the code and enter the condition. You can enter code on the following lines (with line numbers in the Macro code).
The COBOL statements Fffnn-900 and GO TO Fffnn are automatically managed and generated.
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.Note on the DO condition: The DO condition cannot be selected in this wizard. However, it can be present in the specific code that was written in Pacbase. In this case, it is displayed in the code in the PDP COBOL editor and in the wizard but it cannot be selected. To know how to maintain a DO loop that is migrated from Pacbase see Particular cases of the DO and CO loops.To indicate that a processing must be run in a repetitive way, like in a DO condition, you can insert the Loop insertion snippet. This snippet is available from the Snippets view, in the RPP Snippets category. It inserts a PERFORM COBOL statement. You can also write a PERFORM statement on a new line, without using the snippet.
Note on the CO condition: The CO condition is not available in this wizard. However, it can be present in the specific code that was written in Pacbase. To know how to maintain it, see Particular cases of the DO and CO loops.It is retrieved in Rational Programming Patterns as a CO micropattern, in Macros only. To indicate that instructions must be run independently according to the value of a variable, you must insert the snippet Micropattern CO: Case Of processing in a Macro. This snippet is available in the Snippets view, RPP Macro Snippets category. It inserts a CO micropattern with the name of the variable to be tested. You must then create the subfunctions that contain the instructions to be run according to the value of the variable.
- None: The function or subfunction is always run.
Specific positioning
- 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.
- 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.
- Insertion relative to the logical access level: Insertion in the Segment access processing for check, update, or selection.
- Insertion relative to the physical access level: Insertion in function 80.
With generation
This box is automatically checked and cannot be cleared if the modifications require a new generation. Such is the case, for example, if you create a relative subfunction in a Screen or Server. A message in the wizard title also informs that a new generation is required.
However, you can check this box if the modifications in the creation wizard do not require a new generation. Such is the case, for example, if you change the title or level of a function or subfunction, or create a function or subfunction in a Program. In this case, you can generate, for example, if you previously updated micropatterns.
The new generation starts when you click Finish in the wizard.