02.05.2013 Views

SAS(R) 9.1.3 Companion for z/OS

SAS(R) 9.1.3 Companion for z/OS

SAS(R) 9.1.3 Companion for z/OS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

54 Assigning <strong>SAS</strong> Data Libraries Internally Chapter 2<br />

users from allocating the library until you de-allocate the library. In order to<br />

update any member of a library, you must request exclusive access to the<br />

library data set.<br />

3 Specifying a disposition status of SHR will request shared access to the<br />

library. The allocation will succeed provided that no other job or users have<br />

the library allocated <strong>for</strong> exclusive access, and z/<strong>OS</strong> will prevent other jobs or<br />

users from allocating the library <strong>for</strong> exclusive access until you de-allocate the<br />

library. However, other SHR allocations can exist concurrent with yours.<br />

You can allocate the z/<strong>OS</strong> data set external to <strong>SAS</strong> using z/<strong>OS</strong> facilities such as JCL<br />

or the TSO ALLOCATE command. In most cases, <strong>SAS</strong> will use the external allocation<br />

to process the library. This is always true if the DDname of the allocation is specified as<br />

the libref. However, if <strong>SAS</strong> does not find an external allocation of the library data set, it<br />

will dynamically allocate the library data set when assigning a library internally. When<br />

this is necessary, <strong>SAS</strong> will allocate a library with a disposition status of OLD, unless a<br />

different status has been specified. The DDname used <strong>for</strong> this allocation will be the<br />

same as the libref unless the libref is not a valid DDname or is a DDname that matches<br />

the libref that is already allocated. In those cases, <strong>SAS</strong> must let the operating system<br />

generate a unique DDname, which would be in the <strong>for</strong>mat SYSnnnnn.<br />

Once <strong>SAS</strong> has allocated a library data set, it will use that allocation to process the<br />

library, regardless of how many librefs are assigned to the library and provided that the<br />

same disposition status is specified (or implied) on all the assignments. See “Assigning<br />

Multiple Librefs to a Single <strong>SAS</strong> Data Library” on page 60 <strong>for</strong> more in<strong>for</strong>mation.<br />

However, if a library is assigned with a disposition status of SHR and later, an<br />

additional assignment is made with a status of OLD, <strong>SAS</strong> will attempt to dynamically<br />

allocate the library data set a second time using a disposition status of OLD and a<br />

system-generated DDname. If successful, this second allocation will be used <strong>for</strong> all<br />

subsequent processing of the library until all librefs associated with the library have<br />

been de-assigned. Note that in this case <strong>SAS</strong> will not (and cannot) release exclusive<br />

access to the library even when you release the assignment that specified a status of<br />

OLD.<br />

Assigning <strong>SAS</strong> Data Libraries Internally<br />

<strong>SAS</strong> provides two methods <strong>for</strong> assigning <strong>SAS</strong> data libraries internally, that is, via<br />

<strong>SAS</strong> statements without relying on operating environment facilities such as JCL:<br />

3 The LIBNAME statement or LIBNAME function can be used to assign a <strong>SAS</strong> data<br />

library.<br />

In the following example, the data library USER934.MYLIB.<strong>SAS</strong>LIB has been<br />

assigned to the libref MYLIB. The z/<strong>OS</strong> allocation parameter DISP=SHR requests<br />

shared access to the library data set. Since no engine was specified, <strong>SAS</strong> will<br />

examine the <strong>for</strong>mat of the library data set to determine which engine to use.<br />

libname mylib ’user934.mylib.saslib’ disp=shr;<br />

In the data step below, the libref MYLIB is used to refer to the library. MYLIB<br />

can be used <strong>for</strong> the remainder of the <strong>SAS</strong> session until explicitly cleared by a<br />

LIBNAME CLEAR statement.<br />

data mylib.member1;<br />

...<br />

run;<br />

Except <strong>for</strong> a few special cases, the LIBNAME statement or function can per<strong>for</strong>m<br />

all of the assignment functions that are required <strong>for</strong> <strong>SAS</strong> data libraries. The

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!