BookmarkSubscribeRSS Feed
L2Fly
Pyrite | Level 9

Hello SAS community,

 

On Windows server, does anyone used a batch file .bat or PowerShell to start a SAS Flow under Schedule Manager?

 

I was trying to use File dependency to run bunch of jobs within a flow http://go.documentation.sas.com/?docsetId=scheduleug&docsetTarget=n143fd9raligavn1qapnwkhv35w7.htm&d... but for some reason don’t see this option Actions->Add File Event from SMC even with my SAS Admin account.

 

Using Query Builder I have created some tasks and loaded them into LASR, running the scheduler once from the query builder will create an entry under schedule manager and I added all of them into a flow to execute all of them via a File Dependency.

 

Is it is possible to write a .bat file that I can call with another external process to start the SAS Flow?

 

Much appreciated your comments and input

 

thanks

9 REPLIES 9
LinusH
Tourmaline | Level 20
The file event is available only dor LSF I think.
But you can write your own bat file.
I would still create the flow in, which creates a VBS file. Be aware if that you then need to soothe scheduling part manually.
Data never sleeps
L2Fly
Pyrite | Level 9

Thank you @LinusH for your info.  No problem I can create a bat file but don't know the syntax of how to call the flow.  Do you have any example or URL document that you can pass?

 

thanks again

 

LinusH
Tourmaline | Level 20
That would be Windows shell specific syntax, better learned elsewhere.
Data never sleeps
L2Fly
Pyrite | Level 9

I think I found what I was looking for and testing the concept at the moment.  So when you create a job under SMC you can access the command SAS users to execute the SAS program.  Basically just place this commend into a .bat file and when you run the .bat file it will run your job!

 

D:\SAS\SASConfig\VA\Lev1\SASAppVA\BatchServer\sasbatch.bat -log D:\SAS\SASConfig\VA\Lev1\Logs\vdb_MyQRY_1526417035704_vdb_MyQRY_1526417035704_#Y.#m.#d_#H.#M.#s.log  -batch -noterminal -logparm "rollover=session"  -sysin D:\SAS\SASConfig\VA\Lev1\SASAppVA\SASEnvironment\SASCode\Jobs\vdb_MyQRY_1526417035704.sas

 

I hope it works but this is what I was looking for.

 

thanks

Kurt_Bremser
Super User

This is just the default way for running a single program in batch mode. The sasbatch.bat (or sasbatch.sh on real operating systems) is specifically created for this and should be used, as it guarantees the same environment that you have in a workspace, stored process, OLAP server under the same SAS Application Server.

 

For me, a flow is different from a program, as I'd use the word for a sequence of programs.

L2Fly
Pyrite | Level 9

Hi @Kurt_Bremser thank you for your comment.  I am on a windows environment and what I want to do is to automate the Unload and Load LASR tables in our VA environment.  After research and talking to a SAS consultant I was told the best way for what I want to do is to use Query Builder, create my query by adding my source table (SQL Server table in this case), save and run it once using the scheduler icon.  This would create a job file which basically the code I posted above.  Now I can place that code into a .bat file and call it, it should run the job which is unloading the LASR and then reloading it.  Idea was to add all of the jobs code into a single .bat file.  It almost works, when I look at the log file for that job I see an error.

ERROR: Unauthorized: Check username/password.

ERROR: Unable to connect to Metadata Server.

ERROR: Write access to member ENTLASR.TESTING_SERVICE_TYPE.DATA is denied.

NOTE: The SAS System stopped processing this step because of errors.

 

Thanks again

L2Fly
Pyrite | Level 9

Hi @Kurt_Bremser and @LinusH,

I have created a .bat file with all of my LASR tables and it works.  For example a UnloadLoad.bat contains 10 statements for 10 tables like

D:\SAS\SASConfig\VA\Lev1\SASAppVA\BatchServer\sasbatch.bat -log D:\SAS\SASConfig\VA\Lev1\Logs\vdb_MyQRY_1526417035704_vdb_MyQRY_1526417035704_#Y.#m.#d_#H.#M.#s.log  -batch -noterminal -logparm "rollover=session"  -sysin D:\SAS\SASConfig\VA\Lev1\SASAppVA\SASEnvironment\SASCode\Jobs\vdb_MyQRY_1526417035704.sas

I can put all of these jobs into a flow and I now I am wondering it make is much easier if I be able to just somehow call my flow that contains these 10 jobs. 

When you create a flow, does it create any kind of file that can be called by a program?

 

thanks again

LinusH
Tourmaline | Level 20
I think the flow script is generated when scheduled, or when you issue a Run now from SMC.
It would be nice if the script could be created as a separate task/command.
Data never sleeps

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 9 replies
  • 2776 views
  • 2 likes
  • 3 in conversation