Previous Topic: $DSCALL OPT=ALLOC

Next Topic: $DSCALL OPT=ALLOC SYSOUT=class


$DSCALL OPT=ALLOC STAT=NEW

Creates and allocates a new non-VSAM data set.

&CONTROL SHRVARS=($DS)
EXEC $DSCALL OPT=ALLOC STAT=NEW
             FORMAT=dataset_format
             ORG=dataset_organization
             SPACE={ TRK | CYL } , pri,sec [ ,dir ]
           [ BLKSIZE=blocksize ]
           [ DATACLS=class ]
           [ DD=DD_name ]
           [ DISP={ KEEP | DELETE } [, { KEEP | DELETE } ] ]
           [ DSN=dataset_name ]
           [ DSNTYPE={ HFS | LIBRARY | PDSE } ]
           [ FREE={ UNAL | CLOSE } ]
           [ LRECL=logical_record_length ]
           [ MGMTCLS=class ]
           [ MOUNT={ NO | YES } ]
           [ RLSE={ NO | YES } ]
           [ STORCLS=class ]
           [ VOL=volser [ UNIT=unit ] ]

This call is used to create a new data set and allocate it to your product region. The data set remains allocated to your product region until it is explicitly deallocated, until a CLOSE is requested if allocated with FREE=CLOSE, or until your product region terminates. When the data set is deallocated or your product region terminates, the data set is deleted if the relevant disposition specified DELETE.

Operands:

OPT=ALLOC

Specifies that a data set is to be allocated.

STAT=NEW

Specifies that the status of the data set is NEW.

FORMAT=dataset_format

Specifies the data set format for the new data set. Valid values are: F, FB, FS, FBS, FA, FBA, FSA, FBSA, FM, FBM, FSM, FBSM, V, VB, VS, VBS, VBSA, VM VBM, VSM, VBSM, U, UA, UM.

ORG=dataset_organization

Specifies the data set organization for the new data set. Valid values are: PS, PO, PSU, and POU.

SPACE={ TRK | CYL } , pri,sec [ ,dir ]

Specifies the space allocation in tracks or cylinders. The SPACE type and primary allocation quantity are required. The directory allocation quantity is required if the data set is a PDS.

BLKSIZE=blocksize

Specifies the block size for the new data set. The value must be an integer in the range 0 to 32,760.

DATACLS=class

Specifies the SMS data class.

DD=DD_name

Specifies the ddname for the allocation. If this operand is omitted, a ddname is generated by the operating system.

DISP={ KEEP | DELETE } , { KEEP | DELETE }

Specifies the Normal and Conditional Disposition of the data set. The disposition relates to the normal or conditional termination of your product region, not of the requesting NCL process. If KEEP is specified, the data set remains cataloged.

If DELETE is specified, the data set is uncataloged and deleted.

If a temporary data set is allocated (that is, the DSN operand is omitted) then DISP=DELETE, DELETE is forced. This ensures the data set is deleted when it is deallocated or when your product region terminates.

If the DSN operand is specified and the DISP operand is omitted, DISP defaults to KEEP. In this case the data set will be cataloged. If your product region terminates abnormally, the action taken is decided by the operating system.

DSN=dataset_name

Specifies the data set name to be created. If the DSN operand is omitted, a temporary data set is allocated. When a temporary data set is allocated, no disposition is allowed and DELETE, DELETE is forced.

DSNTYPE={ HFS | LIBRARY | PDSE }

Specifies whether you want to create a Hierarchical File System (HFS) file or a PDSE data set:

HFS

Specifies an HFS file

LIBRARY or PDSE

Specifies a PDSE data set

FREE={ UNAL | CLOSE }

Specifies whether the data set is to be deallocated by explicit request only (FREE=UNAL) or is to be deallocated when the file is closed (FREE=CLOSE).

LRECL=logical_record_length

Specifies the logical record length for the new data set. The value must be an integer in the range 1 to 32,760.

MGMTCLS=class

Specifies the SMS management class.

MOUNT={ NO | YES }

Specifies whether a volume mount is allowed. If MOUNT=NO is specified, and an allocation request requires a volume which is off-line, the allocation request fails. If MOUNT=YES is specified and an allocation request requires a volume which is off-line, a MOUNT request for the volume is issued.

RLSE={ NO | YES }

Specifies the secondary space release option.

STORCLS=class

Specifies the SMS storage class.

VOL=volser [ UNIT=unit ]

Specifies the volume serial number and unit name for the new allocation. If the VOL operand is omitted, the operating system determines if the allocation is allowed, and may choose to allocate the data set or any volume which the requesting user is authorized for.

Return Codes:

$DSRC

$DSFDBK

Meaning

0

0

Data set was allocated; allocation details available in &$DS* variables as described below.

0

non-zero

Data set was allocated; however, allocation details are incomplete.

4

non-zero

Data set was not allocated.

8

non-zero

A Dataset Services Interface error has occurred and the function is incomplete. This is typically an application program specification error. The error is indicated in &SYSMSG with message number DSnnnn.

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

Return Variables:

&$DSSTAT

Status of data set; value is NEW

&$DSDSN

Full data set name with member name omitted, and true name if an alias was entered

&$DSDSNTYPE

Type of file or data set; value is HFS or LIBRARY

&$DSMEM

Member name if a member of a PDS

&$DSORG

Data set organization; values are PS, PO, PSU, and POU

&$DSVOL

First volume

&$DSUNIT

Unit name for the volume

&$DSRECF

Record format, values are F, FB, FS, FBS, FA, FBA, FSA, FBSA, FM, FBM, FSM, FBSM, V, VB, VS, VBS, VBSA, VM, VBM, VSM, VBSM, U, UA, UM

&$DSRECL

Record length

&$DSRECA

Actual usable record length. If the record format is variable length, then the value is record length minus 4. In all other cases the value is the same as record length.

&$DSBLKS

Block size

&$DSDDNAME

DDname from the allocation, as supplied or as generated by the operating system

&$DSSTORCLS

SMS storage class if SMS is active for this data set

&$DSMGMTCLS

SMS management class if SMS is active for this data set

&$DSDATACLS

SMS data class if SMS is active for this data set

&$DSDYNEC

DYNALLOC error code

&$DSDYNIC

DYNALLOC information code

Example: STAT=NEW

EXEC $DSCALL OPT=ALLOC DSN=CUSTOMER.DATA STAT=NEW +
   ORG=PO FORMAT=FB BLKSIZE=800 +
   LRECL=80 SPACE='TRK,5,1,10'

Note: Most non-VSAM data sets is allocated. However, IS and DA data sets are not supported.

More information:

$DSCALL OPT=ALLOC