z/OS Data set and member utilities
You can use the Data set and member utilities to operate on data sets or members. Operations include: rename data set, rename member, copy data set and copy member, migrate data set, recall a migrated data set, delete a backup version of a data set.
HTTP method and URI path
PUT /zosmf/restfiles/ds/<to-data-set-name>
PUT /zosmf/restfiles/ds/<to-data-set-name>(<member-name>)
PUT /zosmf/restfiles/ds/<to-data-set-name>
PUT /zosmf/restfiles/ds/<to-data-set-name>(<member-name>)
PUT /zosmf/restfiles/ds/-(<to-volser>)/<to-data-set-name>
PUT /zosmf/restfiles/ds/-(<to-volser>)/<to-data-set-name>(<member-name>)
PUT /zosmf/restfiles/ds/<to-data-set-name>
- /zosmf/restfiles specifies the z/OS® data set and file REST interface
- /ds indicates a Dataset request
- -(<volser>) represents a volume serial. For an uncataloged data set, include this parameter to identify the volume to be searched for data sets or members that match the specified <data-set-name> or <member-name>. The length of the volume serial cannot exceed six characters. You cannot use wildcard characters for this parameter. Indirect volume serials are not supported.
- <to-data-set-name> identifies the target data set name. This parameter is required and must consist of a fully qualified data set name. The length of the data set name that you specify on the request cannot exceed 44 characters.
- <member-name> identifies the target PDS or PDSE member name.
Headers
- X-IBM-BPXK-AUTOCVT
- This header is optional; use it to indicate how file auto conversion is handled when using the
copy operation to copy text mode data sets to POSIX files, if you omit this header, the system
default is taken.
- 'on' or 'all'
- The target file is a candidate for automatic conversion if its TXTFLAG is tagged TEXT and the source data set is type TEXT.
- 'off'
- The target file is not a candidate for automatic conversion
- X-IBM-Migrated-Recall
- This header is optional; use it to specify how a migrated data set is handled. By default, a migrated data set is recalled synchronously. The following values may be specified too:
- wait
- This is the default value. If the data set is migrated, wait for it to be recalled before processing the request.
- nowait
- If the data set is migrated, request it to be recalled, but do not wait.
- error
- If the data set is migrated, do not attempt to recall the data set.
The header, Content-Type: application/json; charset={charset-name}, must be specified as well.
Request body
Function | Property | Description | Required |
---|---|---|---|
hmigrate | wait:true|false | If true then the function waits for completion of the request. If false the request is queued. | |
hrecall | wait:true|false | If true then the function waits for completion of the request. If false the request is queued. | |
hdelete | wait:true|false | If true then the function waits for completion of the request. If false the request is queued. | |
purge:true|false | If true then the function uses the PURGE=YES on ARCHDEL request. If false the function uses the PURGE=NO on ARCHDEL request. | ||
rename | request | Indicates the function name. | Yes |
from-dataset | The data set to rename. | Yes | |
|
Yes | ||
|
No | ||
enq | enq for the "to" data set is only allowed for renaming members. Values may be SHRW or
EXCLU. SHRW is the default or PDS members, EXCLU otherwise. |
No | |
copy | request | Indicates the function copy. | Yes |
from-file | The file to copy. | You must choose either from-file or from-dataset. | |
|
|||
|
|||
from-dataset | The dataset to copy. | ||
|
|||
|
|||
|
|||
|
|||
enq | Only applicable when from-dataset specified. With from-file, an error is reported (see note
below).This is the enqueue type for the "to" data set. Allowed values are: SHR, SHRW, EXCLU;SHRW is
the default for PDS, EXCLU for sequential. The source data set is always enqueued via SHR. Note: When
from-file is specified, the target dsn is opened with DISP=OLD (EXCLU) with one exception: if the
target is a PDS and the from-file/type is text, the target PDS is enqueued SHRW. This is not
required.
|
No | |
replace:true|false | Applicable with from-dataset. When from-file specified,ignored unless from-file/type=text. if true, members in the target dataset are replaced. if false(default), like named members are not copied and an error is returned. | No |
Required authorizations
Usage considerations
Expected response
On completion, the service returns an HTTP response, which includes a status code indicating whether your request completed. Status code 200 OK indicates success. A status code of 4nn or 5nn indicates that an error has occurred. For more details, see Error handling.
For errors, the HTTP response includes error information as a JSON error report document. See Error report document.
Example
Request:
PUT https://zosmf1.yourco.com/zosmf/restfiles/ds/MY.NEW.DSN HTTP/1.1
Content-Type: application/json; charset=UTF-8
{"request":"rename", "from-dataset":{"dsn":"MY.OLD.DSN"}}
Example
Request:
PUT https://zosmf1.yourco.com/zosmf/restfiles/ds/MY.NEW.DSN(MYMEM2) HTTP/1.1
Content-Type: application/json; charset=UTF-8
{"request":"copy", "from-dataset":{"dsn":"MY.OLD.DSN", "member":"MYMEM1"}, "replace":true }