Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Sat, 25 Jan 2003 @ 22:02:59 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: How setup a e-mail notification from mload on failure of job
 
From:   Dennis Calkins

You use perl interface to the utilities like.

     system ('bteq < script > scritp.out');
     open FD, "< script.out"
     while (  )
     {
        process lines
     }

or something a little more complicated.

( I haven't checked this for syntax but the theory is sound ).

    open2( \*Reader, \*Writer, "/usr/ntos/bin/bteq ");

    print Writer  ".logon  user,password"
    &readbteq
    print Writer  "Sel Databasename from dbase;"
    &readbteq
    @mylines = @lines;  /* make sure not to over write the lines
while processing */
    $x = 0;
    foreach @mylines
    {
        if ( /-----------/ )
        {
            $answer = 1;
            next;
        }
        next unless $answer == 1;

        print Writer  "Help Database $_;";
        &readbteq;
        print @lines;
    }
    print Writer  ".quit";

    close Writer;
    close Reader;

sub readbteq
{
    undef @lines;
    while ()
    {
        push @lines,$_;
        if ( /BTEQ command/ )
        {    /* user can enter next command */
           last;
        }
    }
1;
}

The latter has the draw back of having to figure out when to stop reading. I use the BTEQ prompt.

    Enter your logon or BTEQ command:

and

    BTEQ -- Enter your DBC/SQL request or BTEQ command:

both end in /BTEQ command:/ so it means BTEQ is done with its output and is waiting for the next command. Other utilities may have similar things.

The First one is fairly simple and you can even build the script inside the PERL script.

---------------

As for sending MAIL from inside the PERL script you will need a COMMAND line Mail program on WINDOWS or use PERL's Native interface.

There is a command line interface to Microsoft exchange in the Microsoft exchange server resource kit.

C:\\Progra~1\\Exchan~1\\tools\\admin\\mapisend\\mapisend.exe -r userid - u "user name" -p password -s "subject" -t $outfile";

Now where you get a legal copy of this program I don't know. I got mine from My Universal MSDN subscription.

I am sure there are other programs of similiar style.



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016