Date: Thu, 21 Feb 2002 09:17:19 -0800
Reply-To: Jack Shoemaker <shoe@STD.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jack Shoemaker <shoe@STD.COM>
Organization: http://groups.google.com/
Subject: Re: Sending email alert when my batch job blows
Content-Type: text/plain; charset=ISO-8859-1
Another approach is to run your SAS programs from within a WNT shell
script. The script can examine the return code and take appropriate
action if the return code is not 0. I posted a sample command script
to this list about a year ago. You can probably find it in the
archives. HTH - Jack
michael@BASSETTCONSULTING.COM (Michael L. Davis) wrote in message news:<5.1.0.14.2.20020219150630.02b33fd8@pop3.norton.antivirus>...
> Hello Jordan and other SAS-L friends,
>
> Creating batch jobs that e-mail when they don't run successfully is like
> "Catch 22", isn't it?
>
> One technique to consider is to have the job write a completion file or
> data set. Then schedule a follow-up job with NT Scheduled Tasks to send an
> email if that completion file is not found. The job should delete the
> completion data set for the next cycle.
>
> The approach that we use at one client site to have successful jobs send a
> normal completion message. When staff arrives and does not see the
> expected message, they know to do some investigating.
>
> - Michael "Mad Doggy" Davis
>
> At 02:37 PM 2/19/2002 -0500, Jordan Hiller <jhiller@EOSBIOTECH.COM> wrote:
> >I'd like to send myself an email if a batch job that I run each night fails
> >due to errors. (I'm Running SAS v8.2 under WinNT.) The problem is that the
> >data _null_ step to send the email won't execute because SAS enters error-
> >checking mode and sets obs=0 after it encounters the first error. Sample
> >code below. Does anybody know a work-around?
> >
> >
> >FILENAME selfmail EMAIL 'Jordan Hiller'
> > emailid="MS Exchange Settings"
> > subject="Batch SAS error"
> >;
> >
> >*Generate an error to test errmail macro;
> >data ErrorMaker;
> >foo;
> >run;
> >
> >************************************;
> >%macro errmail;
> >%if &syserr ne 0 %then %do;
> > data _null_;
> > file selfmail;
> > put "There was an error.";
> > put;
> > put "SysErr= &syserr";
> > run;
> >%end;
> >%mend errmail;
> >************************************;
> >%errmail
> >
> >
> >Thanks,
> >Jordan Hiller
>
> Michael L. Davis
> Vice President
> Bassett Consulting Services, Inc.
> 10 Pleasant Drive
> North Haven CT 06473-3712
> E-Mail: michael@bassettconsulting.com
> Web: http://www.bassettconsulting.com
> Telephone: 203-562-0640
> Facsimile: 203-498-1414
> Messages: 888-477-1412
|