Chapter Contents

Previous

Next
SAS Companion for the OS/390 Environment

Allocating SAS Data Libraries Externally

There are several advantages to allocating SAS data libraries internally (see Advantages of Allocating SAS Data Libraries Internally). However, you can also use either a JCL DD statement or a TSO command to allocate a SAS data library externally and to assign a DDname to it.

Note:   If you do not use the LIBNAME statement or LIBNAME function to specify an engine for a data set that was allocated externally (as described in Using the LIBNAME Statement or LIBNAME Function with Externally Allocated SAS Data Libraries), then SAS uses the procedures described in How SAS Assigns an Engine When No Engine Is Specified to determine which engine to use.  [cautionend]


JCL DD Statement Examples

Allocating an existing SAS data library:
The following JCL DD statement allocates the cataloged data set LIBRARY.CATALOG.DATA and assigns the DDname BOOKS to it:
//BOOKS DD DSN=LIBRARY.CATALOG.DATA,
//         DISP=OLD

The following JCL DD statement allocates an existing SAS data library, which is stored in an UNIX System Services directory:

//HFSLIB DD PATH='/corp/dev/test1'
Note that UNIX System Services recognizes and distinguishes between uppercase and lowercase letters in pathnames.

Allocating a new SAS data library:
This example allocates a new SAS data library on tape:
//INTAPE DD DSN=USERID.V8.SEQDATA, 
//  UNIT=TAPE,LABEL=(1,SL), 
//  DCB=(RECFM=U,LRECL=32756,BLKSIZE=32760), 
//  DISP=(NEW,KEEP),VOL=SER=XXXXXX

Notice that DCB attributes are specified. When you allocate a new SAS data library externally, you must either specify DCB attributes or accept the default DCB attributes that SAS supplies. See DCB Attributes for Direct Access Bound Libraries with the V8 Engine and DCB Attributes for Direct Access Bound Libraries with the V8TAPE Engine for details.

Specifying additional options for a previously allocated SAS data library:
See Using the LIBNAME Statement or LIBNAME Function with Externally Allocated SAS Data Libraries.


TSO ALLOCATE Command Examples

Allocating an existing SAS data library:
The following TSO ALLOCATE command allocates the cataloged data set LIBRARY.CATALOG.DATA and assigns the DDname BOOKS to it:
alloc file(books) da('lib.cat.data') old;

The following command performs the same allocation, this time using the SAS X statement to submit the TSO ALLOC command (see X for details about the X statement):

x alloc file(books) da('lib.cat.data') old

The following command allocates a directory as a SAS data library with the DDname RESULT2:

x alloc file(result2) path('/corp/dev/test2')

Allocating a new SAS data library:
The following TSO command allocates a new sequential SAS data library on disk:
alloc fi(intape) da(v8.seqdata) dsorg(ps)
recfm(u) blksize(6144) new

Notice that DCB attributes are specified. When you allocate a new SAS data library externally, you must either specify DCB attributes or accept the default DCB attributes that SAS supplies. See DCB Attributes for Direct Access Bound Libraries with the V8 Engine and DCB Attributes for Direct Access Bound Libraries with the V8TAPE Engine for details.

Specifying additional options for a previously allocated SAS data library:
See Using the LIBNAME Statement or LIBNAME Function with Externally Allocated SAS Data Libraries.


Using a DDname as a Libref

After a DDname has been assigned, you can use it in a SAS job in the same way you would use a libref. For example:

proc contents data=books._all_; run;

The first time the DDname BOOKS is used in this manner, SAS assigns it as a libref for the SAS data library.

When a DDname is allocated externally, it is not listed by the LIBNAME LIST statement or in the SAS Explorer until after you have used it as a libref in your SAS session. (See Listing Your Current Librefs.)


Using the LIBNAME Statement or LIBNAME Function with Externally Allocated SAS Data Libraries

You can use the LIBNAME statement or LIBNAME function to specify an engine for a data library that was previously allocated externally. For example, suppose you used an X statement to submit the following TSO ALLOCATE command, which allocates the SAS data library QUARTER1.MAILING.LIST:

x alloc f(mail) da('quarter1.mailing.list') old

You could later use the LIBNAME statement to associate an engine with the library as follows:

libname mail v8seq;

This LIBNAME statement or LIBNAME function associates the Version 8 sequential engine with the data library that is referred to by the DDname MAIL. You can then read to and write from the sequential format data library QUARTER1.MAILING.LIST. You do not need to specify the data set name in this example, as long as MAIL is the DDname for QUARTER1.MAILING.LIST. If you do specify the data set name, the name must match the data set name that was already allocated to that DDname.


Chapter Contents

Previous

Next

Top of Page

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