z/OS ISPF Services Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


LMOPEN—open a data set

z/OS ISPF Services Guide
SC19-3626-00

The LMOPEN service opens the data set associated with a given data ID so the data set can be either read from, using LMGET, or written to, using LMPUT. The LMINIT service must be completed before LMOPEN can be used.

For each LMOPEN invocation, you should invoke a matching LMCLOSE service. The LMCLOSE service closes the data set to further processing until LMOPEN is invoked again for that data set's data ID. Therefore, you should invoke the LMCLOSE service when processing is completed for that data set. Otherwise, unwanted data can be read from or written to the data set.

Note: Some library access services do not require that LMOPEN be executed before invocation (for example, LMCOPY and LMMOVE). See the service description to determine whether LMOPEN should be invoked.

It is the responsibility of the dialog developer to ensure that a data set is opened for output only once. ISPF does not protect against this situation. From the time LMOPEN for output is invoked until LMCLOSE is invoked, there are certain restrictions on what can be done. Do not invoke the EDIT, DISPLAY, or TBDISPL services. Displaying any panel at all may allow the user to edit the already opened data set or invoke a dialog that opens the same data set for output.

Command invocation format

Read syntax diagramSkip visual syntax diagram
>>-ISPEXEC--LMOPEN--DATAID(data-id)--+----------------------+--->
                                     |         .-INPUT--.   |   
                                     '-OPTION(-+-OUTPUT-+-)-'   

>--+------------------+--+------------------+------------------->
   '-LRECL(lrecl-var)-'  '-RECFM(recfm-var)-'   

>--+--------------+--------------------------------------------><
   '-ORG(org-var)-'   

Call invocation format

Read syntax diagramSkip visual syntax diagram
                                           .-'INPUTbbb'-.   
>>-CALL--ISPLINK--('LMOPENbb'--,data-id--,-+-'b'--------+------->
                                           '-'OUTPUTbb'-'   

>--,-+-lrecl-var-+--,-+-recfm-var-+--,-+-org-var-+-);----------><
     '-'b'-------'    '-'b'-------'    '-'b'-----'      

or

Read syntax diagramSkip visual syntax diagram
>>-CALL--ISPEXEC--(buf-len,--buffer);--------------------------><

Parameters

data-id
The data ID associated with the data set to be opened. The data ID has been generated by the LMINIT service. The maximum length of this parameter is 8 characters.
INPUT|OUTPUT
Whether the data set is to be opened for reading or writing. INPUT is the default.

INPUT specifies that the dialog invoking the service uses the LMMFIND and LMGET services to read from the data set. The enqueue value for the LMINIT service can be SHR, EXCLU, or SHRW.

OUTPUT specifies that the dialog invoking the service uses LMPUT and either LMMADD or LMMREP to write to the data set, or uses LMMDEL or LMMREN to change the data set. The enqueue value for the LMINIT service can be EXCLU, SHRW, or MOD. If the data set is allocated SHRW, ISPF uses the RESERVE macro to reserve the DASD volume to the user when the data set is opened for output. This DASD volume remains reserved to the user until the LMCLOSE service is performed. The data ID must represent a single data set, not a concatenation of data sets.

lrecl-var
The name of a character variable into which the actual data record length or, if the record format is of variable length, the maximum data record length, is to be stored. This is an output parameter. The maximum length of this parameter is 8 characters.
recfm-var
The name of a character variable into which the record format code is to be stored. This is an output parameter. This variable must contain at least four characters. The maximum length of this parameter is 8 characters.
org-var
The name of a character variable into which the organization of the data is stored. This is an output parameter. The variable contains "PO" if the data set is partitioned and "PS" if it is physical sequential. The maximum length of this parameter is 8 characters.
buf-len
A fullword fixed binary integer containing the length of the buffer parameter.
buffer
A buffer containing the name of the service and its parameters in the same form as they would appear in an ISPEXEC invocation for a command invocation.

Return codes

These return codes are possible:
 0
Normal completion.
 8
Data set could not be opened.
10
No data set is associated with the given data ID; that is, LMINIT has not been completed.
12
One of these:
  • The parameter value is invalid.
  • Data set is already open.
  • Cannot open concatenated data sets for output.
  • Cannot open a data set allocated SHR for output.
16
Truncation or translation error in accessing dialog variables.
20
Severe error; unable to continue.

Example

This example invokes the LMOPEN service to open the data set associated with the data ID in variable DDVAR for reading. The record length is to be returned in variable DLVAR, the record format in RFVAR, and the data set organization in ORGVAR.

Command invocation

ISPEXEC LMOPEN DATAID(&DDVAR) OPTION(INPUT)      +
               LRECL(DLVAR)   RECFM(RFVAR)       +
               ORG(ORGVAR)

Call invocation

CALL ISPLINK('LMOPEN  ',DDVAR,'INPUT   ',
                      'DLVAR ','RFVAR ',
                      'ORGVAR ');
OR
Set the program variable BUFFER to contain:
BUFFER = 'LMOPEN DATAID(&DDVAR) OPTION(INPUT)
                LRECL(DLVAR)   RECFM(RFVAR)
                ORG(ORGVAR)';
Set the program variable BUFLEN to the length of the variable BUFFER. Issue the command:
CALL ISPEXEC (BUFLEN, BUFFER);

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014