Dynamic allocation
Connecting a dataset to a DD name while a program or session is already running, instead of with a DD statement in JCL.
Also written dynamic allocation, ALLOC, BPXWDYN, SVC 99, FREE
In a batch job, datasets are usually connected to programs by DD statements, which are processed before each step starts. Dynamic allocation does the same job while something is already running. A program, REXX exec or TSO user asks for a dataset and DD name when they are needed, and frees them afterwards.
In TSO and REXX, the ALLOCATE command, often shortened to ALLOC, does this: ALLOC FI(INDD) DA('ZBANK.DATA.ACCOUNTS') SHR. FREE FI(INDD) releases it. Programs can use services such as BPXWDYN, which takes a command in a similar form, or the lower-level interface behind it, SVC 99.
It is useful when a program does not know in advance which datasets it will need, such as a tool that processes a list of names it reads at run time. It is also how your TSO session gets its own libraries, such as your REXX and ISPF datasets, at logon.
A common mistake is forgetting to free allocations. In a long TSO session or a long-running program, allocations that are never freed keep datasets reserved and can stop other jobs.
Where can I learn this hands-on?
Right here, at ZedBank. You take a junior job at a simulated bank and learn each part of the work by doing it, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- DD statementThe JCL statement that connects a name inside a program to a real dataset outside it.
- ALLOCATEA TSO command that creates a new dataset, or connects an existing one to your session.
- REXX execA REXX program, stored as a member in a library and run by name from TSO or ISPF.
- EXECIOThe REXX command for reading records from a dataset, or writing records to one, under TSO.
- TSO commandA command typed at a TSO prompt or on an ISPF command line to ask the system to do something directly.