SPDO Procedure

SPDSCMD Statement

Sends SPD Server a command to run.

Requirement: You must have special privilege and specify ACLSPECIAL=YES in the LIBNAME statement to use this statement.
Using PROC SPDO to Back Up and Restore Tables.

Syntax

SPDSCMDcommand’;

Required Argument

command

specifies a host command or a server command.

Details

SPD Server uses the host system() call to run the specified command. The command is executed according to the user ID rights of the individual or administrator that started the server session. The server returns the system() call value to PROC SPDO. PROC SPDO echoes the exit status of the command that was run on the host.
Here are examples of commands that can be issued from the SPDSCMD statement:
  • List the WORKPATH directory:
    /* UNIX */
    spdscmd 'ls /spdswork/*.spds9';
    
    /* Windows */
    spdscmd 'dir d:\spdswork\*.spds9';
  • Clean up WORKPATH files:
    /* UNIX */
    spdscmd 'rm /spdswork/*.spds9';
    
    /* Windows */
    spdscmd 'del d:\spdswork\*.spds9';
The SPD Server backup and restore utilities (spdsbkup and spdsrstr), index utility (ixutil), and table list utility (spdsls) can also be executed in the SPDSCMD statement. Executing the utilities remotely via PROC SPDO circumvents the need to set local environment variables for the utilities. See Using PROC SPDO to Back Up and Restore Tables to see how the utilities are invoked.
When you use the SPDSCMD statement to perform a system command, the procedure sets the SAS SYSRC macro variable to the value that was returned by the system command.
Note: System commands executed on Linux do not reliably return the status of the command being executed. Therefore, PROC SPDO cannot set the SYSRC macro variable.
If the server cannot run the system command for any reason, PROC SPDO sets the SAS SYSERR macro to 1012.
Last updated: February 3, 2017