![]() Chapter Contents |
![]() Previous |
![]() Next |
| SAS Companion for the OS/390 Environment |
| Allocating UNIX System Services Files |
filename input1 '/u/sasusr/data/testset.dat'; filename input2 '~/data/testset2.dat';
filename input hfs 'testset.dat';
filename input 'HFS:testset.dat';
options filesystem=HFS; filename 'testset.dat';
If you do not specify the entire pathname of a UNIX
System Services file, then the directory component of the pathname is the
working directory that was current when the file was allocated, not when the
fileref is used. For example, if your working directory was
/usr/local/sasusr when you allocated the file, then the following FILENAME statement
associates the INPUT fileref with the following path:
/usr/local/sasusr/testset.dat
filename input hfs 'testset.dat';
If you change your current working directory to
/usr/local/sasusr/testdata then the following statement still refers
to
/usr/local/sasusr/testset.dat, not to
/usr/local/sasusr/testdata/testset.dat:
infile input;
| Allocating a UNIX System Services Directory |
To allocate a new UNIX System Services directory, use one of the following:
mkdir command to allocate a
new directory.
x mkdir <new-dir-path>
filename <fileref> PIPE; include <fileref> 'mkdir <new-dir-path>';
To open a particular file in a directory for input or output, you must specify the file name in the SAS INFILE or FILE statement, as described in Accessing a Particular File in a UNIX System Services Directory.
| Specifying File-Access Permissions and Attributes |
alloc file(indata) path('/u/sasusr/data/testset.dat') pathopts(ordonly)
![[cautend]](../common/images/cautend.gif)
-rw-rw-rw-; however, this mode may be modified by the current file-mode
creation mask. (For detailed information about the file-mode creation mask,
see MVS/ESA OpenEdition MVS User's Guide.)
| Using UNIX System Services File Names in SAS Statements and Commands |
To use an actual
UNIX System Services filename (rather than a fileref or DDname) in a SAS statement
or command, include a slash or tilde in the pathname, or use the HFS prefix
with the filename. You can use a UNIX System Services file name anywhere that
an external file name can be used, such as in a FILE or INFILE statement,
in an INCLUDE or FILE command in the windowing environment, or in the SAS
Explorer window. If the file is in the current directory, specify the directory
component as
./. For example:
include './testprg.sas'
filename test ('data/test1.dat' 'data/test2.dat');
| Accessing a Particular File in a UNIX System Services Directory |
infile fileref(file); file fileref(file);
| Piping Data between SAS and UNIX System Services Commands |
To pipe data between
SAS and UNIX System Services commands, you first specify the PIPE file type
and the command in a FILENAME statement or FILENAME function. Enclose the
command in single quotes. For example, this FILENAME statement assigns the
command
ls -lr to the fileref OECMD:
filename oecmd pipe 'ls -lr';
filename oecmd pipe ('ls *.sas' 'ls *.data');
When a pipe is opened for input by the INFILE statement,
any output that the command writes to standard output or to standard error
is available for input. For example, here is a DATA step that reads the output
of the
ls -l command and saves it in a SAS data set:
filename oecmd pipe 'ls -l';
data dirlist;
infile oecmd truncover;
input mode $ 1-10 nlinks 12-14 user $ 16-23
group $25-32 size 34-40 lastmod $ 42-53
name $ 54-253;
run;
When a pipe is opened for output by the FILE statement,
any lines that are written to the pipe by the PUT statement are sent to the
command's standard input. For example, here is a DATA step that uses the
UNIX System Services
od command to write the contents of
the file in hexadecimal format to the UNIX System Services file
dat/dump.dat, as follows:
filename oecmd pipe 'od -x -tc - >dat/dump.dat'; data _null_; file oecmd; input line $ 1-60; put line; cards; The SAS System is an integrated system of software products, enabling you to perform data management, data analysis, and data presentation tasks. ; run;
| Host-Specific Options for UNIX System Services Files |
Host-Specific Options for UNIX System Services Files and Pipes shows which host-specific options are recognized by the FILENAME, FILE, and INFILE statements for UNIX System Services files and pipes. No other options are recognized, including such options specific to OS/390 as DISP, CLOSE, and DCB. Descriptions of the options follow the table.
| Option | FILENAME | FILE | INFILE |
|---|---|---|---|
| OLD | X | X |
|
| MOD | X | X |
|
| LRECL= | X | X | X |
| RECFM= | X | X | X |
| Using the X Statement to Issue UNIX System Services Commands |
To start the UNIX System Services shell, issue the following X statement:
x omvs;
Note:
UNIX System
Services commands are case sensitive.
You can also use the X statement to issue any of three UNIX System Services commands:
x cd directory;
x umask mask;
x umask 022 ensures that each newly
created file can be written to only by its owner. (For detailed information
about the file-mode creation mask, see your IBM documentation.)
x pwd;To issue other UNIX System Services commands, use the PIPE access method.
To issue a TSO command or CLIST that has the same name
as one of the case-sensitive commands (a CLIST named CD, for example), either
enter the command using uppercase characters, or use the
TSO:
prefix and enclose the command in quotes, as in the following examples:
x CD option1 option2 ...; x 'tso:cd option1 option2 ...';
For more information about the X statement, see X.
| Restrictions in SAS System Support for UNIX System Services |
It is not possible to run SAS under the UNIX System
Services shell. However, you can run the shell after you initialize SAS by
using the
x omvs; statement.
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.