Previous Topic: $DSCALL OPT=ALIAS

Next Topic: $DSCALL OPT=ALLOC STAT=NEW


$DSCALL OPT=ALLOC

Allocates an existing cataloged data set.

&CONTROL SHRVARS=($DS)

EXEC $DSCALL OPT=ALLOC
             DSN=dataset_name
           [ DD=DD_name ]
           [ DISP= { KEEP | DELETE } [, { KEEP | DELETE } ] ]
           [ MIGRATE= { YES | NO } ]
           [ MOUNT= { NO | YES } ]
           [ STAT= { OLD | MOD | SHR } ]
           [ INFO= { YES | WAIT | NOWAIT | NO } ]

This call is used to allocate an existing cataloged data set to your product region. The data set remains allocated to your product region until it is explicitly deallocated, or your product region terminates.

Operands:

OPT=ALLOC

Specifies that a data set is to be allocated.

DSN=dataset_name

Specifies the data set name to allocate.

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.

MIGRATE={ YES | NO }

Specifies whether to allocate a data set if it has been migrated. If MIGRATE=NO is specified, Dataset Services checks that the data set has been migrated (for example, by DFHSM). If the data set has been migrated, Dataset Services rejects the allocation request. If MIGRATE=YES is specified, Dataset Services issues the allocation request without checking that the data set has been migrated.

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.

STAT= { OLD | MOD | SHR }

Specifies the data set status.

INFO= { YES | WAIT | NOWAIT | NO }

Allocation information is obtained by using the Dynamic Allocation (SVC 99) services, which require the SYSZTIOT system resource, which may not be available. The INFO= parameter specifies whether allocation information is required and, if so, the action required when SYSZTIOT is not available:

INFO=YES

Indicates that information is required. If the SYSZTIOT resource is not immediately available, then $DSCALL retries the allocation information request up to five times at two-second intervals. This is the default.

INFO=WAIT

Also indicates that information is required. If the SYSZTIOT resource is not immediately available, then $DSCALL retries the allocation information request at two-second intervals until the information is available.

INFO=NOWAIT

Also indicates that information is required. If the SYSZTIOT resource is not immediately available, then $DSCALL does not retry.

INFO=NO

Indicates that allocation information is not required.

If allocation information is requested (INFO=YES, INFO=WAIT, or INFO=NOWAIT), then the information is returned as described in the Return Variables section below. If allocation information is not requested (INFO=NO) or the SYSZTIOT resource is not available after any retries (INFO=YES or INFO=NOWAIT), then the return variables are undefined.

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; values are OLD, MOD, or SHR

&$DSDSN

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

&$DSMEM

Member name if a member of a PDS

&$DSORG

Data set organization; values are PS, PO, PSU, POU, CX, CQ, MQ, GS, TX, TQ, TR, and VS

&$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

&$

DYNALLOC information code

Examples: OPT=ALLOC

EXEC $DSCALL OPT=ALLOC DSN=CUSTOMER.DATA STAT=SHR

Notes:

Only cataloged data sets are supported. Unit and volume parameters are not supported by this function.

If the data set has been migrated, the allocation may be delayed if a tape mount is required to recover the migrated data set.

Allocation of a data set uses the Dynamic Allocation (SVC 99) services, which require the SYSZTIOT system resource. An unconditional SVC 99 is used at first. This causes the allocation function to wait if SYSZTIOT is unavailable.

If allocation fails, then &$DSRC is set to 4 and specific information is made available in &$DSFDBK, &$DSDYNEC, &$DSDYNIC, and &SYSMSG.

If the data set is allocated, then &$DSRC is always set to zero. If allocation information was requested (INFO=YES, INFO=WAIT, or INFO=NOWAIT), then a conditional SVC 99 is used to obtain the allocation information which is returned in the &$DS* variables. If the information is available in the return variables, then &$DSFDBK is also set to zero. If INFO=YES or INFO=NOWAIT was specified, then failure of the allocation information request due to SYSZTIOT being unavailable is indicated by the following:

&$DSFDBK = 5
&$DSDYNEC = 0254

More information:

$DSCALL OPT=ALLOCINFO