Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Connect:Direct?

by mce (Curate)
on May 19, 2003 at 08:33 UTC ( #259095=perlquestion: print w/ replies, xml ) Need Help??
mce has asked for the wisdom of the Perl Monks concerning the following question:

Hi There,

I am looking for a module that talks with Connect:Direct from sterlingcommerce
Preferably using direct API calls and therefore no system wrappers

I have tried google, super search, cpan, but no luck so far.

Many thanks for your assistance.
---------------------------
Dr. Mark Ceulemans
Senior Consultant
BMC, Belgium

Comment on Connect:Direct?
Re: Connect:Direct?
by physi (Friar) on May 19, 2003 at 09:02 UTC
    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--
    -----------------------------------
    
      Will this capture output into a logfile? or Do you think it can easily be set to do so? I was looking at this in light of our needs and also the fact that system() only returns the exit status, not the output and we need to see the output, or at least the NDM process number(s) for our logs.
        I think it couldt be possible to get the output in a logfile. I will check it tomorow and will give you an update, or probably a full working example code ;-)
        -----------------------------------
        --the good, the bad and the physi--
        -----------------------------------
        
        And here it comes:

        use strict; #### #Change this to your path to the binaries $ENV{NDMBINDIR}='/path/to/your/cdunix/ndm/bin'; my $hostfilename ='yourFilename'; my $localfilename ='yourFilename'; my $conditionname ='yourcondition'; my $wait_for_result = 1; $SIG{USR1} = \&ok; $SIG{USR2} = \&nok; $SIG{ALRM} = \&timeout; alarm(7200); #die after 2 hours # call the subfunction my $log = condirect($localfilename,$hostfilename,$conditionname); # do a endlessloop untill a USR1 or USR2 Signal is received, then end +the loop while ($wait_for_result){ sleep 5; } #The output from connect direct is in $log!!! print "LOG: $log\n"; ### # AND HERE ARE THE SUB's ### sub condirect { my $file = shift; my $hostfilename = shift; my $condition = shift; my $nocondition = $condition."E"; my $LV3FND=`date +%I%M%S%p`; my $WDATE=`date +%d%m`; return `/p/w11b/sp3bf/cdunix/ndm/bin/ndmcli -x << EOJ submit $LV3FND process snode=cdmvs_prod 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`; } sub ok { print "Connect Direct Status OK\n"; $wait_for_result = 0; } sub nok { print "Connect Direct Status NOK\n"; $wait_for_result = 0; } sub timeout { print "Connect Direct Status TEMED OUT!!!\n"; $wait_for_result = 0; }

        -----------------------------------
        --the good, the bad and the physi--
        -----------------------------------
        
Re: Connect:Direct?
by PodMaster (Abbot) on May 19, 2003 at 09:12 UTC
    Did you ask the directconnect/sterlingcommerce people?

    If google/ss/cpan fail, I doubt you'll find anything unless you go to the source.


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
    ** The Third rule of perl club is a statement of fact: pod is sexy.

Re: Connect:Direct?
by nimdokk (Vicar) on May 19, 2003 at 16:26 UTC
    I'm in the same boat myself. We were using Korn shell scripts to run the transfers and I've put them into a module that basically simply forms out to a Korn shell library program. Not clean, but works for now. I'm going to take a closer look at the routine someone posted below. What I'm doing (simplified):

    qx/$ndm_korn_lib $file $DSN $BLOCK $RFORM $RLENGTH/;
    Where $ndm_korn is the path to the Korn library, $file is the file to send, $DSN is the Mainframe dataset and $BLOCK, $RFORM and $RLENGTH are the Blocksize, Record Format and Record Length on the main frame. Not pretty at all, but it seems to work (for the moment).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://259095]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2014-07-13 15:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (250 votes), past polls