Running Jobs

About Running Jobs

When an aggregation or exception transformation is executed either interactively or in batch, the input table is read. Therefore, the same table is temporarily unavailable for writing by other processes. If another process has already begun writing the table, then the same table is temporarily unavailable for reading by this transformation.
Similarly, when this aggregation or exception transformation is executed, the output tables are written. Therefore, the same tables are temporarily unavailable for reading or writing by other processes. If another process has already started reading the table, then that same table is temporarily unavailable for writing by the transformation.
On z/OS, if the table belongs to a SAS Library that is stored in the traditional z/OS file system, then the lock is on the entire SAS library. It is not just on the individual table. If the SAS library is stored in zFS, or on Windows, or UNIX, the lock is on the individual table.
CAUTION:
Be careful how you schedule runs of the aggregation or exception transformation.
Make sure that other processes such as production jobs that use the same input and output tables are not adversely affected.

Run a Job Immediately

After a job is created, and the transformation within it is defined, the job is ready to be run. To run a job immediately on the SAS Application Server where you are currently logged on, perform the following steps:
  1. If the job is not open on the Diagram tab of the Job Editor window, open it by navigating to the job in the IT Data Marts tree and double-clicking it.
  2. In the toolbar of the Job Editor window, select Run. This action submits the job's source code.
    Process Flow of an Aggregation Job in the Job Editor Window
    Process Flow of an Aggregation Job in the Job Editor Window
  3. The Diagram, Code, and Log tabs are located at the bottom of the window. You can select the Code tab to view the generated code. After the job executes, you can select the Log tab to view the SAS log.
    Note: To see the results of the job in the tree view, right-click in the left panel and select Refresh.
Click Properties to specify the scheduling details and authorization requirements of the jobs.
Note: In the left pane, locate the job that you want to run. Right-click Properties of that job to specify the scheduling details and authorization requirements of the job that you want to run. If you are running a job in a clustered metadata server environment, make sure that the Enable optional metadata macro variables option is set to No. (In most cases, this option is already set to No.)

Deploy a Job for Scheduling

How to Deploy a Job

You can deploy a job so that it can be scheduled to run in batch mode on the default SAS Application Server.
To deploy a job to be run in batch mode, perform the following steps:
  1. In the IT Data Marts tree of SAS IT Resource Management, navigate to the job that you want to deploy.
    Note: By pressing the CNTL key, you can select multiple jobs within an IT data mart to deploy. However, if the server is z/OS, you can deploy only one job at a time.
  2. Right-click the job and from the menu that appears, select Schedulingthen selectDeploy. The Deploy a job for scheduling dialog box appears.
    • Under Windows or UNIX operating environments, the following dialog box appears.
      Deploying a Windows or UNIX Job for Scheduling
      Deploying a Windows or UNIX Job for Scheduling
    • Under the z/OS operating environment, the following dialog box appears.
      Deploying a z/OS Job for Scheduling
      Deploying a z/OS Job for Scheduling
  3. The batch server, the deployment directory, and the name and path of the job that you selected are the default values that are displayed in this window.
    • The Batch Server field contains the server where the job is to be executed.
      Note: Jobs should be deployed to a server that is defined in the Foundation repository.
    • The Deployment Directory field specifies the physical path to the directory where the generated code for the job is stored. From the drop-down list, select a different deployment directory. Select New to open the New directory window where you can define a new deployment directory.
      • If you define a new deployment directory in the Windows or UNIX operating environments, the new deployment directory will contain the SAS source code for the job.
      • If you define a new deployment directory in the z/OS operating environment, the new directory contains a file that has the SAS source code for the job. It also contains a file of the generalized job control language (JCL) that can run the job. You can modify this generalized file of JCL according to the requirements of your site.
      Note: The JCL Deployment Directory can be deployed to a zFS location or a traditional file system (PDS).
    • The Deployed Job Name field specifies the name of the file that contains the generated code for the selected job. You can edit the default name, but the name must be unique in the context of the Deployment Directory that was previously specified. This field is available only when you deploy a single job. When you deploy multiple jobs, the filename is the same as the job names, but the name has a .sas extension.
      The default value of the Deployed Job Name that is displayed is based on the name of your Job object. Therefore, you might need to revise the name in order to make it a legal filename on the operating system to which it is being deployed.
      Note: For z/OS traditional file system locations, if the Deployment Directory name points to a partitioned data set (PDS), then the deployed job name specifies a member name for that PDS. The member name of the PDS cannot exceed 8 characters.
    • The Location field contains the path to the Folders tree that contains the job. Click Browse to open the Select a Location dialog box where you can select another location.
    Note: For more information about the fields on this window, click Help.
  4. Click OK to deploy the job.
  5. The code is then generated for the job and stored in the directory that is specified. If the deployment is successful, a message is displayed confirming that result. Metadata about the deployed jobs is saved to the current SAS Metadata Server. A status window is displayed and indicates whether the deployment was successful. Another object with the same name as the deployed job is stored in the IT Data Marts tree. This deployed job can be identified by the deployed job icon: Deployed Job Icon. This deployed job is now available for scheduling.
If you update a job or if your computing environment changes, you must redeploy it so that the latest version of the job is the available for execution. For example, if you add, remove, or change a transformation in a job, you must redeploy it for those changes to take effect.
Note: You can also deploy batch jobs from the command line. For information, see Overview of Using a Command Line to Deploy Jobs.

Schedule a Job to Run in Batch

After you deploy a job for scheduling, you can deploy it using any scheduling software that is available in your operating environment. An administrator can set up and run your job with any of the following types of software:
  • any scheduler that is built in to your operating system.
  • any third-party scheduler.
  • the Schedule Manager plug-in to SAS Management Console. This software can define a flow, add one or more deployed jobs to it, and schedule the flow to run.
Note: For more information about scheduling, see Scheduling in SAS. This document is associated with plug-ins to SAS Management Console. It is available at http://support.sas.com/documentation/onlinedoc/sasmc/index.html.

How to Schedule a Job Using a Built-In or Third-Party Scheduler

The deployed job is a file that contains SAS code. In order to schedule it using a built-in or third-party scheduler, you must supply an appropriate invocation of SAS, which runs this code.
Windows Specifics: You need to supply a batch file.
UNIX Specifics: You need to supply a shell script.
z/OS Specifics: You need to supply the JCL. A file of JCL that can be modified according to the requirements of your site can be found in the deployment directory that you selected.
This invocation must invoke the correct version of SAS with the configuration that is specified in the SAS IT Resource Management installation and configuration instructions.
To run batch jobs using the same SAS configuration as for the application server, depending on platform, do the following:
Windows Specifics: Run the sas.bat shell command in the configured application server, which is located here: <config-dir>\Lev1\SASITRM\sas.bat
UNIX Specifics: Run the sas.sh shell command in the configured application server, which is located here: <config-dir>/Lev1/SASITRM/sas.sh
z/OS Specifics: For USS tasks, run the sas.sh shell command in the configured application server, which is located here: <config-dir>/Lev1/SASITRM/sas.sh
z/OS Specifics: For traditional batch jobs, use the generated PROCLIB member PROCENW0 (or the equivalent for other languages). For example, run this: &<CONFIGDIR>.PROCLIB(PROCENW0)
For more information about how to invoke SAS on your operating system, see SAS Companion for the Microsoft Windows Environment, SAS Companion for UNIX Environments, or SAS Companion for z/OS, as appropriate.
After you have set up the SAS invocation, you can then use your preferred scheduler to add this job to the script, batch file, or JCL that invokes SAS. For example, on UNIX, you can use `cron' and add the shell script invocation to the crontab file. For third-party schedulers and for schedulers that are supplied as part of the operating system, follow the documentation for that scheduler.

How to Schedule a Job Using the Schedule Manager in SAS Management Console

To schedule a job to run in batch mode, perform the following steps:
  1. On the main navigation tree of SAS Management Console, right-click Schedule Manager. From the drop-down list, select New Flow to open the New Flow window.
    New Flow Window in SAS Management Console
    New Flow Window
  2. In the Name field, enter the name of the job flow. (The name cannot contain spaces.)
  3. Use the drop-down arrow to select the server that you want to use.
    If you want to specify a new scheduling server, select New. The New Scheduling Server wizard opens. Respond to the prompts as required.
    Note: When selecting a scheduling server, make sure that the server is under the Foundation repository.
  4. From the Available Jobs column, select the jobs that you want to schedule. Use the arrow to transfer those jobs to the Selected Jobs column. (In the preceding display, the NewServerFlow called Server_Disk_Aggregation job is selected for scheduling.)
  5. Click Properties to specify the scheduling details and authorization requirements of the jobs.
    Note: If you are running a job in a clustered metadata server environment, make sure that the Enable optional metadata macro variables option is set to No. (In most cases, this option is already set to No.)
  6. Click OK to define the job flow.
    SAS Management Console Window Showing Scheduled Job Flow
    SAS Management Console Window Showing Scheduled Job Flow
  7. Select the new flow under Schedule Manager.
  8. (Optional) Highlight the flow and select Actionsthen selectManage Dependencies. The Manage Dependencies dialog box appears, where you can specify one or more conditions that control the starting of the current job.
    Manage Dependencies Dialog Box
    Manage dependencies dialog box
  9. Select Actionsthen selectSchedule Flow. The Schedule Flow dialog box appears.
    Select a Trigger to Start the Current Flow
    Select a Trigger to Start the Current Flow
  10. From the drop-down list, select when to run the flow—to run now or to run manually. Click Options to open the Trigger Options box on which you can select a trigger to start the flow, such as a specific date, time, and recurrence. Click OK. When prompted, enter a user ID and password for the scheduling server. A message is displayed confirming the successful scheduling of the job.
For information about the functions that can be performed from SAS Management Console, and options that can be specified when scheduling flows, see the online Help for the Schedule Manager plug-in to SAS Management Console and the SAS Management Console: User's Guide.

Redeploy a Job

If you update a job that you already deployed, you must redeploy it so that the latest version of the job is scheduled. For example, if a table is deleted from a job, then the job must be deployed again.
To redeploy a job, perform the following steps:
  1. In the IT Data Marts tree of SAS IT Resource Management, navigate to the job that you want to redeploy. You can select multiple jobs within an IT data mart to redeploy.
  2. Right-click the job and from the menu that is displayed, select Schedulingthen selectRedeploy.
    The Redeploy a job for scheduling dialog box appears.
    • Under Windows or UNIX operating environments, the following dialog box appears.
      Redeploying a Windows or UNIX Job
      Redeploying a Windows or UNIX Job
      You can choose to preserve the deployed value of the job's metadata. However, you can change where the job is redeployed by changing the deployment directory and its location. If you define a new deployment directory in the Windows or UNIX operating environments, the new deployment directory will contain the SAS source code for the job. If you change the value in the Batch Server field, make sure that the server that you specify is under the Foundation repository.
      A message displays the name of the jobs that will be redeployed. These jobs are all the deployed jobs that are contained on the server that you are connected to. Click Yes to redeploy them.
    • Under the z/OS operating environment, you can also choose to preserve the deployed value of the job's metadata. If you want to change where the job is redeployed, select a new value for the Deployment Directory field. If you define a new deployment directory in the z/OS operating environment, the new directory contains the SAS source code for the job. It also contains a file of the generalized JCL that can run the job. You can modify this generalized file of JCL according to the requirements of your site.
      The following dialog box appears.
      Redeploying a z/OS Job
      Redeploying a z/OS Job for Scheduling
  3. A message appears that lists the jobs that were redeployed. If a job was not redeployed, an error message appears.

Redeploy All Jobs on the Server

If you made changes that affect all jobs that are deployed on the server, you must redeploy them so that the latest versions of the jobs are scheduled. For example, if the computing environment of the server where the deployed jobs are stored changes, the jobs must be deployed again.
Note: The code that is generated for a job contains the credentials of the person who created the job. If those credentials have changed, and a deployed job contains outdated user credentials, the deployed job will fail to execute. In that case, redeploy the job with the appropriate credentials.
To redeploy jobs, perform the following steps:
  1. From the menu bar of the SAS IT Resource Management client, select Toolsthen selectRedeploy Jobs for Scheduling.
    Tools Menu of SAS IT Resource Management
    Tools Menu of SAS IT Resource Management
    A message then displays the names of the jobs that will be redeployed. These jobs are all the deployed jobs that are contained on the server that you are connected to. Click Yes to redeploy them.
  2. Under the z/OS operating environment, you can choose to preserve the deployed value of the job's metadata. If you want to change where the job is redeployed, select a new value for the Deployment Directory field. If you define a new deployment directory in the z/OS operating environment, the new directory will contain the SAS source code for the job. It will also contain a file of the generalized JCL that can run the job. You can modify this generalized file of JCL according to the requirements of your site. Code is generated for the jobs that you redeployed. The code is saved to the deployment directory of the SAS Application Server that is used to deploy jobs.