BookmarkSubscribeRSS Feed
helannivas88
Obsidian | Level 7

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

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

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.

helannivas88
Obsidian | Level 7
Thanks Chris...Can I have an example please???
ChrisNZ
Tourmaline | Level 20

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;

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 764 views
  • 1 like
  • 2 in conversation