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


LMCOPY—copy members of a data set

z/OS ISPF Services Guide
SC19-3626-00

The LMCOPY service copies members of a partitioned data set, or copies an entire sequential data set. Packing data, replacing members, and automatic truncation are optional. Only fixed-length and variable-length data sets can be packed.

Completion of the LMINIT service is required before you can invoke LMCOPY. You must specify ENQ(MOD) with the LMINIT service if you want to use LMCOPY to append records to the "to-data-id". See LMINIT—generate a data ID for a data set for information that can help prevent some common I/O errors that might occur when using the LMCOPY service. LMCOPY requires that the to-data-id and from-data-id be closed before invocation.
Note:
  1. FROMID and TODATAID can refer to the same data set but they cannot have the same data-id.
  2. LMCOPY does not support the copying of unmovable data sets (data set organization POU or PSU).
  3. If the ALIAS option is in effect, LMCOPY automatically processes alias members as follows:
    • Either the main member or any alias member may be selected to copy the main member and all of its aliases. This will occur even if some of the members are not displayed in the current member selection list.
    • Alias members are copied for both load data sets and non-load data sets as well as for PDS and PDSE data sets.

    Copying to the same data set is not supported when aliases are automatically selected, as it would result in the "from" and "to" member names being the same.

  4. If the NOALIAS option is in effect, LMCOPY does not copy alias members unless one of these is true:
    • All members of the data set are selected.
    • A member pattern is used and both the main member and the alias member are included in that pattern.

    If the NOALIAS option is in effect, copying an alias member by itself will result in a new member being created, even if the main member has already been copied.

  5. If from-data-id represents an empty sequential data set, LMCOPY performs the copy but sets the return code to 4 as a warning.

Command invocation format

Read syntax diagramSkip visual syntax diagram
>>-ISPEXEC--LMCOPY--FROMID(from-data-id)------------------------>

>--+---------------------------+--TODATAID(to-data-id)---------->
   '-FROMMEM(from-member-name)-'                         

>--+-----------------------+------------------------------------>
   '-TOMEM(to-member-name)-'   

>--+---------+--+------+--+-------+--+------+------------------->
   '-REPLACE-'  '-PACK-'  '-TRUNC-'  '-LOCK-'   

                         .-ALIAS---.   
>--+------------------+--+---------+---------------------------><
   '-SCLMSET(-+-Y-+-)-'  '-NOALIAS-'   
              '-N-'                    

Call invocation format

Read syntax diagramSkip visual syntax diagram
>>-CALL--ISPLINK--('LMCOPYbb'--,--from-data-id--,--------------->

>--+-from-member-name-+--,to-data-id--,--+-to-member-name-+----->
   '-'b'--------------'                  '-'b'------------'   

>--,--+-'REPLACEb'-+--,--+-'PACKbbbb'-+--,--+-'TRUNCbbb'-+--,--->
      '-'b'--------'     '-'b'--------'     '-'b'--------'      

                                         .-'ALIASbbb'-.       
>--+-'LOCKbbbb'-+--,--+-'b'--------+--,--+-'b'--------+--);----><
   '-'b'--------'     +-'YESbbbbb'-+     '-'NOALIASb'-'       
                      '-'NO--'-----'                          

or

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

Parameters

from-data-id
The data ID associated with the data set to be copied. The data ID has been generated by the LMINIT service. The maximum length of this parameter is 8 characters.
from-member-name
The member name or pattern of the members to be moved. An asterisk (*) indicates that all members are to be moved. If the "from" data set is partitioned, this parameter is required. If it is sequential, this parameter is not allowed. The maximum length of this parameter is 8 characters.
to-data-id
The data ID associated with the data set to be copied to. The data ID has been generated by the LMINIT service. The maximum length of this parameter is 8 characters.
to-member-name
The name of the member being moved to the "to" data set. If a name is not specified, the name of the member in the "from" data set is used. If the "from" data set is sequential and the "to" data set is partitioned, this parameter is required. If the "to" data set is sequential, this parameter is not allowed. The maximum length of this parameter is 8 characters.
REPLACE
Like-named members in the "to" data set are to be replaced. If this parameter is not specified and a like-named member exists in the "to" data set, the copy function is performed on all other members except like-named members, and a return code of 12 is issued.

If a list of members is being copied and one cannot be replaced, a message is issued indicating how many members were copied and how many were not replaced.

PACK
Data is stored in the "to" data set in packed format. If this parameter is not specified, data is copied and stored as unpacked.
TRUNC
Truncation is to occur if the logical record length of the "to" data set is less than the logical record length of the "from" data set. If this parameter is not specified and the logical record length of the "to" data set is less than the logical record length of the "from" data set, the copy is not performed and a return code of 16 is issued.
LOCK
The LOCK parameter is no longer used since the removal of LMF from the ISPF product, but is left in for compatibility. If LOCK is specified, the LMCOPY service will fail with return code 12. If you want to be able to specify YES and have the LMCOPY ignore the value, change the FAIL_ON_LMF_LOCK keyword value in the ISPF Configuration Table to NO.

The members are to be locked. The data set associated with the from-data-id must be a LMF-controlled ISPF library or partitioned data set. The member is locked under the logon ID of the user performing the copy and lock. No other user can change that member in the LMF-controlled library until the current owner promotes it. If a member cannot be locked it is not copied.

If a list of members is being copied and one cannot be locked, processing stops and a message is issued indicating how many members were copied.

SCLMSET
ISPF maintains a bit in the PDS directory to indicate whether a member was last modified using SCLM or some function outside of SCLM. The SCLMSET value indicates how to set this bit. YES indicates to set the bit ON. NO indicates the bit should be OFF. If you want to keep the current setting for a certain member, omit the SCLMSET parameter.
ALIAS|NOALIAS
With ALIAS in effect, either the main member or any alias member may be selected to copy the main member and all of its aliases. This will occur even if a single member is specified or if some of the members are not displayed in the current member selection list.

With NOALIAS in effect, aliases must be copied manually to maintain the correct alias relationship. That is, the main member must be copied first followed by the aliases.

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 procedure.

Return codes

These return codes are possible:
 0
Normal completion.
 4
Member not available, which indicates one of these situations:
  • The "from" data set is empty.
  • No members matched the specified pattern in the "from" data set.
 8
  • The from-member-name was not found.
  • The same name was specified for to-member-name and from-member-name.
10
No data set is associated with the given data ID.
12
One of these:
  • A like-named member already exists in the "to" data set and the Replace option was not specified
  • One or more members of the "to" data set are "in use", either by you or by another user, and could not be copied
  • Invalid data set organization
  • Data set attribute invalid for copying or copying packed data
  • Open error
  • LOCK parameter is specified
16
Truncation error.
20
Severe error; unable to continue.

Example

This example invokes the LMCOPY service to copy all member names beginning with the letter 'L' in the data set associated with the data ID in variable DDVAR to the data set associated with the data ID in variable DDVAR2. Like-named members in the "to" data set are replaced, the data is packed, and truncation will occur if necessary.

Command invocation

ISPEXEC LMCOPY FROMID(&DDVAR) FROMMEM(L*)             +
                TODATAID(&DDVAR2) REPLACE PACK TRUNC

Call invocation

CALL ISPLINK('LMCOPY  ',DDVAR,'L* ',DDVAR2,' ', 'REPLACE ',
                  'PACK    ','TRUNC   ');

or

Set the program variable BUFFER to contain:
BUFFER = 'LMCOPY FROMID(&DDVAR) FROMMEM(L*)
         TODATAID(&DDAVAR2) REPLACE PACK TRUNC';
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