SAS
REXX execs are REXX programs. They are stored in a library that is
allocated to the SASREXX ddname (or to another ddname, as specified
by the SAS system option REXXLOC=). A REXX exec is submitted as part
of a SAS program in the same way as any other global SAS statement.
To run a REXX exec from
within SAS, do the following:
-
Put the REXX exec in
a partitioned data set and allocate that PDS to the ddname SASREXX.
-
Either invoke SAS with
the REXXMAC option or specify the REXXMAC option later in an OPTIONS
statement.
-
Code a statement that
begins with the name of the REXX exec.
Note: You can invoke a REXX exec
from an SCL program, but you should enclose the statement in a SUBMIT
block. Otherwise, the exec is executed at compile time rather than
at run time.
The following example
invokes a REXX exec called
YOUREXEC
, which
resides in
YOUR.REXX.LIBRARY
. This example
works in both batch and TSO environments.
options rexxmac;
filename sasrexx 'your.rexx.library' disp=shr;
yourexec;
In batch, you can also
use a JCL DD statement to allocate the REXX library externally:
//jobname JOB ...
// EXEC SAS
//SASREXX DD DSN=YOUR.REXX.LIBRARY,DISP=SHR
//SYSIN DD *
options rexxmac;
yourexec;
/*
//
A REXX exec can have
zero, one, or multiple arguments. You call the exec by specifying
its name, followed by arguments (if any), followed by a semicolon.
You can place the exec anywhere that a global SAS statement, such
as an OPTIONS or TITLE statement, can be placed.
The exec can generate
code that is then processed by the SAS supervisor. That code can be
a partial DATA step or PROC step, or one or more complete DATA steps
or PROC steps.
A Simple REXX Exec provides an example of a REXX exec
called VERIFY that takes as its argument a single data set name. This
REXX exec can be invoked by submitting the following statement from
a SAS program:
verify data.set.name;
A SAS REXX exec submits
SAS statements through the SAS subcommand environment by specifying
or defaulting to
'SAS'
as its address. When
a REXX exec receives control, the default subcommand environment for
that program is
'SAS'
. As illustrated in
A Simple REXX Exec, any SAS language statement can then
be passed to SAS for execution.