LIBRM OPEN (Open Library Member) Macro

This macro opens the member that is defined by MEMBER and TYPE in the sublibrary LIB/SUBLIB, if given, otherwise in the chain that is identified by CHAINID.

The member is opened either for input (INPUT), or update (INOUT), or output (OUTPUT).

See also Library Macro Notation for details on register notation and possible operand specifications.

Format

Read syntax diagramSkip visual syntax diagramlabelLIBRM OPEN,TYPEFLE=INPUT,TYPEFLE=INOUT(OUTPUT,REPLACE)(OUTPUT,NOREPLACE),CHKOPEN=NO,CHKOPEN=YES,LDCB= areaname,LIB= lib,SUBLIB= sublib,CHAINID= chainid,MEMBER= membername,TYPE= membertype,BUFFER= buffer,BUFSIZE= length_value,RECFM=FS,DIRINF= dirinf,DIRINFL= length_value,DATAID= did,DATALEN= dlen,DATA= data,SYSIPT=NO,SYSIPT=YES,NOTFND= label,EROPT=RET,EROPT=CANCEL,ERRAD= label

Requirements for the caller

AMODE:
24 or 31
RMODE:
ANY
ASC Mode:
Primary

Parameters

TYPEFLE=INPUT
The first occurrence of the member in the chain sequence is opened for INPUT. The current (GET) position is at the start of the member. No PUT requests are accepted.

For INPUT (or INOUT), directory information is provided in the area that is specified by DIRINF (control block layout INLCMBST). User-provided directory information that is identified by DATAID is returned in DATA, its length in DATALEN.

TYPEFLE=INOUT
The first occurrence of the member in the chain sequence is opened for INOUT. If the member does not exist, a new member is opened in the first sublibrary of the chain. GET position is at the start of the existing member, PUT position is at the start of the new copy of the member.
TYPEFLE=(OUTPUT,REPLACE)
The member is opened for OUTPUT in the first sublibrary of the chain.
TYPEFLE=(OUTPUT,NOREPLACE)
The member is only opened for OUTPUT, if it does not exist in the first sublibrary of the chain.

For OUTPUT, no GET or POINT requests are allowed. The presence of SYSIPT data is indicated by the SYSIPT operand.

CHKOPEN=YES|NO

Specify CHKOPEN=YES to check, if the member has already been opened (Supervisor LOCKed) by the same VSE task. LIBRM OPEN returns with a return code = 2 without performing the OPEN function, if the member is already opened by the same VSE task. Otherwise, the member is opened.

If CHKOPEN=NO is specified, the member is opened without checking. It is the default value to be compatible with previous VSE versions.

LDCB=areaname
Specifies the address of the LDCB (Librarian Data Control Block) for the request.
LIB=lib
Specifies the address of an area where the library name (1 to 7 alphanumeric characters) is stored.
SUBLIB=sublib
Specifies the address of an area where the sublibrary name (1 to 8 alphanumeric characters) is stored.
CHAINID=chainid
Specifies the address of an area where the sublibrary chain identifier (1 to 8 alphanumeric characters) is stored.
MEMBER=membername
Specifies the address of an area where the member name (1 to 8 alphanumeric characters) is stored.
TYPE=membertype
Specifies the address of an area where the member type (1 to 8 alphanumeric characters) is stored.
BUFFER=buffer
Specifies the address of the caller's work area where a GET request returns the input or a PUT request gets the output.
BUFSIZE=length-value
Specifies the length (as a numeric value) of the caller's work area.
RECFM=F | S
Specifies the logical record format:
F
specifies record format FIXED,
S
specifies record format STRING.

If TYPEFLE=INPUT or INOUT and the member exists, RECFM is checked. If TYPEFLE=OUTPUT or INOUT and the member does not exist, F is assumed as default.

For TYPE=DUMP or PHASE, record format F is not allowed; S is assumed as default.

For TYPE=PROC, OBJ, or source program, record format S is not allowed.

DIRINF=dirinf
Specifies the address of an area where member directory information is returned.
DIRINFL=length-value
Specifies the length (numeric value) of DIRINF area.
DATAID=did
Specifies the address of an area where the 1 to 4 character alphanumeric identifier for user-provided directory information is specified.
DATALEN=dlen
Specifies the address of a fullword where the length of the DATA area is given. The actual length of the user-provided information is returned by the service.
DATA=data
Specifies the address of the area where the user-provided directory information is returned. The area that is specified must have a minimal length of DATALEN.
SYSIPT=NO | YES
Indicates whether the member contains SYSIPT data:
NO
No SYSIPT data in the member.
YES
The member contains SYSIPT data.

SYSIPT is only possible for OPEN(OUTPUT). Default is NO.

NOTFND=label
Specifies a label to which the service branches, if the specified member does not exist (return code 8 for members that are opened for INPUT), or if the specified library, sublibrary or chain does not exist or is not accessible (return code 12).
EROPT=RET | CANCEL
Defines an error handling option, which is taken if the function cannot be performed (return code > 12).
RET
Processing is continued, either by a normal return or by branching to the ERRAD exit.
CANCEL
Processing is canceled. A librarian error message is issued to SYSLOG.
ERRAD=label
Specifies a label to which the Librarian branches, if the above function cannot be performed because of an error (return code > 12).

Return Codes

Return  Reason   Meaning
 Code    Code
  0       0      OPEN(INPUT): Member exists and is opened for GET requests.
                 OPEN(OUTPUT,REPLACE): Member exists and is opened for
                              replacement by subsequent PUT requests.
                 OPEN(OUTPUT,NOREPLACE): Member does not exist.
                              It is opened for creation.
                 OPEN(INOUT): Member exists and is opened for creating a new copy.
          4      OPEN(OUTPUT,REPLACE): Member does not exist.
                              It is opened for creation.
  2       0      OPEN(INOUT,CHKOPEN=YES): Member is already open by the same VSE task.
                              No LIBRM OPEN action is taken. 
  4       0      OPEN(INOUT): Member does not exist. It is opened for creation.
  8       0      OPEN(INPUT): Member does not exist. No open is done.
                 OPEN(OUTPUT,NOREPLACE): Member already exists. It is not opened.
 12       0      The specified sublibrary does not exist.
          4      The specified library does not exist.
          8      The specified chain does not exist.
 16      xx      External system error with feedback code and message.
 20      xx      Internal system error with feedback code and message.
 32       0      Access control failed (with message L163I).
The external system error feedback codes are described in Librarian Feedback Codes. All other (internal) feedback codes are described in http://publibfp.dhe.ibm.com/epubs/pdf/ieslde10.pdf.
Note:
  1. If both LIB/SUBLIB and CHAINID are specified, LIB/SUBLIB is taken and CHAINID is ignored.
  2. If RECFM is specified, the GET/PUT UNITS value is set to its default.
  3. The GET/PUT RECNO value, which defines the start position for the subsequent GET or PUT request, is initialized to the start of the member. It overwrites a previously specified value.
  4. If it is not possible to return any user-provided directory information (operands DATA, DATALEN, DATAID), the fullword that is addressed with DATALEN is set to zero. Return and reason codes are not affected.

    Processing is ignored if DIRINF is not specified or its length is too small to return the member status.

  5. Executable programs (TYPE=PHASE) can only be read.