Previous Page | Next Page

Functions and CALL Routines under z/OS

SYSTEM Function: z/OS



Issues an operating environment command during a SAS session and returns the system return code.
Category: Special
z/OS specifics: command, related commands, statements, macros
See: SYSTEM Function in SAS Language Reference: Dictionary

Syntax
Details
Examples
See Also

Syntax

SYSTEM(command)

command

can be a system command enclosed in quotation marks, an expression whose value is a system command, or the name of a character variable whose value is a system command. Under z/OS, the term system command refers to TSO commands, CLISTs, and REXX execs.


Details

The SYSTEM function is similar to the X (or TSO) statement, the X (or TSO) command, the CALL SYSTEM (or CALL TSO) routine, and the %SYSEXEC (or %TSO) macro statement.

This function returns the operating environment return code after the command, CLIST, or REXX exec is executed.

SAS executes the SYSTEM function immediately. Under z/OS, TSO is an alias for the SYSTEM function. On other operating environments, the TSO function has no effect, whereas the SYSTEM function is always processed.

You can use the SYSTEM function to perform the following tasks:

You cannot use the SYSTEM function to perform the following tasks:


Examples

In the following example, the SYSTEM function is used to allocate an external file:

data _null_;
   rc=system('alloc f(study) da(my.library)');
run;

For a fully qualified data set name, use the following statements:

data _null_;
   rc=system("alloc f(study) da('userid.my.library')");
run;

In the second example above, notice that the command is enclosed in double quotation marks. When the TSO command includes quotation marks, it is best to enclose the command in double quotation marks. If you choose to use single quotation marks, then double each single quotation mark within the TSO command:

data _null_;
   rc=system('alloc f(study)da(''userid.my.library'')');
run;


See Also

Previous Page | Next Page | Top of Page