OPEN-LIBRARY is used to define and open a global library. This is referenced in other statements by means of LIBRARY = *STD.
If two libraries are required in a statement, then the second library must be specified explicitly in the statement or via a link name.
Global libraries remain open until they are explicitly closed by means of the CLOSE-LIBRARY statement or until a new OPEN-LIBRARY statement is issued.
Global libraries are opened for reading as standard. If they are to be opened for reading and writing, the operand MODE=*UPDATE must be set.
If a new library is set up, it must be generated with MODE=*UPDATE.
OPEN-LIBRARY | ||||||||||||||||||||||||||||||||||||||||
|
LIBRARY = <filename 1..54 without-vers>
The library with the name specified here is set up as a global library and opened.
LIBRARY = *LINK(...)
The library assigned via the link name is set up as a global library and opened.
LINK-NAME = <structured-name 1..8>
Link name of the library; this name was defined by means of a /ADD-FILE-LINK command prior to calling LMS.
MODE = *READ / *UPDATE(...)
Library open mode.
MODE = *READ
The library is opened only for reading. It must already exist.
MODE = *UPDATE(...)
The library is opened for reading and writing.
STATE = *ANY / *OLD/ *NEW
Status of the library to be opened.
STATE = *ANY
The library may exist. If it does not exist, it will be created as a new library.
STATE = *OLD
The library must exist.
STATE = *NEW
The library must not exist. It will be created as a new library.
DEFAULTS = *UNCHANGED / *PARAMETERS(...)
Library-specific defaults for an LMS session.
TYPE = *UNCHANGED
No changes to the library-specific default type. By default, the library is not assigned a default type.
TYPE = *NONE
The library is not assigned a library-specific default type, or an assigned library-specific default type is canceled.
TYPE = <alphanum-name 1..8>
Name of the library-specific default type. This replaces the *LMS-DEFAULT type entry in all statements concerning this library.
SNAPSET = *NONE / *LATEST / <name 1..1 with-low> / <integer -52..-1> The Operand allows to open libraries on a snapset.
The specification of a snapset is only allowed together with MODE=*READ (Default). Assignment of snapset libraries in LMS statements is only possible with LIBRARY=*STD. Other LIBRARY specification always refers to the original pubset. (see Example below)
To open a snapset library, a library with the same name must exist on the original pubset in order to evaluate some file attributes. Missing libraries can be restored as a whole by /RESTORE-FILE-FROM-SNAPSET.
Alternatively an empty library can be created by OPEN-LIBRARY library,U.
SNAPSET = *NONE
The library is not located on a snapset.
SNAPSET = *LATEST
The library is located on the latest created snapset.
*LATEST is equivalent to -1.
SNAPSET = <name 1..1 with-low>
The library is located on a snapset with snapset id a-z,A-Z.
Snapsets with capital letters A-Z are supported from BS2000/OSD-BC V8.0 on.
The snapset id of the library can be found out by the commands /LIST-FILE-FROM-SNAPSET and /SHOW-SNAPSET-CONFIGURATION.
SNAPSET = <integer -52..-1>
The library is located on a snapset in the chronological order of snapset creation with -1 for the newest snapset.
Statement return code
(SC2) | Maincode | Meaning |
0 | CMD0001 | No error |
Required access rights
For MODE=*READ For MODE=*UPDATE | : : | Read authorization for LIBRARY Read and write authorization for LIBRARY |
Note
If the statement is aborted with LMS0024 and PLA0203, this could mean that an old library format is present. The way to check this and convert it into a PLAM library is described in the appendix in section "Migrating old library formats" (10.4 Migrating old library formats).
Examples
Opening an existing library LIB1:
//open-library library=lib1
Opening an existing library via the link name:
/add-file-link link-name=glob-lib,file-name=lib1 //start-lms . . //open-library library=*link(link-name=glob-lib)
Creating a new library:
//open-library library=lib1new, mode=*update
Opening a snapset library:
Library X is located on the original pubset and a snap of X on snapset a.//open-lib x,snapset=a
The following statement copies the elements from snapset a to the original pubset.
//copy-elem (*std,*,*),(x)
By contrast the following statement only copies the elements within the original pubset.
//copy-elem (x,*,*),(y)