Exit Programs

This section describes how to define and store exit programs.

It is the administrator's responsibility to ensure that user exit programs do not have adverse effects on Super Natural!

This section covers the following topics:


What are Exit Programs?

There are two kinds of exit programs in Super Natural:

  • User exits

  • System exits

User Exits

User exits can be invoked from up to ten places within a transaction at run time. The user defines which exits he wants to use, the location and any parameters. An exit can be any of the following:

  • Subprogram invoked by CALL statement

  • Natural program

  • Natural subprogram

  • Natural subroutine

  • Natural map

User exits which are Natural objects must be stored in the steplib SYSTEM or in the current user's private library.

Super Natural recognizes the exit type and automatically generates the relevant Natural statements such as FETCH RETURN, CALLNAT or PERFORM and passes parameters.

Note:
You can prevent the modification of exits in transactions in a public library or in transactions which will be used as a superfile using the LOCK command.

Writing User Exits

When you are writing a user exit program, consider the following points:

Program Type

An exit program must be one of the following:

  • An external program (e.g., COBOL or ASSEMBLER subprogram) callable by a Natural CALL statement.

    Or:

  • One of the Natural object types listed in the previous section.

Parameters

Parameters must correspond with the call of the external program as used in the CALL statement; or with the parameter list used in the Natural module

If the exit program requires parameters, the user must specify them manually using the Exit Specification function.

Connecting User Exits to a File

Start of instruction setTo connect a user exit program with a file

  • Change the file options as described in the section Exit Specification in the section Files.

Informing Users

Do not forget to provide the users with the program names of the user exits available to them, and tell them which parameters are to be passed to the subprogram.

Storing User Exit Object Modules

Natural Objects

The object modules ofNatural programs, subprograms, subroutines, or maps can be stored as follows:

  • In the steplib SYSTEM (FUSER or FNAT) - all users of Super Natural can access these modules from their private libraries and from any common library. This is recommended in most cases.

    Or:

  • In the private Super Natural libraries of selected users - only the selected users can use these user exits. IfSuper Natural is running under Natural Security, the private library of each of the selected users must be defined to Natural Security.

    Or:

  • In the appropriate common library if the transaction from which the module is called is either executed in a common library or was added in a common library.

Note:
When you copy a transaction which uses user exits, you must make sure that the user exit object modules are available in the target environment as described above.

Non-Natural Programs

For information on storing object modules of external (non-Natural) programs, contact your Natural administrator or see the Natural documentation.

System Exits

You use system exits to take control at a certain point in Super Natural. The following system exits are supplied with Super Natural in source code:

ENTRY Program invoked as entry routine for the Super Natural session.
EXIT Program invoked as exit routine when the Super Natural session is terminated.
SHEXIT Program which takes over if the user presses.
SNERRU Program invoked by error routine SNRTE. SNERRU can be modified to handle specific error conditions. For example, you can use SNERRU to give the user additional information or instructions when an error occurs.
SPRJEU Natural subprogram which is executed once for every job card prior to the submission of a batch job.
SPPARM Subprogram to define environment specific parameter settings. Parameters include:
The submission indicator for batch job submission (RJE or NPR).
Com-plete hardcopy support - default printer number generation or prompting for destination (default).
Common library prefix character - only change at installation.
Layout prefix character - only change at installation.

You can modify these user exits if required.