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

Abort Job if file does not exist - DI Studio 4.6

Reply
Contributor
Posts: 58

Abort Job if file does not exist - DI Studio 4.6

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

Valued Guide
Posts: 3,208

Re: Abort Job if file does not exist - DI Studio 4.6

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 --<-----
Contributor
Posts: 58

Re: Abort Job if file does not exist - DI Studio 4.6

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

Super User
Posts: 5,260

Re: Abort Job if file does not exist - DI Studio 4.6

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
Valued Guide
Posts: 3,208

Re: Abort Job if file does not exist - DI Studio 4.6

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 --<-----
Contributor
Posts: 58

Re: Abort Job if file does not exist - DI Studio 4.6

I used this solution:

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

Thank you all for your help.

Ask a Question
Discussion stats
  • 5 replies
  • 793 views
  • 6 likes
  • 3 in conversation