Hi,
I have a systask command running in SAS EG where I'm launching a DB2 clpplus inside that. Below is the command
systask command "echo 'password' | clpplus -nw user@dsn @/home/test.sql"
NOWAIT STATUS=T1_RC TASKNAME=T1_TASK SHELL="bash";
WAITFOR T1_TASK;
%PUT NOTE: RC = &T1_RC;
The above command is exactly correct and if I run , I'm getting the output what Im expecting and T1_RC ouput as 0.
Even when I had the wrong password in the command, the sas logs shows me as Invalid password. But still the return code is zero. Im not able to differentiate success/ failure with this return code.
IS there any other way to capture the return code from systask command?? Please let me know
Thanks
The return code informs you about the success of the command.
The echo command doesn't fail, and the RC correctly tells you that.
You might want to use the pipe engine to run the command, and look at the OS output to assess the result.
Maybe something like:
filename CMD pipe "echo 'password' | clpplus -nw user@dsn @/home/test.sql";
data _null_;
infile CMD;
input;
putlog _INFILE_ ;
*if _INFILE_ = .. .then ...;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.