Allocating Datasets - ALLOCATE Command


ALLOCATE (ALLOC) command used to dynamically defines and allocates a new dataset -

  • With or without an attribute list of DCB parameters.
  • With attributes copied from an existing dataset.

Syntax -

ALLOC FILE(DDname) DA(dsname) [options]

where -

  • DDname is the 8 character name for the DataSet.
  • dsname is the name of the dataset to be allocated.
  • Options are the characteristics of the dataset, such as its organization, record format, and block size.

Examples -

Scenario1 - Allocate a new sequential dataset called MATEPK.TSO.TETPS.

ALLOC FI(REPORT) DA('MATEPK.TSO.TESTPS')
   NEW SP(1,1) CYL LRECL(80) RECFM(F B)
   BLKSIZE(800) VOL(DEVHD4)
ALLOCATE command

This would create a new sequential dataset called MATEPK.TSO.TESTPS on the default volume.

Scenario2 - Allocate a new sequential dataset called MATEPK.TSO.TETPDS.

ALLOC FI(TESTPDS) DA('MATEPK.TSO.TESTPDS')
   NEW SP(1,1) CYL LRECL(80) RECFM(F B) DIR(10) DSORG(PO)
   BLKSIZE(800) VOL(DEVHD2)
ALLOCATE command

This would create a new PDS called MATEPK.TSO.TESTPDS on the volume DEVHD2.

Note! There are many options are available with ALLOCATE command and used when they needed.