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

Ignore Error in transformation

Reply
Occasional Contributor
Posts: 12

Ignore Error in transformation

Hi,

 

I'm altering a job in Data Integration Studio that has a user written transformation. 

I want the transformation to be ignored in case it returns an error and the job to end successfuly. Any idea how to do this?

Respected Advisor
Posts: 3,908

Re: Ignore Error in transformation

[ Edited ]

@Ricardo_Neves

I'd consider this bad design. If the user written code throws an error for conditions where it shouldn't then amend your user written code to deal nicely and in a controlled manner with such conditions.

 

The consequence of just ignoring/reseting an error condition: You'll miss the cases where it's an error condition which is caused by something where you actually want the job to end with errors. 

 

I strongly recommend that you amend your user written code and if you don't know how then post the code here and ask the questions.

 

If you really want to go for ignoring/reseting an error condition then look into S
SYSCC

http://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#p11nt7mv7k9hl4n1x...

 

I'm not sure though that you really can suppress/reset all error codes (some stuff is readonly). You almost certainly would have to implement all such checks at the end of your current user written code and before any DIS generated error handling at the end of each transformation comes into play. But again: I strongly recommend that you amend your user written code instead of trying to work around the existing code.

Occasional Contributor
Posts: 12

Re: Ignore Error in transformation

Hi @Patrick,

The Error the code is throwing is due to the email service of the server being down, not due to errors in the code. We just don't want our chain to stop because of that again, because the email part is for control only.
Respected Advisor
Posts: 3,908

Re: Ignore Error in transformation

Hi @Ricardo_Neves  

Your user written code encounters a condition (email server down) where you don't want the error passed down to the calling process. That's a shortcoming of your code as implemented. Amend your code so that it deals nicely with such a condition. 

 

I can think of two approaches.

1. (preferred) use FUNCTIONS (not statement) filename() and fopen(). This let's you check return codes without getting the error passed down to SAS if something is not available.

2. generate the "send email" code and batch submit it as a separate process out of your SAS program (with options noxwait and noxsync). The batch submitted process will still end with error if the mail server is not available but your calling process shouldn't receive this error code. You'd still have the 2nd job ending with error which in a production environment with job monitoring is something "ugly". The advantage of approach 2 would be: It always works as intended even if the mail server should go down in the middle of the process where you write the email out of SAS.

 

I can't easily test any of above options right now - but they should both work. May be someone else comes up with an even better approach.

 

Thanks,

Patrick 

Occasional Contributor
Posts: 12

Re: Ignore Error in transformation

@Patrick thanks for your help,

I think we managed to solve the problem by changing the return code in the unix process, this way the DIS job still returns an error but the next process still executes.
Respected Advisor
Posts: 3,908

Re: Ignore Error in transformation

[ Edited ]

@Ricardo_Neves

Yep, that works for now but it's imho a brute force approach which fights the symptoms and not the cause. You're now also going to suppress other error conditions you didn't think about.

Occasional Contributor
Posts: 12

Re: Ignore Error in transformation

"it's imho a brute force approach which fights the symptoms and not the cause."

 

@Patrick I agree it's a brute force approach because I don't know a lot of error handling in SAS and I don't know the functions you mentioned.

 

But I created a separate job just for sending the email, and since sending the email isn't an essential part of the process, I guarantee that the chain of events isn't stopped by any problems related to sending the email and this way I still get the error report. 

 

I wasn't the one writting the code for sending the email, but here it is in case you or anyone has a idea for a more clean solution:

 

%macro envia_email;
%let datetime_var = %sysfunc(time(),hhmm.);
%let RC2=%eval(&SYSERR);
%let RC1=%eval(&SYSRC);

%IF &RC1=0 AND &RC2=0 %then %DO;
	FILENAME Mailbox EMAIL
	TO=(&VAR_GALILEU_EMAIL_LIST.)
	Subject="PTC | &VAR_GLOBAL_AMBIENTE. | PDS da cadeia &VAR_ODATE_CHAR. "
	attach=(&File  content_type="application/xlsx");
	DATA _NULL_;
	FILE Mailbox;
	PUT "Segue em anexo o ficheiro do PDS.";
	PUT " ";
	PUT " ";
	PUT "Não responda a este email";
	PUT "----------------------------------Auto-reply-----------------------------------------------";
	RUN;
%END;

%mend envia_email;
%envia_email;
Ask a Question
Discussion stats
  • 6 replies
  • 208 views
  • 2 likes
  • 2 in conversation