Technical Blog Post
Abstract
How to run a Connect:Direct process from a Windows batch file.
Body
There might be times where you want to run a Connect:Direct procedure from a batch file rather than the Connect:Direct Requester, how can this be done?
There are a couple of ways to get this done. Let’s look at the first method.
METHOD 1:
First create your procedure; the easiest way is to use the Requester. For this example I will use the Sample .cdp. The contents of the sample.cdp are:
/*BEGIN_REQUESTER_COMMENTS
$PNODE$="HAZELR.CD460" $PNODE_OS$="Windows"
$SNODE$="HAZELR.CD460" $SNODE_OS$="Windows"
$OPTIONS$="WDOS"
END_REQUESTER_COMMENTS*/
SAMPLE PROCESS
SNODE=HAZELR.CD460
STEP1 COPY
FROM (
FILE=C:\IBMSterling\Server\Process\Sample.html
)
TO (
FILE=C:\IBMSterling\Server\Process\Verify.html
DISP=RPL
)
PEND
The next step will be to create a text file, often referred to as the commands text file. For this example I will call it sample.txt, it will contain the line:
sub file=<path>\sample.cdp...for example
sub file=\Program Files(x86)\Sterling Commerce\Connect Direct v4.6.00\Server\process\sample.cdp
You will now create the batch, in this case sample.bat or sample.cmd, it will contain:
cd <path>\Common Utilities
direct <…\sample.txt
Assuming sample.txt is in the Common Utilities folder, in the real world it will look more like:
cd \Program Files(x86)\Sterling Commerce\Connect Direct v4.6.00\Common Utilities
direct <sample.txt
Alternatively, if you have used the LCU.bat to create a cddef.bin (this is the default name but you can give another name if need be) file the sample.cmd file would be:
cd \Program Files(x86)\Sterling Commerce\Connect Direct v4.6.00\Common Utilities
direct -fcddef.bin<sample.txt
Executing sample.cmd will then cause the sample.cdp process to be executed in Connect:Direct.
METHOD 2:
In this example the commands text file will contain the actual Connect:Direct commands. In this case the commands text file would contain:
submit
SAMPLE PROCESS
SNODE=HAZELR.CD460
STEP1 COPY
FROM (
FILE=C:\IBMSterling\Server\Process\Sample.html
)
TO (
FILE=C:\IBMSterling\Server\Process\Verify.html
DISP=RPL
)
PEND;
In this example the sample.cmd file will be the same:
cd \Program Files(x86)\Sterling Commerce\Connect Direct v4.6.00\Common Utilities
direct <sample.txt
or
cd \Program Files(x86)\Sterling Commerce\Connect Direct v4.6.00\Common Utilities
direct -fcddef.bin<sample.txt
AUTOMATION:
If you plan to automate the batch files you will want to use the LCU.bat to create the cddef.bin (or equivalent) file for use in the batch file to avoid problems with attaching to the Connect:Direct server.
To automate you can use the Windows Task Scheduler, or a third party scheduler, to kick the batch files off.
UID
ibm11123971