Mainframe (z/OS)

Create or delete a dataset with JCL (IEFBR14)

Allocate a new dataset, or delete one, in a batch job.

z/OS
Fill these in once
  1. Create a sequential dataset
    Inside JCL
    //NEWDS    EXEC PGM=IEFBR14
    //DD1      DD DSN=MYUSER.NEW.DATA,DISP=(NEW,CATLG,DELETE),
    //            SPACE=(TRK,(5,5)),UNIT=SYSDA,
    //            RECFM=FB,LRECL=80

    For a PDS, use SPACE=(TRK,(5,5,10)): the third number is directory blocks.

  2. Delete a dataset (no error if it's already gone)
    Inside JCL
    //DELDS    EXEC PGM=IEFBR14
    //DD1      DD DSN=MYUSER.NEW.DATA,DISP=(MOD,DELETE,DELETE),
    //            SPACE=(TRK,0),UNIT=SYSDA