Running Jobs in the Background

Before SAS/IntrNet 9.2, a long-running job would occupy an Application Server until the job was completed. This prevented new jobs from using that Application Server. Starting with SAS/IntrNet 9.2, long-running jobs can run in the background. This new capability releases an Application Server from the pool of Application Servers so that the server can continue to run on its own until the job has completed. Then, the server exits. A new Application Server can be started in the pool service if it is needed for another job.
Long-running jobs also would often exceed the time-outs that are set for the Application Broker, Web server, and Application Server. For example, the Web server typically has a default time-out of 5 minutes. By running the Application Server in the background, certain time-outs can be avoided, and the server can be set up to allow the job to run as long as required. To allow the Application Server to be run in background mode, use the ALLOW_BACKGROUND option. See ALLOW_BACKGROUND for more information.
Starting with SAS/IntrNet 9.2, the APPSRVSET Application Server function has two parameters that are used together to force an Application Server to run in the background. The BACKGROUND parameter removes the Application Server from the pool service so that it can run on its own. The DISCONNECT parameter releases the Application Broker (and subsequently the Web browser) from the Application Server. The Web browser does not have to wait for a job to complete. A message could first be returned to the user indicating that the job is running and where to find any output when it is finished. After the Application Server is disconnected, no further text can be sent back to the Web browser. The results are returned using e-mail or stored for subsequent retrieval. The following code is an example of how to use APPSRVSET to run a job in the background:
data _null_;
rc = appsrvset('background', 300);
file _webout;
put "<html><body>";
put "<h1>The job has been submitted to the server.</h1>";
put "</body></html>";
rc = appsrvset('disconnect');
run;
/* Long-running SAS code here */
You must use the Load Manager -background option to allow programs to request background processing. The background jobs appear in the Load Manager status program under the special service $background.