Previous Page | Next Page

Getting Started with SAS under OpenVMS

Batch Mode under OpenVMS


What Is Batch Mode?

SAS batch mode is equivalent to OpenVMS batch mode. It is useful for SAS programs that require large amounts of time and memory. In batch mode, you submit a job to an OpenVMS batch queue, and the job awaits execution along with batch jobs that have been submitted by other OpenVMS users. The amount of time before your job executes depends on how many other jobs are in the input queue, on what priority the operating environment has assigned to your job, and how your batch queue is configured.

You can use your terminal for other tasks while the job awaits execution, but you cannot change the submitted job in any way until after it executes.


Files Required for Running in Batch Mode

Usually, the first step in executing a program in batch mode is to prepare two types of files:

COM file

contains the DCL commands that are used to set up the SAS environment. For example, it might include commands that do the following:

  • define OpenVMS logical names

  • set your default directory to access your data

  • invoke SAS with the appropriate SAS system options

program file

contains the SAS program that you want to execute. The name of this file can be included in the text of the COM file, or it can be passed as a parameter to the COM file. The maximum line length for program files submitted in batch mode is 32,867.

See the examples in Examples of Batch Job Files.


Examples of Batch Job Files


Example 1: Separate COM and Program Files

In this example, a file called MYPROG.SAS that contains the following simple SAS program is created first:

libname in 'disk:[directory]';
proc print data=in.mydata;
   title 'A Simple SAS Program';
run;

Next, a COM file called CONTROL.COM that contains the following DCL command is created:

$ SAS92/LINESIZE=76/NODATE [HOME.SUBDIR]MYPROG.SAS

CAUTION:
Do not give your SAS program and the command procedure the same name.

Giving them the same name causes confusion when both the OpenVMS log and the SAS log are created. The OpenVMS log is created first (for example, MYPROG.LOG;1) and the SAS log is created second (MYPROG.LOG;2). If your OpenVMS system has been set up to keep only one version of a file, then the OpenVMS batch log will be overwritten by the SAS log.  [cautionend]

To submit the SAS job, the following command is entered at the DCL prompt:

$ SUBMIT/NOTIFY CONTROL.COM

The job is placed in the default batch queue, and the terminal session is available for other work. You will be notified by the operating environment when your batch job has completed.


Example 2: Passing the Name of the Program File as a Parameter

You can make your COM file more generic and pass the name of the SAS program as a parameter. This is helpful if you want to execute several programs in the same environment. To do this, you would modify the COM file from Example 1 as follows:

$ SAS92/LINESIZE=76/NODATE  'P1'

The 'P1' at the end of the SAS command line is the placeholder for the parameter that you are going to pass to the command.

You could then submit a program called MYPROG.SAS by executing the following command:

$ SUBMIT/NOTIFY/PARAMETER=("MYPROG.SAS") CONTROL.COM


Example 3: Including the Program File in the COM File

A third alternative is to include the SAS program in the same file as the control commands. In a batch environment, the OpenVMS system assumes that the input source is the COM file that is executing. This input source is named by the OpenVMS logical name SYS$INPUT. To combine the control commands and the SAS program in the same file, create a command file that contains the following lines:

$ SAS92/LINESIZE=76/NODATE-
   /PRINT=DISK:[DIRECTORY]MYPROG.LIS-
   /LOG=DISK:[DIRECTORY]MYPROG.LOG SYS$INPUT
libname in 'disk:[directory]';
proc print data=in.mydata;
   title 'A Simple SAS Program';
run;

endsas;

The hyphen at the end of the first line of the SAS command indicates that the command continues on the next line. Designating SYS$INPUT as your input file tells SAS that your input will be included in the text of the COM file. Submit this job as you would any other batch job at your site.

Previous Page | Next Page | Top of Page