BookmarkSubscribeRSS Feed
DavidCaliman
Calcite | Level 5

How do I abort a job in data integration studio using the following rule:

- Check if exists a file on the sas server starting with /project/customer*

- Failing that, I need to abort the process

Tks

5 REPLIES 5
jakarman
Barite | Level 11

Depends on your global DI project requirements.
You clould make this part of the autoexec_usermods files or the script starting the associated app-server.
Is it only one job in your project you can do it with some user-coding in the transformation

---->-- ja karman --<-----
DavidCaliman
Calcite | Level 5

To do it with user-coding transformation, does anyone have an example of how to do?

The logic is as follows:

c= count(files(/project/customer*))

if c=0 then

abort(job);

end

LinusH
Tourmaline | Level 20

Check out the SAS external file functions to query directory contents.

Based on the result, use the data step statement ABORT ABEND/RETURN.

This, as Jaap mentioned, could be done in a User Written code transform, or in a Job Pre-code, which is best depends on what you intend to do if there exists files in the directory.

Data never sleeps
jakarman
Barite | Level 11

If you would do it with unix-scripting (usermods file in the appserver configuration) use the Unix manual,
for example a google-hit: http://kenfallon.com/finding-if-one-or-more-files-exist-in-a-directory-using-bash/

Would you do it in your own SAS code,  see: SAS(R) 9.4 Companion for UNIX Environments, Third Edition (dinfo) orSAS(R) 9.4 Companion for UNIX Environments, Third EditionEnvironments, Third Edition (fileexist)

Contact your platform admin for what is the best thing to do in this.

---->-- ja karman --<-----
DavidCaliman
Calcite | Level 5

I used this solution:

http://www.wuss.org/proceedings12/55.pdf

Thank you all for your help.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 5 replies
  • 2114 views
  • 6 likes
  • 3 in conversation