The exit point program it is special program which is run in certain moment of aperio process. Program can calculate something in middle of aperio process then return results back to process. By this it is possible to influence to the aperio job. All exit programs has the same entry parameters:
Parameter | Type | Description | |
---|---|---|---|
len | 10U0 | Mandatory | This parameter is used to pass length of incoming data |
data | varying length data structure which contains entry parameters | Mandatory | This parameter can be freally defined by programer. The type and length of this parameter is not important. As the parameters between programs are passed by reference, the pointer when data entry parameter starts is the starting point of data structure. |
Exit points are called from following points of process in aperio:
Exit Point Name | Description | Structure of data |
---|---|---|
R0005001 | Find program source. Called when aperio tryies to establish location of source for RPG program | program (10A), library (10A), file (10A), member (10A) |
R0005002 | Update parameter. Called before update parameter based on entire source | method (60A), subsetSeq (2P 0), parent (30A), parameter (30A) |
R0005003 | Update parameter. Called after update parameter based on entire source | method (60A), subsetSeq (2P 0), parent (30A), parameter (30A) |
R0005004 | Update method in metadata. Called after method was updated in metadata | method (60A), subsetSeq (2P 0) |
S0005001 | Open files before method program is called. | program (10A), retCode (1A) |
S0001002 | Security program before method call | method (60A), program (10A), user (10A), callStackEntry (30A) retCode (1A) |
This exit point is called when You run option 8=Retrieve parameters in WRKAPIMTH program. This helps to establish correct place for source file for given program. The parameter structure to this program is defined like this:
D gData DS qualified
D program 10
D library 10
D sourceFile 10
D member 10
The aperio, before retrieve parameters, sends program name to exit point. The exit point tries to find where the program has its own source. Exit program puts library, source file and member into data structure and ends. If returned library or soruce file or member is blank then retrieve parameter will not proceed. For example in DC1 the source of programs are kept in the same library as object library. The source file for RPG program is always QRPGLESRC. So, exit point for DC1 just checks where object (program) is located, in which library. Then puts this library to data structure. The sourcefile is hardcoded to QRPGLESRC and member name is the same as program name.
This exit point is called before parameter is updated based on information from entire source of program. The Aperio “Retrieve parameters” procedure reads RPG source from the beginning to the end, and gathers information about all parameters. The same parameter can be described in program several times. For example parameter “customer” could be described by @APIDOC tags when retrieve incoming parameter and also when the response is produced. Aperio gather all this information. The final step is to combine this information and put it into metadata. Before metadata is finally updated, for given parameter, there is chance to run own program and pre-update some information to metadata. This can be done for some specific parameters which should be handled differently. In DC1 we don’t use this exit point. The parameter structure to this program is defined like this:
D gData DS qualified
D method 60
D subsetSeq 2P 0
D parent 30
D parameter 30
Before write information about parameter to metadata, aperio sends method name, subsequence, parent parameter name and parameter name to exit point. The exit point can update metatada prior it is done by retrieve parameter procedure.
This exit point is called after parameter is updated based on information from entire source of program. The Aperio “Retrieve parameters” procedure reads RPG source from the beginning to the end, and gathers information about all parameters. The same parameter can be described in program several times. For example parameter “customer” could be described by @APIDOC tags when retrieve incoming parameter and also when the response is produced. Aperio gather all this information. The final step is to combine this information and put it into metadata. After metadata is finally updated, for given parameter, there is chance to run own program and update some information to metadata. This can be done for some specific parameters which should be handled differently. In DC1 we use this exit point to get additional information from FREF file. The parameter structure to this program is defined like this:
D gData DS qualified
D method 60
D subsetSeq 2P 0
D parent 30
D parameter 30
After write information about parameter to metadata, aperio sends method name, subsequence, parent parameter name and parameter name to exit point. The exit point can update metatada.
This exit point is called after entire method is updated by “Retrieve parameters” procedure. After metadata is finally updated there is chance to run own program and update some information to metadata. This can be done for some specific methods which should be handled differently. In DC1 we use this exit point to update general attribut on method level “openCrossRef”= true. In DC1, the files bust be open before we call any program. This is because we use share access path to files. The parameter structure to this program is defined like this:
D gData DS qualified
D method 60
D subsetSeq 2P 0
After write information about method to metadata, aperio sends method name and subsequence to exit point. The exit point can update metatada.
This exit point is called before each method is run. It may open files if require and perform base security check. The program name is passed to exit point and exit point returns retCode. retCode equal *BLANK means everything is OK:
D gData DS qualified
D program 10
D retCode 1
This exit point is called before each method is run. It gives possibility to write security engine implementing special security rules. The method, program, user and call stack entry name is passed to exit point. It returns retCode. retCode equal *BLANK means everything is OK:
D gData DS qualified
D method 60
D program 10
D user 10
D callStackEntry...
D 30
D retCode 1
To prohibit a user from calling given method, there should be value different than *BLANK in retCode. sendPgmMsg() procedure can be used to send the message from the exit point. callStackEntry value taken from the parameter structure should be used as parameter for sendPgmMsg().
In aperio library in source file QSAMPLES there is skeleton of security exit program and security program example:
*
* Work fields
*
D gData_ptr S * inz(*null)
D gData DS qualified based(gData_ptr)
D program 10
D library 10
D sourceFile 10
D member 10
D XPLEN S 10U 0
D XPDATA S 200
* NOTE: length of XPDATA is not important. It is just to pass pointer
* Starting point for data structure.
C *ENTRY PLIST
C PARM XPLEN
C PARM XPDATA
/FREE
monitor;
//Check if length of passed data structure is corresponding data structure
//in this porgram
if XPLEN > %SIZE(gData);
//For example:
//All my sources are located in MYSRCLIB library in QRPGLESRC source file.
gData_ptr = %ADDR(XPDATA);
gData.library = 'MYSRCLIB'
gData.sourceFile = 'QRPGLESRC';
gData.member = gData.program;
endif;
*INLR = *ON;
on-error;
*INLR = *ON;
endmon;
In aperio library in source file QSAMPLES thee is skeleton of exit program