CL retrieve exit programs can run after command completion
The IBM i operating system supports two exit points for control language (CL) commands: QIBM_QCA_CHG_COMMAND and QIBM_QCA_RTV_COMMAND. For each regular CL command, and proxy CL commands in the QSYS library, one exit program can be registered for the CHG exit point and up to ten exit programs can be registered for the RTV exit point.
The IBM i command analyzer support for the QIBM_QCA_RTV_COMMAND exit point has been enhanced via PTF for 7.1 (SI45985).
Before the PTF, the registered exit programs were always called just before control was transferred to the command processing program (CPP) associated with the command being run. After the PTF is applied, you will be able to register an exit program for the QIBM_QCA_RTV_COMMAND exit point and indicate that you want the exit program to be called after control returns from the CPP.
The limit of ten registered exit programs remains the same, but after the PTF some of those exit programs can run after the command runs. Any combination of before and after exit programs is allowed so long as there are no more than ten exit programs for the command. For example, you could have no exit programs called before the command runs and 5 exit programs called after the command runs, or you could have 7 exit programs called before the command runs and 3 exit programs called after the command runs.
You can use the Add Exit Program command (ADDEXITPGM) or the Add Exit Program (OPM, QUSADDEP; ILE, QusAddExitProgram) API to register an exit program for a command. You must specify at least 20 bytes of exit program data when registering an exit program for the QIBM_QCA_RTV_COMMAND exit point. The first ten characters specify the command name and the second ten characters specify the library name for the command you want your exit program to be associated with.
If bytes 21-30 of the exit program data contain the value *AFTER, the exit program will be called after the command processing program has run. If bytes 21-30 contain a value other than *AFTER (for example *BEFORE), or if only 20 bytes of exit program data are specified, the exit program will be called before the command processing program is run.
For example, if you want to register an exit program that will be called after the CRTLIB (Create Library) command in library QSYS has run, use the following ADDEXITPGM command:
ADDEXITPGM EXITPNT(QIBM_QCA_RTV_COMMAND) FORMAT(RTVC0100)
PGMDTA(*JOB 30 'CRTLIB QSYS *AFTER ')
This command will register exit program MYEXITPGM in library MYLIB for the QIBM_QCA_RTV_COMMAND exit point for command CRTLIB in library QSYS. Program MYEXITPGM will be called after the CRTLIB command has run because bytes 21-30 of the PGMDTA parameter contain the value *AFTER.
Additional information on the changes for the QIBM_QCA_RTV_COMMAND exit point can be found in the PTF cover letters.
See the IBM i Knowledge Center for details: Command Analyzer Retrieve Exit Program.
Was this topic helpful?
10 January 2020