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

executing an x command based on a return code

Reply
Contributor
Posts: 31

executing an x command based on a return code

Good Morning all,

 

I'm trying to do something which I believe is relatively simple, but cannot find any sort of examples of how to do..

 

I have a DI studio (4.901) job with several transformations. this basically reads files in, performs some minor editing, and outputs the results into larger staging table . When a particular transformation (table loader) completes WITHOUT error, I'd like to have an x cmd run to copy/move the file I have just processed into an archive dirrectory.

 

I have added the x cmd to postcode already for testing, and it works as I need it to:

 

X cp -a /dmadata/AS400/CDH_* /dmadata/AS400_ARCH/;

 

this will copy my 'CDH_xxxxxxxxxxxx' table into an archive directory '/dmadata/AS400_ARCH/'

 

now, I want to add a return code check to ensure that the transformation was successful PRIOR to this copy statement.

I have read about using the status handling tab, but all examples I have read about reference adding a record to an error log, or a adding to a table. I dont want to create a macro just for this if possible. I'd like to keep all my code within the transformation.

 

any ideas?


Regards,

-Chris N.

- Chris N.
Contributor
Posts: 31

Re: executing an x command based on a return code

ok.. so,

 

I just tried something I hadn't done before. In the status handling tab, maybe due to overthinking the solution.

I set up a successful condition, and in 'action options', I added my x cmd in the 'value'.

 

It seems to work based on my quick tests and changing the value from 'successful' to 'error' and back again to see what happens.

 

is this really the correct way to do this from a code standpoint..?

I've learned over time, that just because something works, it's not always the best code practice to accomplish the given task.

 

 

 

 

- Chris N.
Ask a Question
Discussion stats
  • 1 reply
  • 98 views
  • 0 likes
  • 1 in conversation