Create a sequential or partitioned data set

You can use this operation to create sequential and partitioned data sets on a z/OS system.

HTTP method and URI path

POST /zosmf/restfiles/ds/<dataset-name>
Where:
  • /zosmf/restfiles specifies the z/OS® data set and file REST interface
  • /ds indicates a data set request
  • <dataset-name> is the name of a z/OS data set that you are going to create.

Request Body

The request body to create a sequential or partitioned data set is shown in Request body to create a sequential and partitioned data set .

Table 1. Request body to create a sequential or partitioned data set
Field Type Description
volser String Volume serial.
unit String Device type.
dsorg String Data set organization.
alcunit String Unit of space allocation.
primary Integer Primary space allocation.
secondary Integer Secondary space allocation.
dirblk Integer Number of directory blocks.
avgblk Integer Average block size.
recfm String Record format.
blksize Integer Block size.
lrecl Integer Record length.
storclass String Storage class.
mgntclass String Management class.
dataclass String Data class.
dsntype String Data set type.
Start of changelikeEnd of change Start of changeStringEnd of change Start of changeModel data set name.End of change

Standard headers

None.

Custom headers

Start of changeX-IBM-Target-System = <string>End of change
Start of changeThis header indicates the target system name (nick name) for this request, where the system name (nick name) is defined in the local system Systems table. The target host system must support single-sign-on by using either an LTPA token or a valid X-IBM-Target-System-User and X-IBM-Target-System-Password is provided for the target system. If the target system is the local system, this header is ignored and has no effect.End of change
Start of changeX-IBM-Target-System-UserEnd of change
Start of changeThis header indicates the z/OS user ID that allows the user to access the target system. If the X-IBM-Target-System header is not supplied, this header is ignored. Both X-IBM-Target-System-Password and X-IBM-Target-System-User must be provided together; otherwise, this header is ignored.
If this header is not provided in the current request, the current request uses the authenticated user credentials to access the target system if either of the following conditions are true:
End of change
Start of changeX-IBM-Target-System-PasswordEnd of change
Start of changeThis header indicates the password that is associated with the z/OS user ID. If the X-IBM-Target-System header is not supplied, this header is ignored. Both X-IBM-Target-System-Password and X-IBM-Target-System-User must be provided together; otherwise, this header is ignored.End of change

Query parameters

None.

Content type

The content type is application/json.

Required authorizations

See Required authorizations.

Usage considerations

See Usage considerations for the z/OSMF REST services.

Expected response

On completion, the service returns an HTTP response, which includes a status code indicating whether your request completed. Status code 201 indicates success. A status code of 4nn or 5nn indicates that an error has occurred. For more details, see Error handling.

For a successful creating request, 201 Created with no content is returned.

Example request

In the following example, the POST method is used to create a sequential data set.
POST /zosmf/restfiles/ds/JIAHJ.REST.TEST.NEWDS HTTP/1.1

Request body:

{"volser":"zmf046","unit":"3390","dsorg":"PS","alcunit":"TRK","primary":10,
"secondary":5,"avgblk":500,"recfm":"FB","blksize":400,"lrecl":80}

Example response

A sample response is shown in Example: Create a data set.
Figure 1. Example: Create a data set
201 Created
Content-Type:  application/json; charset=UTF-8
Content-Length:  0
Date:  Wed, 16 Sep 2015 10:54:21 GMT 

Example request

In the following example, the POST method is used to create a partitioned data set.
POST /zosmf/restfiles/ds/JIAHJ.REST.TEST.NEWDS02 HTTP/1.1

Request Body

{"volser":"zmf046","unit":"3390","dsorg":"PO","alcunit":"TRK","primary":10,
"secondary":5,"dirblk":10,"avgblk":500,"recfm":"FB","blksize":400,"lrecl":80}

Example response

A sample response is shown in Example: Create data set.
Figure 2. Example: Create data set.
201 Created
Content-Type:  application/json; charset=UTF-8
Content-Length:  0
Date:  Wed, 16 Sep 2015 11:14:13 GMT

Example request

In the following example, the POST method is used to create a PDSE data set.
POST /zosmf/restfiles/ds/JIAHJ.REST.TEST.NEWDS02 HTTP/1.1

Request Body

{"volser":"zmf046","unit":"3390","dsorg":"PO","alcunit":"TRK","primary":10,
"secondary":5,"dirblk":10,"avgblk":500,"recfm":"FB","blksize":400,"lrecl":80,"dsntype":"LIBRARY"}

Example response

A sample response is shown in Figure 3.
Figure 3. Example: Create PDSE data set.
201 Created
Content-Type:  application/json; charset=UTF-8
Content-Length:  0
Date:  Wed, 11 Oct 2017 11:14:13 GMT