SPACE Parameter

Purpose

The SPACE parameter specifies how much disk space to allocate for a new data set. It defines the primary allocation amount, secondary allocation amount (for extending the data set), and directory space for partitioned data sets.

Syntax

Basic Format

jcl
1
//ddname DD SPACE=(unit,(primary[,secondary][,directory]))

Extended Format

jcl
1
//ddname DD SPACE=(unit,(primary[,secondary][,directory])[,RLSE][,CONTIG|MXIG|ALX][,ROUND])

Absolute Track Format

jcl
1
//ddname DD SPACE=(ABSTR,(primary,address[,directory]))

Parameter Values

Unit Types

UnitDescriptionExample
TRKTracksSPACE=(TRK,(10,5))
CYLCylindersSPACE=(CYL,(2,1))
blocklengthAverage block length in bytesSPACE=(800,(100,50))
KKilobyte (1024 bytes)SPACE=(1K,(500,100))
MMegabyte (1,048,576 bytes)SPACE=(1M,(10,5))

Primary Allocation

  • Specifies the initial amount of space to allocate
  • Required parameter
  • Value is an integer representing the number of units (tracks, cylinders, blocks, etc.)
  • Example: SPACE=(TRK,(15)) allocates 15 tracks

Secondary Allocation

  • Specifies the additional amount of space to allocate if the primary allocation is filled
  • Optional parameter (if omitted, no secondary allocation occurs)
  • Each time the data set needs more space, this amount is allocated
  • Up to 15 or 16 secondary extents can be created, depending on system setup
  • Example: SPACE=(CYL,(5,2)) allocates 5 cylinders initially and 2 cylinders for each extension

Directory Blocks

  • Used only for partitioned data sets (libraries)
  • Specifies the number of 256-byte directory blocks to allocate
  • Each directory block can contain entries for approximately 5-6 members
  • Cannot be extended; if directory space is exhausted, the data set must be reorganized
  • Example: SPACE=(CYL,(10,5,20)) allocates 20 directory blocks (enough for about 100-120 members)

Optional Parameters

RLSE (Release)

Requests that unused space be released when the data set is closed.

Example: SPACE=(TRK,(100,10),RLSE)

Contiguity Options

OptionDescription
CONTIGRequests contiguous space for the primary allocation
MXIGRequests the largest available contiguous block of space on the volume
ALXRequests allocation of up to five separate contiguous blocks of space

ROUND

When allocating by average block length, ROUND ensures that the space allocated is a whole number of cylinders.

Example: SPACE=(800,(100,50),,ROUND)

Examples

Basic Track Allocation

jcl
1
2
//OUTDD DD DSN=USER.DATA.SET,DISP=(NEW,CATLG,DELETE), // UNIT=SYSDA,SPACE=(TRK,(10,5))

Allocates 10 tracks initially with 5 tracks for each extension

Cylinder Allocation with Release

jcl
1
2
//CYLDD DD DSN=USER.LARGE.FILE,DISP=(NEW,CATLG,DELETE), // UNIT=3390,SPACE=(CYL,(5,2),RLSE)

Allocates 5 cylinders initially with 2 cylinders for each extension, releasing unused space at close

Partitioned Data Set with Directory

jcl
1
2
3
//LIBDD DD DSN=USER.SOURCE.LIB,DISP=(NEW,CATLG,DELETE), // UNIT=SYSDA,SPACE=(TRK,(50,20,10)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=6160,DSORG=PO)

Creates a library with 50 tracks initial allocation, 20 tracks for extensions, and 10 directory blocks

Average Block Allocation

jcl
1
2
//BLKDD DD DSN=USER.BLOCK.FILE,DISP=(NEW,CATLG,DELETE), // UNIT=SYSDA,SPACE=(6144,(200,50))

Allocates space based on an average block length of 6144 bytes, with 200 blocks initially

Maximum Contiguous Space

jcl
1
2
//MAXDD DD DSN=USER.MAX.SPACE,DISP=(NEW,CATLG,DELETE), // UNIT=SYSDA,SPACE=(CYL,(100,50),,MXIG)

Allocates the largest available contiguous space on the volume, up to 100 cylinders

Allocation in Kilobytes

jcl
1
2
//KDD DD DSN=USER.KB.FILE,DISP=(NEW,CATLG,DELETE), // UNIT=SYSDA,SPACE=(1K,(1000,200))

Allocates space for approximately 1000 1K blocks initially

Absolute Track Allocation

jcl
1
2
//ABSDD DD DSN=USER.SPECIAL.FILE,DISP=(NEW,CATLG,DELETE), // UNIT=3390,SPACE=(ABSTR,(15,100))

Allocates 15 tracks beginning at absolute track address 100 (rarely used in modern systems)

Space Calculation Tips

For Sequential Data Sets

  1. Records per track formula:

    Records per track = Track capacity / (Record length + Overhead)

  2. Primary space calculation:

    Primary tracks = (Total records / Records per track) × Safety factor (1.1-1.2)

  3. Secondary space guideline:

    Typically 10-20% of primary allocation

For Partitioned Data Sets

  1. Directory blocks needed:

    Directory blocks = (Number of members / 5) + 1

  2. Space consideration:

    Allocate space for both member data and directory

Best Practices

  1. Use cylinder allocations for large data sets for better performance
  2. Always specify secondary allocation to allow for data set growth
  3. Use RLSE for data sets that may not use all allocated space
  4. Be generous with directory blocks for PDS; they cannot be extended
  5. Avoid over-allocation to prevent wasting disk space
  6. Use SMS-managed storage where available to automate space management

Related Concepts

  • DD Statement - The statement where SPACE parameters are specified
  • DCB Parameter - Often used with SPACE to define data set characteristics
  • UNIT Parameter - Specifies the device type where space will be allocated
  • VOLUME Parameter - Specifies the volume where space will be allocated