- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have many ksh files that are passing the same parameters but with different values, then start the same SAS program. If that SAS program is already busy, do we need an option to tell him to wait to end before starting again.
For example, imagine that I have two ksh files PSASA and PSASB. The first one is passing the first parameter = ActMod while the second one is passing the parameter = Quote.
Then the same SAS program is started but with ActMod first, then restarted again with the value Quote.
The issue I observe, I see no error from Control-M but I don't see any log file for the second call.
Any suggestion how to solve that issue?
orderdate=$1
ordertime=$2
surveyname=$3
env=$4
echo $HOME
echo $HOME/bin
$HOME/bin/dapiupa.ksh "$orderdate" "$ordertime" "$name" "$env"
if test $? -lt 2
then
exit 0
fi
exit $?
#--------------------
# Exit procedure
#--------------------
So in the first call name=ActMod while in the second call name= Quote.
%global orderdate surveyname env;
%put =========> &SYSPARM;
%let orderdate = %qtrim(%scan(&sysparm.,1,'|',m));
%let ordertime = %qtrim(%scan(&sysparm.,2,'|',m));
%let surveyname = %qtrim(%scan(&sysparm.,3,'|',m));
%let env = %qtrim(%scan(&sysparm.,4,'|',m));
%let ActualDateTime=%sysfunc(putn(%sysfunc(datetime()),datetime21.2));
%let path1=********; /*Confidential*/
%let logpath=/&path1./logs;
proc printto log="&logpath./logfile_&ActualDateTime..log" new;
run;
OPTIONS SASAUTOS=("&path1./saspgm");
%put %sysfunc(pathname(sasautos));
%put &=orderdate &=ordertime &=surveyname &=env;
%include "&path1./saspgm/TxnCnctImptFrmOra.sas";
run;
%TxnCnctImptFrmOra(&orderdate,&ordertime,&name,jsonf);
run;
proc printto;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Why would it matter that you call the same program multiple times with different inputs?
Will that cause the program to try to write different things to the same place?
I cannot make heads or tails of the code you posted. It seems to be a mix of unix commands and SAS code. The Unix code does not appear to be calling the SAS code anywhere.
If you want to keep the log and listing files generated straight make sure to add the -log and -print options to the command used to start SAS so that each call writes its log to a different file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
orderdate=$1
ordertime=$2
surveyname=$3
env=$4
#-----------------------------------------------------------
# Cron entries do not execute login scripts.
# Let's run it in the context of our current process
#-----------------------------------------------------------
. /etc/profile
#---------------------------------------------------------------------------------
# Read the parameters and excute the SAS function dapuipa.genjcl.sas
#---------------------------------------------------------------------------------
echo "$orderdate|$ordertime|$name|$env"
sas -sysparm "$orderdate|$ordertime|$name|$env" &path1./sassrc/dapuipa.genjcl.sas
The dapuipa.genjcl.sas start with
%global orderdate surveyname env;
%put =========> &SYSPARM; and so on.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
ERROR: Resource is write-locked by another user. File =/..../dapuipa.genjcl.log. System E\
rror Code = 11.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Exactly. You need an identifier to be in the log file that is a unique value. A random number probably wouldn't work because it is a duplicate (normally) for fast submissions (grain of salt here since it is a big subject). If you are submitting in a sequence, just append a counter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@alepage wrote:
ERROR: Resource is write-locked by another user. File =/..../dapuipa.genjcl.log. System E\
rror Code = 11.
This command to start sas:
sas -sysparm "$orderdate|$ordertime|$name|$env" &path1./sassrc/dapuipa.genjcl.sas
will write the log to &path1./sassrc/dapuipa.genjcl.log
So if you run that command twice, and &path1 is the same in both calls, that is likely creating the collision.
So as Tom wrote, try adding the -log and -print options to the command SAS so that each call writes its log to a different file.
Next up: Troy Martin Hughes presents Calling Open-Source Python Functions within SAS PROC FCMP: A Google Maps API Geocoding Adventure on Wednesday April 23.
Register now at https://www.basug.org/events.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Each thread should be on its own. I do not use Unix but have done this type of work numerous times using SAS and/or C#. Make sure you have a unique identifier in each execution so you don't use same resources (ex. log file). You can also do it in SAS. See this entry (Submitting Jobs in Parallel): GitHub - savian-net/SasTipsTricks: Tips and tricks learned over 20+ years as a SAS/Microsoft consult...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
When the dapiupa.ksh file is trigger, 4 parameters are read then use into the sysparm command below
echo "$orderdate|$ordertime|$surveyname|$env"
sas -sysparm "$orderdate|$ordertime|$name|$env" /.../pgm/prod/sassrc/dapuipa.genjcl.sas
I dont know which one is lock by another user: dapuipa.genjcl.sas or dapuipa.genjcl.log
Does FILELOCKWAIT option might be an options and how to use it ?
Do we use it with the *.sas file , or the * .log file or both ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@alepage wrote:
I dont know which one is lock by another user: dapuipa.genjcl.sas or dapuipa.genjcl.log
Does FILELOCKWAIT option might be an options and how to use it ?
Do we use it with the *.sas file , or the * .log file or both ?
The error message you posted is showing that it is the *.log file that is locked.
I don't think FILELOCKWAIT can help you, because this collision is not happening within SAS, it's happening when you try to start SAS. So on the command that starts SAS, you need to point the log to a file that is not in use.
Next up: Troy Martin Hughes presents Calling Open-Source Python Functions within SAS PROC FCMP: A Google Maps API Geocoding Adventure on Wednesday April 23.
Register now at https://www.basug.org/events.