DYNALLOC is a subroutine, actually two subroutines linked into a single load module, that may be called from a COBOL main program to dynamically allocate datasets at run time.
It is located in File #270 of the CBT tape and is part of a
collection submitted by the Washington Department of Information Services.
The main routine was written by Jeff Sprehn and the secondary subroutine,
BREAKDSN, was written by Gary Duffield.
There are no changes required to assemble this command under MVS 3.8j as it exists on the CBT tape. The single jobstream - dynalloc.jcl - that assembles both the main routine and compiles the COBOL secondary routine is contained in the archive dynalloc.tar.gz [MD5: 3a2cf635cfd401806d40eb6ff8dfa227]. Download the archive and extract the jobstream (WinZip on Windows/?? or tar on Linux). Submit the jobstream to assemble and link the single load module into SYS2.LINKLIB. If you don't have SYS2.LINKLIB defined, you will need to modify the jobstream to specify a different target load library.
This program is a subroutine which dynamically allocates the following types of datasets to the DDNAME given: * Sequential dataset * A partitioned dataset with or without member name * A GDG expressed with absolute or relative generation number * A VSAM file To call this program from COBOL, do the following: 1. Place the following area in WORKING STORAGE: 01 DYNALLOC-I-O-AREA. 05 DDNAME PIC X(8). 05 DSNAME PIC X(44). 2. Place the following in the PROCEDURE DIVISION: MOVE your ddname TO DDNAME OF DYNALLOC-I-O-AREA. MOVE your dataset name TO DSNAME OF DYNALLOC-I-O-AREA. CALL 'DYNALLOC' USING DYNALLOC-I-O-AREA. 3. After the call, examine RETURN-CODE RETURN CODE Value Meaning 0 Dynamic allocation was successful 4 Unable to free the DDNAME 8 Unsuccessful dynamic allocation 12 Dataset not catalogued 16 Invalid DSNAME given Example Within a COBOL program, dynamically allocate a VSAM file called VSAMA.AGY999.TABLE.INDEX.BASE to DDNAME=TABLINDX MOVE 'TABLINDX' TO DDNAME OF DYNALLOC-I-O-AREA. MOVE 'VSAMA.AGY999.TABLE.INDEX.BASE' TO DSNAME OF DYNALLOC-I-O-AREA. CALL 'DYNALLOC' USING DYNALLOC-I-O-AREA. IF RETURN-CODE = 0 NEXT SENTENCE ELSE Do error routine (See Table of return codes)
I hope that you have found my instructions useful. If you have questions that I can answer to help expand upon my explanations and examples shown here, please don't hesitate to send them to me:
This page was last updated on January 17, 2015 .