BookmarkSubscribeRSS Feed
cnilsen
Quartz | Level 8

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.
1 REPLY 1
cnilsen
Quartz | Level 8

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 993 views
  • 0 likes
  • 1 in conversation