Previous Page | Next Page

Accessing External Files

Referring to External Files

After allocating an external file, you can use the fileref or ddname of the file as a convenient way of referring to that file in any subsequent SAS language statement or command.

Note:   The first time the ddname of an external file is used in a SAS statement or procedure, SAS assigns it as a fileref for the external file. Therefore, any information provided here about filerefs also applies to the ddnames of external files.

See Summary Table of SAS Software Files and Reserved z/OS ddnames for a list of files and ddnames with special meanings to SAS and the operating environment.  [cautionend]

In the following example, the FILENAME statement associates the fileref REPORT with the sequential data set MYID.NEWDATA. The FILE statement later uses the fileref rather than the data set name to refer to the data set.
filename report 'myid.newdata' disp=old;
data _null_;
   file report;
   put ...;
run;

Here is a similar example in which a JCL DD statement associates the ddname IN with a member of a partitioned data set. The INFILE statement later uses the ddname rather than the data set name and member name to refer to the PDS member.

//IN DD DSN=MYID.NEWDATA(TRIAL1),DISP=SHR
//SYSIN DD *
data out;
   infile in;
   input ...;
run;

When referring to a member of a PDS or a PDSE, you also have the option of specifying only the data set name in the FILENAME statement (or FILENAME function) or in the DD statement. Then, in subsequent references, you specify the member name with the fileref. For example:

//IN DD DSN=MYID.NEWDATA,DISP=SHR
//SYSIN DD *
data out;
   infile in(trial1);
   input ...;
run;

If an external data set is not cataloged, you must also provide the volume serial number. If SAS requires that a file must be identified only by its physical name, that name must represent a cataloged data set or HFS file. Temporary data sets are not cataloged, and SAS cannot locate temporary data sets if you provide only a physical name. See FILENAME Statement: z/OS for more information about other options that you can specify.

Note:   If you are using files in the USS file system, SAS makes no distinction between the z/OS file system (zFS) and the Hierarchical File System (HFS).  [cautionend]

Previous Page | Next Page | Top of Page