Hi,
Problem:
We are changing from using the tcp_tso script to gain access to the Mainframe, to using SAS Spawners on the Mainframe. Using option NLSCOMPATMODE when logging onto SAS on the Mainframe presents a WARNING: message. This message will break jobs run via LSF as the rc is 1.
Potential solution:
A centralised macro is being written to provide all SAS users with a common logon method. To hide the WARNING: message, the macro redirects the log file temporarily while the logon to the Mainframe takes place. The log is then closed, ingested into a dataset and any ERROR: or WARNING: message is reported to the user.
Problem with solution:
The user may have already redirected their log with proc printto. When my macro stops redirecting the log for its own purpose, the log then returns to (in EGuide) the interactive log window, rather than the users redirected log.
Example code:
proc printto log="/user/redirected/log.log" new; run; /* This writes to the users redirected log correctly */
%put I am writing to the log.;
/* When my macro runs, it redirects the log once more, and upon signon completion, closes that log */ %MyMacro; /* This returns to the EGuide log rather than "/user/redirected/log.log" */ %put I am writing to the log again.;
Here's the redirect start and end code from my macro:
%let workdir=%qsysfunc(dequote(&SASWORKLOCATION)); filename lf "&workdir.mf_connect.log"; proc printto log=lf new; run; /*...lots of code here...*/ /* Release the log so we can ingest it. */ proc printto log=log; run;
Am I doing something wrong with the way I end my redirection - such as missing an option that would not force the log back to the 'default' and instead return to the user redirected log?
Hi,
How about first checking if the log is already redirected?
%local localLog;
%let localLog = %superq(SYSPRINTTOLOG);
%let workdir=%qsysfunc(dequote(&SASWORKLOCATION));
filename lf "&workdir.mf_connect.log";
proc printto log=lf new; run;
/*...lots of code here...*/
/* Release the log so we can ingest it. */
%if %bquote(&localLog.)= %then %do;
proc printto log=log; run;
%end;
%else %do;
proc printto log=&localLog.; run;
%end;
All the best
Bart
Hi,
How about first checking if the log is already redirected?
%local localLog;
%let localLog = %superq(SYSPRINTTOLOG);
%let workdir=%qsysfunc(dequote(&SASWORKLOCATION));
filename lf "&workdir.mf_connect.log";
proc printto log=lf new; run;
/*...lots of code here...*/
/* Release the log so we can ingest it. */
%if %bquote(&localLog.)= %then %do;
proc printto log=log; run;
%end;
%else %do;
proc printto log=&localLog.; run;
%end;
All the best
Bart
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.
Ready to level-up your skills? Choose your own adventure.