PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Sabherwal, Balvinder (MBS)" <Balvinder dot Sabherwal at mortgagefamily dot com>
Subject: RE: Question on proc execution with sybperl
Date: Sep 24 2004 5:36PM

Here are the callback routines that I'm using. I'm ignoring all the msgs.
Where severity is <= 10 in it. The proc's are not printing any messages that
are being set in the $errmsg. I think it's the server that is echoing back
the proc execution. If I comment out the callback line for the server
messages, it works fine. The problem with that is if there are any errors,
I'll not be able to check that.

Any pointers will be great!!

Thanks

sub msg_cb
{
    my($layer, $origin, $severity, $number, $msg, $osmsg, $dbh) = @_;
#    my $errmsg;

    $errmsg .= "\nOpen Client Message: (In msg_cb)\n";
    $errmsg .= "Message number: LAYER = $layer ORIGIN = $origin ";
    $errmsg .= "SEVERITY = $severity NUMBER = $number \n";
    $errmsg .= "CT-Library error:\n\t $msg \n";
    if (defined($osmsg))
    {
        $errmsg .= "Operating System Error:  $osmsg \n";
    }
    CS_SUCCEED;
}

sub srv_cb
{
    my($dbh, $number, $severity, $state, $line, $server, $proc, $msg) = @_;
#    my $errmsg;
    # If $dbh is defined, then you can set or check attributes
    # in the callback, which can be tested in the main body
    # of the code.

#    $errmsg .= "\nServer message: (In srv_cb)\n";
    $errmsg .= "Message_number $number, Severity $severity, " if ( $severity
gt "10" );
    $errmsg .= "State $state, Line $line \n" if ( $severity gt "10" );
    if (defined($server))
    {
        $errmsg .= "Server : $server \n" if ( $severity gt "10" );
    }
    if (defined($proc))
    {
        $errmsg .= " Procedure $proc \n";
    }
    $errmsg .= "Message String: $msg \n" if ( $severity gt "10" ) ;
CS_SUCCEED;
}

-----Original Message-----
From: owner-sybperl-l@peppler.org [mailto:owner-sybperl-l@peppler.org] On
Behalf Of Michael Peppler
Sent: Friday, September 24, 2004 1:39 AM
To: 'sybperl-l@peppler.org'
Subject: Re: Question on proc execution with sybperl

On Thu, 2004-09-23 at 21:57, Sabherwal, Balvinder (MBS) wrote:

> I have a script that is executing a proc on Sybase 12.5.0.3 ASE with
> the below code. 

> $dbhS->ct_sql("exec $opt_D..proc_arch_mt $glun");  ## Archive this
> GLUN
> 
>    if ( defined($errmsg) )         ## Make sure there were no errors
> in the last sql execution.
>    {
>       msg_send("$opt_N","MT_Arch.pl Failed for $opt_D on $opt_S " ,
> "Script failed due the errors below.\n$errmsg\n","$mailto","$pto");
>       exit(1);
>    }

> Upon execution, It fails with the error message as below. Can some one
> point me to the solution so I do not get this message back?

>          Script failed due the errors below.
> 
>  Procedure proc_arch_mt 

There's not enough in the code snippet above to determine why $errmsg
gets set.

My guess is that you need to define a server callback or change the one
you already have to ignore certain types of messages from the proc.

Michael
-- 
Michael Peppler                              Data Migrations, Inc.
mpeppler@peppler.org                       http://www.peppler.org/
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short
or long term contract positions - http://www.peppler.org/resume.html