SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

job's post code execution on failure case

Accepted Solution Solved
Reply
Contributor
Posts: 23
Accepted Solution

job's post code execution on failure case

The following piece of code in the job's post code gets executed when the job's status is success.

Whereas, when the job fails, this code is not getting executed.

proc export data=lib_comm.TBL_COM_ERR_MASTER
   outfile="&gen_log."
   dbms=dlm replace;
   delimiter='|';
run;

But we could execute a proc sql statement in the job's post code even when the job fails.

Is there are constraints that few statements cannot be executed in the post code when the job fails?


Accepted Solutions
Solution
‎12-05-2012 10:59 AM
Super User
Posts: 5,496

Re: job's post code execution on failure case

OK, that's a good start.

I just want to set the bigger picture first.  When you use terms like "job" and "step" and "failure" those can vary in meaning depending on the operating system.  What is the operating system?  Is this all one long SAS job, so that "step" refers to a DATA or PROC step within the same job?  Does "failure" mean there was a SAS error message, or does it mean something else?

The solution may be as simple as adding something like this just before the PROC EXPORT:

options nosyntaxcheck;

You should certainly consider reversing that right after the PROC EXPORT:

options syntaxcheck;

So here's a possible solution, as well as more questions.

View solution in original post


All Replies
Super User
Posts: 5,496

Re: job's post code execution on failure case

You haven't given much information about what "failure" means.  Did the failed job actually create lib_comm.TBL_COM_ERR_MASTER?  Did it actually create the macro variable &GEN_LOG?  Did the failure occur in the step just before the PROC EXPORT? 

Contributor
Posts: 23

Re: job's post code execution on failure case

Posted in reply to Astounding

a. This job is not creating  lib_comm.TBL_COM_ERR_MASTER. It is already created.
b. &GEN_LOG is a macro global variable and it is also resolved in the job.
c. Failure occurs before the job.

The error is like "this step is stopped" because error occuered before this export.

Solution
‎12-05-2012 10:59 AM
Super User
Posts: 5,496

Re: job's post code execution on failure case

OK, that's a good start.

I just want to set the bigger picture first.  When you use terms like "job" and "step" and "failure" those can vary in meaning depending on the operating system.  What is the operating system?  Is this all one long SAS job, so that "step" refers to a DATA or PROC step within the same job?  Does "failure" mean there was a SAS error message, or does it mean something else?

The solution may be as simple as adding something like this just before the PROC EXPORT:

options nosyntaxcheck;

You should certainly consider reversing that right after the PROC EXPORT:

options syntaxcheck;

So here's a possible solution, as well as more questions.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 309 views
  • 0 likes
  • 2 in conversation