Dynamic Disk Allocation in MVS3.8J using SVC 99

What I wanted to achieve was from within a S/370 assembler program dynamically allocate a DASD device, similar to the JCL statement
//DDNAME DD DISP=SHR,UNIT=dddd,VOL=SER=vvvvvv
To re-inforce that I wanted to dynamically allocate a DASD device, not a dataset.

The dynamic allocation SVC is SVC 99, the sys1.maclib macro DYNALLOC (in mvs3.8j anyway) does nothing but issue the SVC 99. It is up to the programmer to create the key/value pairs manually, using the templates provided by IEFZB4D0 and IEFZB4D2 to create mapping dsects and equate values. All pretty straight forward for allocating datasets.

The main issues I had, which are more fully covered below, were

  1. As I said, pretty straight forward for allocating datasets. It can only allocate datasets (with limitations as below in this list). It cannot allocate just the disk, must be a dataset
  2. Using SVC 99 the UNIT specification can be a unit Cuu address or an esoteric device type such as SYSDA, SYSALLDA etc. Esoteric device types caused me a lot of issues covered below in this post
  3. You can specify a volser name in the key/value pair. The issue I hit here, which I have not been able to find documeneted anywhere, is that if you use an esoteric device name the volser is ignored for new files, on mvs3.8j anyway
  4. As documented in the IBM manual (which I eventually had to read) it is not possible to dynamically allocate onto dasd volumes mounted private/resident, such as the ipl volume, paging volumes etc.

Getting around the first point was needed to find the other issues. That was solved by allocating a temporary dataset (“&XX dataset name) of 1 track with a disposition of (new,delete,delete), doing a RDJFCB and modifying some JFCB control block values before accessing the disk. Which led on to the second and third issues.

As I had no easy way of knowing what esoteric group a volser belonged to I tried the standard ALLSYSDA esoteric unit to match all available dasd, in the silly assumption it would use the volser provided. It was a wrong assumption, the new dataset was created on the first available volume in the class (tried esoteric units SYSDA/WORK/SORT etc, tried using a named dataset instead of a temporary dataset, and always the volser was ignored). That was solved by using the unit Cuu number instead of an esoteric entry; the Cuu unit number for the volser was obtained by searching the UCB chain for online dasd devices.

The fourth issue is that it is not possible to dynamically allocate using volumes mounted private/resident; when I finally looked up the dynamic allocation error codes I was getting I found that limitation is documented in the IBM manual GCC28-0627-2 OS/VS2 MVS System Programming Library: Job Management. Or simply put that is a documented feature with no workaround.

Looking at alternatives to dynamic allocation now. The OBTAIN facility can get format 4+5 dscbs of a disk so it may be able to read the format1 dscbs I was really after. But that will be a future post.

Anyway, as a complete aside the dynamic allocation code that does work I have merged into the program it was intended for, as well as a temporary workaround using JCL DD cards to allocate private volumes is available imbedded in this program that can be considered a work in progress.

About mark

At work, been working on Tandems for around 30yrs (programming + sysadmin), plus AIX and Solaris sysadmin also thrown in during the last 20yrs; also about 5yrs on MVS (mainly operations and automation but also smp/e work). At home I have been using linux for decades. Programming background is commercially in TAL/COBOL/SCOBOL/C(Tandem); 370 assembler(MVS); C, perl and shell scripting in *nix; and Microsoft Macro Assembler(windows).
This entry was posted in MVS3.8J. Bookmark the permalink.