Technical Blog Post
Abstract
How can Connect:Direct for Windows copy a file to multiple snodes?
Body
A Connect:Direct process can only have one PNODE and one SNODE. The reason being that Connect:Direct establishes a TCP/IP socket connection between the two nodes, this session is only terminated after the process completes. There is no facility within Connect:Direct to terminate then re-establish a session after the process has started. That being said, you can copy a file to multiple destinations by executing only one process directly.
First you create the process sending the file to one of the nodes, next create a second process that first sends the file to the other node then submits the first process.
For Example:
Process1:
/*BEGIN_REQUESTER_COMMENTS
$PNODE$="MyNODE1.CD470" $PNODE_OS$="Windows"
$SNODE$="MyNODE2.CD470" $SNODE_OS$="Windows"
$OPTIONS$="WDOS"
END_REQUESTER_COMMENTS*/
PROCESS1 PROCESS
SNODE=MyNODE2.CD470
STEP10 COPY
FROM (
FILE=c:\temp\testfile1.txt
)
TO (
FILE=c:\temp1\testfile1.txt
DISP=RPL
)
STEP20 SUBMIT FILE="C:\Program Files (x86)\Sterling Commerce\Connect Direct v4.7.0\Server\Process\Process2.cdp"
PEND
Process2:
/*BEGIN_REQUESTER_COMMENTS
$PNODE$="MyNODE1.CD470" $PNODE_OS$="Windows"
$SNODE$="MyNODE3.CD460" $SNODE_OS$="Windows"
$OPTIONS$="WDOS"
END_REQUESTER_COMMENTS*/
PROCESS2 PROCESS
SNODE=MyNODE3.CD460
STEP10 COPY
FROM (
FILE=c:\temp\testfile1.txt
)
TO (
FILE=c:\temp1\testfile1.txt
DISP=RPL
)
PEND
In this example the customer submits Process1.cdp. Process1.cdp will copy the file to MyNODE2.CD470, once the copy is complete Process1 will submit Process2.cdp that will then copy MyNODE3.CD460.
If necessary you could add other steps such as IF/THEN/ELSE testing prior to the submit statement in Process1 so that the second process will not be submitted unless first the copy was successful. You could also add a Run Task to Process2 to it delete/archive the source file after the copy is complete.
UID
ibm11123551