The user DLL lets you perform complex processing while updating a database.
This functionality is implemented as an SADELIA or VADELIA BATCH program using a specific call interface. This program is run with a connection to the database.
With an SQL or BTrieve database, the program can be an SADELIA or a VADELIA program using the LOCAL logical server. With an AS/400 database, the program must be an SADELIA program, and must be deployed on the server before running DBTOOL on the client machine.
In the Java version, the program must be a BATCH Visual Adelia program generated in "Standard" Java mode (SADELIA programs are not supported). The classes and resources of the program must be present in the CLASSPATH during its execution.
The following lines must be inserted into the SADELIA program's declaration section:
* Reserved parameter – DO NOT CHANGE NUM_BIN_4 Reserved * Called service number NUM_BIN_4 ActionCode * Contains the number of the initial version involved in the migration phase NUM_E(15,9) Param1 * Contains the number of the intermediate version involved in the migration phase NUM_E(15,9) Param2 * Return code showing the execution status * 0 => execution ok * > 0 => warning, utility continues running * < 0 => error, utility is stopped NUM_BIN_4 ReturnCode PARAM Reserved ActionCode Param1 Param2 ReturnCode |
The ActionCode variable contains the required service number.
Service |
Description |
Required action |
0 |
Reserved. |
Specify 0 in ReturnCode. |
1 |
Reserved. |
Specify 0 in ReturnCode. |
2 |
Query version number. |
Specify the current version number in Param2. Specify the operation status in ReturnCode. |
3 |
Reserved. |
Specify 0 in ReturnCode. |
4 |
Called before playing the PDM section script. |
Perform the operations necessary for your application. Specify the operation status in ReturnCode. |
5 |
Called before playing the Data section script. |
Perform the operations necessary for your application. Specify the operation status in ReturnCode. |
6 |
Called after playing the Data section script. |
Perform the operations necessary for your application. Specify the operation status in ReturnCode. |
The basic update algorithm is:
call_service (reserved, 2, base_version, 0, returncode) do_while base_version < current_version if find_pdm_script (base_version, intermediate_version) = error exit (error) end call_service (reserved, 4, base_version, intermediate_version, returncode) if (returncode <> 0) exit (error) end if execute_pdm_script (base_version) = error exit (error) end call_service (reserved, 5, base_version, intermediate_version, returncode) si (returncode <> 0) exit (error) end if find_execute_data_script (base_version) = error exit (error) end call_service (reserved, 6, base_version, intermediate_version, returncode) if (returncode <> 0) exit (error) end base_version = intermediate_version REDO |