Retrieving data set organization information from allocation

You can also request that the data set organization (DSORG) of the allocated data set be returned in the DYNALLOC macro parameter list. Dynamic allocation returns whatever you specify as the DSORG, if anything. If you do not specify a DSORG on the allocation request, the system assigns and returns a data set organization according to the following defaults:
  • If the allocation request is for a terminal as an I/O device or for a SYSOUT data set, ‘PS’ (physical sequential) is returned as a default value.
  • If the allocation request is for a tape data set, ‘PS’ is returned as a default value.
  • If the allocation request is for a NEW direct access data set, ‘PO’ (partitioned organization) is returned if you specified a non-zero directory space quantity; otherwise, the data set is assigned the DSORG of ‘PS’. The ‘PS’ default value is not stored into the data set control block (DSCB) until the data set has been opened. If the newly allocated data set has not been unallocated, the default DSORG value can be obtained by issuing the information retrieval function. (See Obtaining allocation environment information and Dynamic information retrieval text units.)
  • If the allocation request is for an existing direct access data set, the data set organization obtained from the data set control block (DSCB) is returned. If the DSORG cannot be obtained from the DSCB, the allocation request fails.
  • If the allocation request is for a non-existing non-SMS-managed data set, for which a status of SHR or OLD has been specified, a request for return of the DSORG causes the dynamic allocation to fail unless a DSORG value is also supplied on the request.
  • For other types of allocation requests in which you do not specify a DSORG for the data set, the system returns zeros in the DYNALLOC macro parameter list field.