Previous Topic: $DSCALL OPT=CONCAT

Next Topic: $DSCALL OPT=COPYPDS


$DSCALL OPT=COPY

Copies sequential data sets or PDS members.

&CONTROL SHRVARS=($DS)
EXEC $DSCALL OPT=COPY
             FROMDSN=dataset_name
             TODSN=dataset_name
           [ DISPLAY= { YES | NO } ]
           { MEMBER=member_name |
             MEMBER={ * | member_name [, member_name,... ] } }
           [ REPLACE= { YES | NO } ]
           [ STAT= { SHR | OLD } ]
           [ SYSPRINT= { KEEP | DELETE | DSN } ]

This call is used to copy a sequential data set to another sequential data set, a sequential data set to a PDS member, a PDS member to a sequential data set, or PDS members to another PDS.

Operands:

OPT=COPY

Specifies that the sequential data set or PDS members be copied.

FROMDSN=dataset_name

Specifies the name of the sequential data set or PDS to be copied.

The following table summarizes the results of the various copy operations.

From

To

Member

Result

Utility

SEQ

SEQ

NULL

Data set copied

IEBGENER

SEQ

PDS (mem)

NULL

Copied to member

IEBGENER

PDS

PDS

NULL

Selection List

IEBCOPY

PDS(*)

PDS

NULL

All members copied

IEBCOPY

PDS (mask)

PDS

NULL

Selected members copied

IEBCOPY

PDS (mem)

PDS

NULL

Member copied to same name

IEBGENER

PDS (mem)

PDS (newmen)

NULL

Member copied and renamed

IEBGENER

PDS (mem)

SEQ

NULL

Member copied to sequential data set

IEBGENER

PDS

PDS

NON-BLANK

As specified in the Member parameter

IEBCOPY

TODSN=dataset_name

Specifies the name of the target data set.

DISPLAY={ YES | NO }

Specifies whether to display the output on completion of the function. This operand is only valid if SYSPRINT=DSN is specified. If DISPLAY=YES is specified, a full-screen display of the SYSPRINT data set is presented after the copy operation has completed.

MEMBER={ member_name | MEMBER={* | member_name [ , member_name... ] } }

Specifies the names of the members to be copied. If MEMBER=* is specified, all members in the PDS are copied.

If the value of the MEMBER operand is a member name containing a mask (for example, ABC*), all members starting with the specified prefix are copied.

If the value of the MEMBER operand is a list of single member names, only the specified members are copied.

REPLACE={YES | NO }

Specifies whether to replace an existing data set of the same name and is only applicable where the values of the FROMDSN and TODSN operands are both PDS data sets.

If REPLACE=YES is specified, the member name specified in the FROMDSN operand is copied and given the member name specified in the TODSN operand even if that member name already exists.

If REPLACE=NO is specified, the member specified in the FROMDSN operand is not copied if the member name specified in the TODSN operand already exists.

STAT={ OLD | SHR }

Specifies whether the data set specified in the TODSN operand is allocated exclusively for the copy operation (STAT=OLD), or is shared with other users (STAT=SHR). It is recommended that STAT=OLD be used as data set integrity cannot be guaranteed if another user attempts to access the data set while the copy operation is in progress.

The data set specified in the FROMDSN operand is always allocated with STAT=SHR.

SYSPRINT={ DELETE | KEEP | DSN }

Specifies the type of data set to be allocated to the SYSPRINT DD for the copy operation.

If SYSPRINT=KEEP is specified, your product region allocates a SYSOUT file with CLASS=A, and after the copy has completed the SYSOUT data set is deallocated with DISP=KEEP to cause it to be kept. The output from the copy operation is browsed through, for example, SDSF.

If SYSPRINT=DELETE is specified, your product region allocates a SYSOUT file with CLASS=A, and after the copy has completed, the SYSOUT file is deallocated with DISP=DELETE to cause it to be deleted. The output from the copy operation cannot be browsed.

If SYSPRINT=DSN is specified, your product region allocates a temporary data set, which is deleted when your product region terminates. The output from the copy operation is browsed through ISPF or by the use of the DISPLAY=YES operand on this call. The data set is not deallocated from your product region on completion of the copy operation. The data set name, ddname and volume for the data set are returned in variables to the caller. Removing the data set is the responsibility of the caller-the caller should deallocate the data set to delete it.

Return Codes:

Note: For more information about &SYSMSG, &$DSRC, and &$DSFDBK, see Return Codes and Feedback Codes.

Return Variables:

&$DSPRINTDSN

SYSPRINT data set name

&$DSPRINTDD

SYSPRINT ddname

&$DSPRINTVOL

SYSPRINT data set volume

Example: OPT=COPY

EXEC $DSCALL OPT=COPY FROMDSN=SYS1.DEV.SAMPLE +
   TODSN=SYS1.WORK.TEST01