Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
LMGET—read a logical record from a data set z/OS ISPF Services Guide SC19-3626-00 |
|
The LMGET service reads one logical record from the data set associated with the given data ID. Completion of the LMINIT and LMOPEN services for the data set is required before LMGET is invoked. If the data to be processed is a sequential data set, the first LMGET reads the first logical record. Later invocations read successive logical records; that is, the second invocation reads the second logical record, the third invocation reads the third logical record, and so on. If the data is an ISPF library or MVS™ partitioned data set, previous completion of the LMMFIND service is required in addition to completion of LMINIT and LMOPEN. The LMGET service reads from the last member referred to by the LMMFIND service in the data sets being processed. Thus, if LMMFIND is issued referencing member A, LMGET reads from member A. If another LMMFIND is issued referencing member B, LMGET reads from member B, not member A. When MODE(MULTX) is used, the read operation occurs in segments (rather than in single records), with each segment comprising multiple records. Each record is prefixed by a 2-byte binary integer field containing its length. The maximum size of each segment returned is 32 000 bytes. LMGET returns data to the dataloc-var in this format:
The data read is always unpacked. If the data set contains packed data, LMGET unpacks the data. Command invocation formatCall invocation formatParameters
Return codesThese return codes are possible:
Example 1This example invokes the LMGET service to read a record from the data set associated with the data ID in variable DDVAR, in INVAR mode, with LOCVAR as the data location variable, LENVAR as the actual record length variable, and 80 bytes as the maximum record length. Command invocation
Call invocation
MAXLEN is a fullword integer variable.
Set the program variable BUFFER to contain:
Set the program variable BUFLEN to the length of the variable BUFFER.
Issue the command:
Example 2This example initializes and opens an input and an output data set, using LMINIT and LMOPEN respectively. The exec loops through the all the records of the input data set using the LMGET service. Each record of the input data set is stored into the variable srchline. The variable srchline is parsed to find a member name. The string 'SELECT ' followed by the member name is stored into a variable called selline which is added to the output data set, using the LMPUT service. The input and output data sets are closed and freed using LMCLOSE and LMFREE.
Example 3 (MULTX)This REXX example invokes the LMGET service to process a data set in MULTX mode, returning blocks of data in segments no larger than 32 000 bytes. The data set has a record length of 80 bytes in this example, but for variable data the length will vary and must be calculated as shown:
|
Copyright IBM Corporation 1990, 2014
|