http://www.perlmonks.org?node_id=259097


in reply to Connect:Direct?

AFAIK, there's no module available for that, I played around and got that sub, which does the main thing for me:
sub condirect { my $file = shift; my $hostfilename = shift; my $snode = shift; my $condition = shift; my $nocondition = $condition."E"; #--------------------------------------------------------------------- +--- # Environment fuer ConnectDirect setzen #------------------------------------------------------------- +----------- $ENV{NDMLOGDIR}='PATH TO WHERE YOUR C:D IS'; $ENV{NDMPROCDIR}='PATH TO /cdunix/ndm/process'; $ENV{NDMBINDIR}='PATH TO /cdunix/ndm/bin'; $ENV{NDMAPICFG}='PATH TO /cdunix/ndm/cfg/cliapi/ndmapi.cfg'; my $WDATE=`date +%d%m`; my $jobname='Testjob'; return system("/path/to/your/cdunix/ndm/bin/ndmcli -x << EOJ submit $jobname process snode=$snode st01 copy from ( pnode dsn=$file sysopts=\":DATATYPE=BINARY:XLATE=NO:STRIP.BLANKS=NO +:\" ) ckpt=0K compress extended to ( snode dsn=$hostfilename DISP=(RPL,CATLG,DELETE) DCB=(DSORG=PS,LRECL=100,RECFM=VB) ) ifst01 if (st01 le 4) then st01ok run task snode (pgm=CTMCND) sysopts=\"'ADD COND $condition $WDATE'\" run job pnode sysopts= +\"/usr/bin/kill -USR1 $$ \" else st01err run task snode (pgm=CTMCND) sysopts=\"'ADD COND $nocondition $WDATE'\" run job pnode sysopts= +\"/usr/bin/kill -USR2 $$ \" eif pend; EOJ"); }
As you can see, the sub sends a kill-signal to itselfe, USR1 or USR2.
Then you can do something, if connectdirect fails or just ends OK.
This is working for about 2 years now, with no problems.

Hope this helps.

-----------------------------------
--the good, the bad and the physi--
-----------------------------------