You can issue pwxcmd commands from a Linux, UNIX, or Windows system through batch files, scripts, or other programs.
You might issue some pwxcmd commands on a regular basis, such as a pwxcmd close command to stop a PowerExchange Listener. In this case, you can create a shell script or a batch file to call one or more pwxcmd commands with its options and arguments.
The following example Windows batch file, pwxcmd_list.bat, verifies that a PowerExchange Listener is active and then closes it:
@echo off
REM -- NAME: pwxcmd_list.bat
REM -- DESCRIPTION: Sample pwxcmd script to display any PowerExchange Listener active tasks
pwxcmd listtask -sv TEST
if errorlevel ==32601 goto noconnect
if errorlevel ==0 goto close
:close
pwxcmd close -sv TEST
if %errorlevel% neq 0 goto noconnect
if errorlevel ==0 goto end
:noconnect
echo %errorlevel%
echo "Could not connect to pwxcmd command handler."
pause
goto end
:end
This script does not use security for pwxcmd commands.
For this script to work, you must configure a PowerExchange Listener to receive pwxcmd commands. For example, to issue pwxcmd commands from the same system where the PowerExchange Listener runs, you might configure a PowerExchange Listener in the dbmover.cfg file, as follows:
LISTENER=(node1,TCPIP,2480)
SVCNODE=(node1,6001)
CMDNODE=(TEST,LISTENER,localhost,6001)
Run the script from the command line. For example, on Windows, run the script, as follows:
C:\Informatica\PowerExchange>pwxcmd_list.bat
The output from the pwxcmd commands in the script appears on the command line or in a file to which you pipe the output on the Linux, UNIX, or Windows system from which you run the script. For example, the output might appear on the command line on Windows, as follows:
C:\Informatica\PowerExchange>pwxcmd_list.bat
PWX-00711 Active tasks:
PWX-00713 0 active tasks
PWX-00726 Close