Shell scripts can also be used to invoke the Replicator Engine either directly or using through a request to the local Controller Daemon.
Syntax
sqdrpl <name>.rpl > <name>.rpt 2>&1
The following syntax is used for invoking the Replicator Engine on Linux using the SQDMON utility and a local sqdaemon.
sqdmon <agent_name>
Keyword and Parameter Descriptions
Keyword | Description |
---|---|
<name>.rpl | The name of the Replicator Engine script file used as input to the Replicator. The recommended file extension for the script file .rpl. |
<name>.rpt | Recommended name for the report file produced on demand or at normal termination of the Replicator Engine. |
<agent_name> | Agent name specified in sqdagents.cfg file. Typically the <replicator>.rpl file name without the extension or the name specified as the subscribing Engine in the source Capture/Publisher configuration (CAB) file. |
Example 1
Execute a Db2/z to Kafka Replicator at the command line after first archiving the previous Report (.rpt) and Log (sqdrpl-<pid>.log files renamed with Time Stamps in directories previously created for that purpose.
#!/bin/bash
for f in sqd*_*.log
do
mv -n "$f" ./logs/"$(date -r "$f" +"%Y%m%d_%H%M%S")_$f"
done
for f in *.rpt
do
mv -n "$f" ./rpts/"$(date -r "$f" +"%Y%m%d_%H%M%S")_$f"
done
sqdrpl ./ENGINE/DB2RKAFKA.rpl > DB2RKAFKA.rpt 2>&1
Example 2
Execute a Db2/z to Kafka Replicator managed by a local sqdaemon Controller Daemon using the SQDMON utility after first archiving the previous Report (.rpt) and Log (sqdrpl-<pid>.log files renamed with Time Stamps in directories previously created for that purpose.
for f in sqd*_*.log
do
mv -n "$f" ./logs/"$(date -r "$f" +"%Y%m%d_%H%M%S")_$f"
done
for f in *.rpt
do
mv -n "$f" ./rpts/"$(date -r "$f" +"%Y%m%d_%H%M%S")_$f"
done
sqdmon start DB2RKAFKA
Example 3
When the sqdaemon Controller Daemon is first started, as is typically done following maintenance of the Linux Host system, execute a Db2/z to Kafka Replicator and an IMS to Oracle Apply Engine managed by a local sqdaemon Controller Daemon using the SQDMON utility after first archiving the previous Report (.rpt) and Log (sqdrpl-<pid>.log files renamed with Time Stamps in directories previously created for that purpose.
- Define an ALLENGINES agent in the sqdagents.cfg file with auto_start=yes:
[ALLENGINES] TYPE=program program=./sqdatash.sh args=ALLENGINES working_directory=/home/nTEST/dae_FileDates stderr_file=/home/nTEST/dae_FileDates/ALLENGINES.rpt stdout_file=/home/nTEST/dae_FileDates/ALLENGINES.rpt auto_start=yes
- Define the two engine agents with auto_start=no in the same sqdagents.cfg file.
[DB2TOKAF] type=engine program=sqdrpl args=./ENGINE/DB2TOKAF.rpl working_directory=/home/nTEST/dae_FileDates message=/home/nTEST/dae_FileDates stderr_file=/home/nTEST/dae_FileDates/DB2TOKAF.rpt stdout_file=/home/nTEST/dae_FileDates/DB2TOKAF.rpt auto_start=no [IMSTOORA] TYPE=ENGINE program=sqdata args=./ENGINE/IMSTOORA.prc working_directory=/home/nTEST/dae_FileDates stderr_file=/home/nTEST/dae_FileDates/IMSTOORA.rpt stdout_file=/home/nTEST/dae_FileDates/IMSTOORA.rpt auto_start=no
- Define a shell script sqdatash.sh referenced by the ALLENGINES agent.
#!/bin/bash for f in sqd*_*.log do mv -n "$f" ./logs/"$(date -r "$f" +"%Y%m%d_%H%M%S")_$f" done for f in *.rpt do mv -n "$f" ./rpts/"$(date -r "$f" +"%Y%m%d_%H%M%S")_$f" done sqdmon start DB2TOKAF sqdmon start IMSTOORA