17.4.7 INIT and TERM Parameters
The purpose of the INIT= and TERM= parameters is to allow you to initialize or clean up your application automatically.
These two parameters are entirely independent of each other: you may specify one, both or neither.
INIT= |
(Startup Function) specifies a function to be automatically executed on application startup. |
TERM= |
(Shutdown Function) specifies a function to be automatically executed on application shutdown. |
Once either parameter has been specified, it is automatically passed to batch jobs so that they too will automatically run the same function on startup or shutdown.
For example, you might create a startup function CONNECT for a SuperServer application. This function could execute the BIFs DEFINE_ANY_SERVER (or DEFINE_OS_400_SERVER or DEFINE_OTHER_SERVER), CONNECT_SERVER and CONNECT_FILE with a standard set of arguments (such as blocking factor set to 1 on CONNECT_FILE). Not only would your main application connect to the Server automatically, so would any batch jobs.
Note: You should avoid the use of DISPLAY/REQUEST/POP_UP commands in INIT= and TERM= functions. Under some circumstances, these RDML commands (which require user interaction) may be inappropriate or may cause application failure.