Dynamic allocation allows a job to acquire resources as they are needed and release them immediately after use. The resources are a ddname-data set combination with its volumes and devices.
One reason to use dynamic allocation is that you might not know all of the device requirements for a job before execution. Another reason is that it allows the system to use resources more efficiently; that is, the system can acquire resources just before their use and then release them immediately after use.
//stepname EXEC PGM=x,DYNAMNBR=n
The system uses the sum of this number and the number of DD statements in the step to establish a control limit for tracking resources that it is holding in anticipation of reuse.
For more information on dynamic allocation, see z/OS MVS Programming: Authorized Assembler Services Guide.
//PROS JOB 1585,SALLYJ,CLASS=A,PERFORM=70
//STEP1 EXEC PGM=TEST,DYNAMNBR=4,PARM=(P3,123,MT5)
//OUT1 DD SYSOUT=C,FREE=CLOSE
//OUT2 DD SYSOUT=A
//SYSIN DD *
.
.
data
.
/*
3 DD statements + 4 = 7
If this control limit is reached and another dynamic allocation is requested, the request will not be honored unless resources can be unallocated so that the control limit is not exceeded.