This section describes user exit programs.
This section covers the following topics:
User exit programs are programs stored outside Super Natural which can be invoked and executed when a Super Natural transaction is run. A user exit program can be a Natural object (program, sub-program, sub-routine or map) or a Natural-callable program stored outside Natural. Super Natural enables the end user to invoke user exit programs from selected locations within one or more transactions.
User exit programs are usually written by the Super Natural administrator and can be used in the following ways:
To carry out repetitive or complex tasks
To carry out tasks which are repeated every time a particular file is accessed
To perform many functions additional to the normal capabilities of Super Natural.
Once a user exit program has been activated, it is carried out each time the transaction is run or a particular file is accessed.
Your administrator will tell you the following:
The names of the user exit programs available to you
Which parameters to use
In which order to use the parameters.
You can activate a user exit program whilst adding or modifying a transaction.
To activate a user exit program
The Exit Specification screen appears:
16:13 ***** Super Natural ***** 1995-06-01 SAMPLE1 - Exit Specification - SN3500 Exit Exit NATURAL Parameter Exit Location No. Program Object List 1 ________ _ At start 2 ________ _ Before primary file read 3 ________ _ _ Before secondary file read 4 ________ _ _ Before lookup, logic & calculations 5 ________ _ _ Before external/buffer sort 6 ________ _ _ After external/buffer sort 7 ________ _ _ Before work/PC-write & add/update 8 ________ _ _ Before report output 9 ________ _ _ Before end of read loop(s) 10 ________ _ At end Command ===> Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- Help Next Exit Flip Sel Run Canc |
First you must decide at which exit location (at which point in your transaction) you want the user exit program to be activated.
To activate an external program
Type its name in the Exit Program column next to the exit location you require.
To activate a Natural object
Type its name in the Exit Program column.
Mark the Natural Object column next to the exit location you require.
If you enter the name of a Natural object which doesn't exist, a window appears which asks if you to confirm the entry. If you enter "N", the name is removed from the Exit Program column.
If you enter "Y", you can continue and either write or obtain access to the program later.
Note:
You must write or obtain access to the program before you can run the
transaction.
Optional:
To pass values from your transaction to the external program
Mark the Parameter column at the relevant exit location.
Press Enter.
The Exit Parameter window appears with a selection list of the fields, which you can use as parameters in the external program.
At exit location 1, no fields are available.
At exit locations 2 and 10, only user fields and dynamic input fields are available. If the transaction contains no user fields or dynamic input fields, the Parameter list is protected next to these exit locations.
At exit locations 3 through 9, all the fields which have been read by that point in the transaction are available.
Multiple-value fields and periodic groups are not available.
Mark the values you want to be passed to the external program using numbers from 1 to 40 to specify the sequence.
Press Enter.
You can now continue creating or modifying your transaction.
You can specify more than one user exit program for a transaction.
If a user exit program is already defined for a transaction or a file, you do not have to use it as long as it has not been locked. For example, your administrator may have activated a user exit program to be used each time a particular file is accessed.
You can deactivate user exit programs whilst creating or modifying a transaction:
To deactivate a user exit program
Issue the USEREXIT
command.
The Exit Specification screen appears.
Overtype existing entries with blanks or with new user exit specifications.
Press Enter.
The user exit is deactivated.
If you lock a user exit location, the user exit specifications defined there can never be changed. For example, you can use this function when you copy a transaction into a common library to make sure that the user exit programs are used. You can also lock an exit location if you don't want it to be used.
To lock user exit specifications
Issue the LOCK
command from the
Exit Specification screen.
The Lock Exit window appears showing your current exit specifications.
17:15 ***** Super Natural ***** 05.Jan.1993 SN3500 - Exit Specification - Tuesday Exit Exit NATURAL Parameter Exit Locati +----------Lock Exit----------+ No. Routine Object List ! Exit Exit NATURAL ! 1 ________ _ _ At start ! No. Routine Object ! 2 ________ _ _ Before prim ! _ 1 ! 3 ________ _ _ Before seco ! _ 2 ! 4 ________ _ _ Before look ! _ 3 ! 5 ________ _ _ Before exte ! _ 4 ! 6 ________ _ _ After exte ! _ 5 ! 7 ________ _ _ Before work ! _ 6 ! 8 ________ _ _ Before repo ! _ 7 ! 9 ________ _ _ Before end ! _ 8 ! 10 ________ _ _ At end ! _ 9 ! ! _ 10 ! ! ! +-----------------------------+ |
To lock an exit location
Mark the Lock column next to it.
Press Enter.
The Lock Exit confirmation window appears for each exit to be locked.
Once you have saved a transaction with a lock in it, even the administrator cannot override the lock!