Architecting, installing and maintaining your SAS environment

Can you use a batch file .bat to start a SAS Flow object under Schedule Manager

Reply
Frequent Contributor
Posts: 77

Can you use a batch file .bat to start a SAS Flow object under Schedule Manager

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

Super User
Posts: 5,849

Re: Can you use a batch file .bat to start a SAS Flow object under Schedule Manager

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
Frequent Contributor
Posts: 77

Re: Can you use a batch file .bat to start a SAS Flow object under Schedule Manager

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

 

Super User
Posts: 5,849

Re: Can you use a batch file .bat to start a SAS Flow object under Schedule Manager

That would be Windows shell specific syntax, better learned elsewhere.
Data never sleeps
Frequent Contributor
Posts: 77

Re: Can you use a batch file .bat to start a SAS Flow object under Schedule Manager

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

Super User
Posts: 9,866

Re: Can you use a batch file .bat to start a SAS Flow object under Schedule Manager

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Frequent Contributor
Posts: 77

Re: Can you use a batch file .bat to start a SAS Flow object under Schedule Manager

Posted in reply to KurtBremser

Hi @KurtBremser 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

Super User
Posts: 9,866

Re: Can you use a batch file .bat to start a SAS Flow object under Schedule Manager

You may have to set metadata-related system options so that you get access to the metadata server.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Frequent Contributor
Posts: 77

Re: Can you use a batch file .bat to start a SAS Flow object under Schedule Manager

Posted in reply to KurtBremser

Hi @KurtBremser 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

Super User
Posts: 5,849

Re: Can you use a batch file .bat to start a SAS Flow object under Schedule Manager

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
Ask a Question
Discussion stats
  • 9 replies
  • 268 views
  • 2 likes
  • 3 in conversation