Hi
Can anybody help me with the commands needed to launch a DI Job (containing other DI jobs and an input file)?
It is on Linux and it has to be a shell script.
Thanks in advance
Kind regards
Andreas
The shell script will return any SAS session RC. Whether it's easy or not capture this depends on how you will call/execute the scripts.
Now you are outside SAS. So this information is best gathered from your Linux or batch admin.
Deploy your DI job. The command line is part of the deployed jobs meta data.
This user guide topic might be relevant: SAS(R) Data Integration Studio 4.9: User's Guide
The command-line deployment tool enables you run an Ant script to deploy one or more jobs through a simple command-line interface.Use other software to schedule the job for execution.
Interesting, I've managed to miss the feature.
But I think the OP asked for how to launch a deployed job, not launch the deployment itself. So I think your answer suits this thread better :
But when we are at the topic, the described process seems a bit tedious. And I wonder what kind of requirement led you to develop this? I have never been in a project were it made sense to auto-deploy jobs, especially in batch.
If you are looking to make promotion process easier, here are some wished for features (ideas free of charge... 😞
Thanks for your reply, Linus! I knew that your answer was simpler and more direct than mine. But if you wanted to automate both the deployment and the execution of the job, I thought that you might be able to use the method in the topic above to deploy the job in batch and then use a scheduler to actually execute the job in batch. In any case, I'll pass your suggestions along to development. Thanks again for your patience and for taking the time to reply.
Thanx, the pleasure is on my side
Hi
Thank for all the input but I think you are talking about deploying and not executing.
When I deploy my SAS DI job I get my .sas file
I now want to execute it using a shell script.
Do you have an example/doc for this issue?
Thanks in advance
To run a SAS program stored as a .sas file in batch, you need the following commandline:
/path_to_sas/sas -config your_sasv9.cfg -autoexec your_sasv9_autoexec.sas -log your_logfile.log programname.sas
autoexec and config can/must be used to set an environment that corresponds to the environment your DI studio uses.
Thanks.
I will implement this.
Is there also an easy way to capture the returncode of the job to use in errorhandling of the shell?
The shell script will return any SAS session RC. Whether it's easy or not capture this depends on how you will call/execute the scripts.
Now you are outside SAS. So this information is best gathered from your Linux or batch admin.
Immediately after the execution of a command, the shell assigns the return code to the environment variable "?".
So, the next line after the one that calls SAS should look like
RC=$?
Now you have stored the return code of the SAS job in RC (use $RC to retrieve the value) and can use it.
IE if I find RC=0, I check the log file for certain phrases that indicate errors that SAS will not flag on its own (some peculiar FTP protocol answers from IBM mainframes come to mind), and set special error conditions if I encounter one. RC
The last line of the shell script is then
exit $RC
Thanks for the helpfull info.
1 question I still have 🙂
I have inserted this code and it works.
/sas/config/Lev1/SASApp/sas.sh -log /sas/common/Logs/test.log -sysin /sas/config/Lev1/SASApp/SASEnvironment/SASCode/Jobs/Jobflow_cons.sas
#----------------------------
# RETURN CODE
#----------------------------
STATUT=$?
Now I want to pass 2 parameters to the DI job.
How do I do that?
parameters are : ${MTH_REF} and ${LOG_FILE}
Thanks again for the help
before the line where you call sas.sh, insert
export MTH_REF=xxxxxx
export LOG_FILE=yyyyyyy
Then you will be able to retrieve the values in SAS with the %sysget function.
Note the "export" command, which tells the UNIX shell to put the new environment variables in the global table, which is inherited by child processes.
You can build a shell script the meta data way in SMC Schedule Manager plug in. See online doc or help within the product.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.