Dynamic allocation

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.

To tell the system the number of resources to be held in anticipation of reuse, code:
   //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.

Example:
//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
  .
/*