JCL Example.
Back

JCL Examples

//* GDG1DEF DEFINE A GENERATION DATA GROUP

//GDG1DEF EXEC PGM=IDCAMS

//SYSPRINT DD SYSOUT=*

//SYSIN DD *

  DEFINE GDG (NAME(TSOUSR1.SAMPLE.GDG.BASE) -

  LIMIT(10) NOEMPTY SCRATCH)

/*

 

//*GDG2MAKE ACTUALLY CREATE A NEW G. D. SET

//STEP1 EXEC PGM=IEBGENER

//SYSPRINT DD SYSOUT=*

//SYSIN DD DUMMY

//SYSUT1 DD *

  JANE

  MARIANNE

  ANTONETTA

/*

//SYSUT2 DD DSN=TSOUSR1.SAMPLE.GDG.BASE(+1),DISP=(NEW,CATLG),

// SPACE=(TRK,1),

// DCB=model-dscb optional at some companies

 

//* GDG3ALT CHANGE A GENERATION DATA GROUP'S DEFINITION

//GDG3ALT EXEC PGM=IDCAMS

//SYSPRINT DD SYSOUT=*

//SYSIN DD *

  ALTER TSOUSR1.SAMPLE.GDG.BASE -

  LIMIT(15)

/*

 

//* GDG4DEL THIS WILL DELETE ALL THE MEMBERS OF THE GROUP

//ADIOS EXEC PGM=IEFBR14

//BYEBYE DD DSN=TSOUSR1.SAMPLE.GDG.BASE,DISP=(OLD,DELETE)

 

 

//* THIS WILL REMOVE THE GD GROUP FROM THE CATALOG

//* BE SURE TO DO GDG3DEL FIRST

//GDG5DEL EXEC PGM=IDCAMS

//SYSPRINT DD SYSOUT=*

//SYSIN DD *

  DELETE TSOUSR1.SAMPLE.GDG.BASE GDG

/*

 

//* DEFINE A VSAM KSDS

//DEFKSDS EXEC PGM=IDCAMS

//SYSPRINT DD SYSOUT=*

//SYSIN DD *

  DELETE (TSOUSR1.VSAM.KSDS) CLUSTER

  DEFINE CLUSTER +

  NAME(TSOUSR1.VSAM.KSDS) +

  CYLINDERS(1,1) +

  KEYS(10,0) +

  RECORDSIZE(80,80) +

  INDEXED)

/*

//* DEFINE A VSAM ESDS

//DEFESDS EXEC PGM=IDCAMS

//SYSPRINT DD SYSOUT=*

//SYSIN DD *

  DELETE (TSOUSR1.VSAM.ESDS) CLUSTER

  DEFINE CLUSTER +

  NAME(TSOUSR1.VSAM.ESDS) +

  CYLINDERS(1,1) +

  RECORDSIZE(80,80) +

  NONINDEXED)

/*

 

//* DEFINE A VSAM RRDS

//DEFRRDS EXEC PGM=IDCAMS

//SYSPRINT DD SYSOUT=*

//SYSIN DD *

  DELETE (TSOUSR1.VSAM.RRDS) CLUSTER

  DEFINE CLUSTER +

  NAME(TSOUSR1.VSAM.RRDS) +

  CYLINDERS(1,1) +

  RECORDSIZE(80,80) +

  NUMBERED)

/*

 

//* LOAD A VSAM DATASET (KSDS, ESDS, RRDS) THEN PRINT IT

//LOADVSAM EXEC PGM=IDCAMS

//SYSPRINT DD SYSOUT=*

//SYSIN DD *

   REPRO INFILE(INDD) OUTDATASET(TSOUSR1.VSAM.xxxx)

   PRINT INDATASET(TSOUSR1.VSAM.xxxx) CHARACTER

/*

//INDD DD *

  MARIA

  CHRISTINE

  ANIE

  SUSAN

  NADIA

/*

 

//* COPY ONE PDS TO ANOTHER DO NOT REPLACE LIKE-NAMED MEMBERS

//LIBCOPY EXEC PGM=IEBCOPY

//SYSPRINT DD SYSOUT=*

//SYSUT2 DD UNIT=SYSDA,SPACE=(CYL,(3,3))

//SYSUT3 DD UNIT=SYSDA,SPACE=(CYL,(3,3))

//SYSUT4 DD UNIT=SYSDA,SPACE=(CYL,(3,3))

//INLIB DD DSN=library-containing-members,DISP=SHR

//OUTLIB DD DSN=library-to-put-members-in,DISP=SHR

//SYSIN DD *

  COPY INDD=INLIB,OUTDD=OUTLIB

/*

//* OPTIONAL THINGS:

//*

//* TO COPY BUT EXCLUDE TWO MEMBERS:

//* COPY INDD=INLIB,OUTDD=OUTLIB

//* EXCLUDE MEMBER=(m1,m2)

//*

//* TO COPY AND REPLACE:

//* COPY INDD=((INLIB,R)),OUTDD=OUTLIB

//*