Chapter Contents

Previous

Next
Run-Time Argument Processing

Argument Redirection

The command-line token =< filename defines an argument redirection. An argument redirection is processed by opening the file specified, reading it in its entirety, and replacing the =< filename token with the file contents. The file can contain environment variable assignment, library option, or program argument tokens. It can also contain additional argument redirections. However, it cannot contain I/O redirections.

Argument redirection can be used to insert tokens in a command-line argument string. For instance, if the command line specifies the following:

arg1 =<tso:myargs arg2

and the TSO file userid.MYARGS contains the following:

arg3 arg4 =ENV1=22 =WARN

then the program is called as if the command line specified

arg1 arg3 arg4 =ENV1=22 =WARN arg2


Rules for Using Argument Redirection

Here are some more specific rules about the use of argument redirection:

  1. An argument redirection file name is interpreted as if it were a filename passed to fopen . In particular, if no style prefix is present in the name, the default style specified by the program using _style applies.

  2. Under CMS, the notation =<( filename filetype filemode ) can be used to handle filenames containing blanks.

  3. New lines and null characters in the argument redirection file are replaced with blanks.

  4. You cannot use the terminal or a pipe as an argument redirection file.

  5. An argument redirection file should not contain an input or output redirection or a stack/heap size specification. These can only appear on the command line proper. If either of these is found in an argument redirection file, it is ignored.

  6. Recursive use of argument redirection (that is, an argument redirection file that directly or indirectly respecifies itself) is detected. The same file may be included twice under different names, but an infinite loop recursively reading the same file will always be avoided.

  7. Although the length of the actual command line is limited by the SAS/C Library to 1000 characters, there is no limit to the size of the command line constructed after all the argument redirections have been processed. Thus, argument redirection can be used to circumvent this library limitation.

  8. Argument redirection is supported in the run-time options string passed to $MAINO and other alternate C start-up routines. However, in this case, any program arguments (as opposed to run-time options or environment variable assignments) in an argument redirection file will be ignored.

  9. An important use of argument redirection is to specify more than one or two environment variables in batch, where the PARM string is limited to 100 characters.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.