This section explains what a user exit is and how to select and define one in NaturalONE. The following topics are covered:
By default, the generated source code is protected from editing and changes can only be made within user exits, positions within the generated code where you can insert customized or specialized processing. Changes to the user exit code are always preserved upon subsequent regeneration of the module. We recommend that you only add custom code within user exits.
Warning: Although it is not recommended, you can edit the protected lines in the generated source code outside of the user exits. However, your changes will not be preserved upon regeneration. For information about the protected lines in the generated source code, see Using the Source Editor/Protected Lines in Sources Generated by Construct or Code Generation in Using NaturalONE. |
The code generation wizards provide a wide variety of user exits, which
vary based on the type of module you are generating. Some exits contain sample
code or subprograms, while others generate the **SAG DEFINE EXIT
and **SAG END-EXIT
tags only — you provide the actual code. You
can modify any user exit code generated into the edit buffer.
Notes:
When a generated module is open in the Eclipse editor, all available user exits for the module are displayed in the Outline view. This section covers the following topics:
Tip:
If the user exits are not displayed in the
Outline view, select
on the
toolbar.
To access a user exit
Select the user exit in the Outline view.
Open the context menu for the user exit.
For example:
Select one of the options listed.
The user exit is displayed in the editor view. For example:
The **SAG EXIT POINT
tag indicates that the exit does
not exist and you must use the Outline view to add code or
generate sample code.
To add code to a user exit
Open the context menu for the user exit.
Select
.The exit is displayed in the editor view. For example:
The **SAG DEFINE EXIT
and **SAG END-EXIT
tags indicate that the user exit exists, even when there is currently no code
in it, and you can define or modify the exit directly in the editor.
Move the cursor to the end of the **SAG DEFINE EXIT
user-exit-name
line.
Select Enter.
Add the code on the lines provided.
To add code to a user exit
Open the context menu for the user exit.
Select
.The **SAG DEFINE EXIT
and **SAG END-EXIT
lines are displayed with sample code. For example:
Move the cursor to the end of the **SAG DEFINE EXIT
user-exit-name
line.
Modify the sample code as required.
To clear code from an existing user exit
Open the context menu for the user exit in the Outline view.
Select
.All lines of code within the selected exit are deleted and the comment line that identifies the insertion point for the exit within the editor is restored.
To modify code in a user exit
Select the user exit in the Outline view.
The user exit is displayed in the editor.
Modify and save the user exit.
Note:
You can make changes to user exits equivalent to the
and
options by modifying these lines in the editor view — without using the context
menu for the Outline view. If you do this, ensure you do
not change the ** SAG comment lines.