There are many places in the operating systems where it might be desirable for you (or third-party application providers) to extend the functionality of what the operating system does. In order to provide this extensibility, many operating systems provide the support for invoking programs. On i, these are called exits or exit points. The exit points are those predefined interfaces where your program can get control An exit program is the program you write that will get control from operating system functions at those predefined points.
In general, finding information about exit points in the Information Center is difficult; you have the following options:
- Use the API Finder and review All Exit Programs.
- Go to APIs by Category and select the category you are interested in. At the end of the list of APIs there is a section on Exit Points for that category (if there are any).
- Search on something you know about that exit point – the name for example.
Unless you are specifically looking for exit point information, you probably won't stumble upon it. But the purpose of this blog isn't to talk about i exit points in a general manner.
There are two command exit points that have existed on IBM i for some time – the Command Analyzer Change Exit and the Command Analyzer Retrieve Exit. These exit points allow you to have a program run when a command is invoked; the Command Analyzer Change exit allows your program to run before the operating system passes control to the prompter component. The Command Analyzer Retrieve exit is called after the validity checking program is run but before control is passed to the command processing program. There have been other articles written on these topics that an Internet search will find for you.
There were PTFs that were done earlier this year to enhance the support of the Command Analyzer Retrieve exit point to allow the exit program to optionally be called after control returns from the command processing program; this means your program can get control after the command processing program has been completed. This allows you to take whatever action you may want after a command has been run. Of course, not all command processing may be complete even though control has returned from the CPP; there are many examples where the command initiates some processing that is completed asynchronously. This is a nice enhancement that provides some simple, yet potentially very valuable, function.
The PTFs are:
For more information, see the CL retrieve exit programs can run after command completion article on the IBM i developerWorks site. The exit program information on the Command Analyzer Retrieve exit has also been updated in the IBM i 7.1 Information Center.