Script END_DD tab
This tab is used to trigger a script and stop the distribution when a transaction record appears in a specified file.
Purpose
The aim is to trigger a procedure on the target machine at a point of time in the operation, such as for example when all the transaction records in a given batch have been replicated on the target.
To do so, on the AS/400 IBMi machine:
-
Create, for example, an END_DD01 file (the file name must start with END_DD followed by four characters of your choice). You can create the END_DD01 file in any library, as the library is not assigned. However, with non-AS/400 IBMi sources, the table must be created in the database followed by the model.
-
Journalize the END_DD01 file in the same journal as the files to distribute.
-
Perform an I/O on the END_DD01 file at the end of the batch.Information noteWarning: An update operation performs two I/Os so it is preferable for example, to run a CLRPFM or another operation such as the Add operation, for instance.
-
In Talend Change Data Capture, in the parameter definition of the distribution on the desired target, you specify END_DD01 in the name of the END_DD file that triggers the script, and enter the script that must be executed.
During the operation, if the I/O in the END_DD01 file is applied by Talend Change Data Capture for this pair for the selected target, the script is executed on the target, and at the end of the script, the distribution of the model on the concerned target is stopped. If the script is aborted due to an error, the distribution is stopped with errors as well.
If you want to restart the distribution on the selected target, you must do so manually, either using the Supervise tab, or the AS/400 IBMi DDCTL command. The Scheduler does not automatically restart a distribution that was stopped by an END_DD condition.
During your input, you can press the Ctrl+Z keys simultaneously to undo your action.
Name of END_DD file starting the script
This property is used to specify the exact name of the file whose name starts with END_DD, and which triggers the script.
When you enter the file name in this field, the input window of the script is displayed.
Script
Use this window to enter the script to be executed.
The instructions in the script depend on the machine type (target) on which the script will be run (AS/400 IBMi or NT).
Instructions common to AS/400 IBMi and NT targets
Instruction | Description |
---|---|
OnError – Action in the event of an error |
|
ONERROR CONTINUE | Used to specify whether the script must continue to the next instruction, in case an error occurs in the current instruction. |
ONERROR STOP | Used to specify whether the script must stop with errors, in case an error occurs in the current instruction. |
The distribution of the selected model on the target is also aborted with errors.
You can switch the action to be performed in case of an error, at any time.
For example, if you want the default option to be ONERROR stop, except for a file delete operation where you want to continue despite an error, you would code as follows:
ONERROR continue
DELETE File
ONERROR stop
:
The rest of the script
By default, if an error occurs, the script stops.
/* - Comment
/* comment line
This property is used to enter a comment line.
End – Stop replication
END
The script is stopped without flagging an error when this instruction is encountered, and the distribution is stopped.
Without this instruction, the replication procedure continues to the next sequence.
Rconnect – Opens a connection with an AS/400 IBMi machine running Talend Change Data Capture
RCONNECT IP address
Establishes a proprietary connection with the AS/400 IBMi machine that has the IP address you enter.
You can specify the DNS name of the AS/400 IBMi if it is recognized by the NT machine on which the script is run.
Each new connection request closes the previous connection.
RmtCmd – Executes a command on a connected AS/400 IBMi and waits for it to be completed before continuing to run the script
RMTCMD Program in parameter1 …
This starts the command specified in AS/400Command on the AS/400 IBMi machine that was connected using the RCONNECT command.
The parameters are those required by the desired AS/400 IBMi command.
You can use all AS/400 IBMi commands, including CALL.
Instructions specific to AS/400 IBMi targets
You can use all the AS/400 IBMi commands with the same syntax as the one used on the AS/400 IBMi command line.
Example:
CHGCURLIB MYLIB
CALL BIB/PGM
Instructions specific to Windows targets
Instruction | Description |
---|---|
Rule for file name |
You can specify a file name preceded by a unit code, or with the UNC syntax (//server/resource/path). If the name and/or the file path contains a blank, you must put the file designation within quotes (the " character):
You can facilitate file name input, by dragging and dropping from the Windows NT explorer for example, to the script entry window. |
Create – Creates an empty file |
This parameter is used to create an empty file at the specified location. |
Copy – Copies a source file to a destination |
Is used to copy a file to another file. |
Move – Moves a source file to a destination |
|
Delete – Deletes a file |
Is used to delete a file. |
Rename – Renames a file |
Is used to rename a file. |
Shell – Starts a process and continues running the script |
Starts the program designated by ProgramFile with the parameters required in another NT process and continues running the script until the next instruction is found. |
ShellW – Starts a process and waits for it to be completed before continuing to run the script |
Starts the program designated by ProgramFile with the parameters required in another NT process and waits for the program to finish before continuing to run the script until the next instruction is found. |