Examples of Defining IAM Data Sets with IDCAMS


The following is a set of examples demonstrating how to define IAM data sets using IDCAMS. The first example demonstrates how to convert a DEFINE for a VSAM dataset to an IAM data set. The subsequent examples demonstrate various different ways of using IDCAMS to define IAM data sets. All of the included examples have a LISTCAT request after the define request. When a LISTCAT ALL is done for an IAM data set, IAM will dynamically allocate an IAMPRINT DD to SYSOUT which will contain detailed information on the IAM data set. The output from IDCAMS itself will indicate that the IAM file is a non-VSAM data set.


Note

The JCL used for the examples throughout the User’s Guide are contained in the JCL library created when you installed . Check with the person who installed  to see if that library is available to you.

Example A: Conversion of VSAM Define to IAM Define

This side by side example demonstrates how simple it is to convert a VSAM cluster definition to an IAM data set definition. The only change required was adding the parameter OWNER($IAM) under the CLUSTER level of the Define control statement. For many VSAM KSDS or ESDS types of files, this is all that is necessary to convert the file to IAM. Starting with the next file load, all of the performance advantages and features of IAM are available for this data set.

Example Conversion of Define from VSAM to IAM (EX1020A)

Original VSAM                               IAM DEFINE

//DEFINE   EXEC PGM=IDCAMS                  //DEFINE   EXEC PGM=IDCAMS
//SYSPRINT DD   SYSOUT=*                    //SYSPRINT  DD  SYSOUT=*
//SYSIN    DD   *                           //SYSIN     DD  *
  DEFINE CLUSTER -                            DEFINE CLUSTER -
    (NAME(EXAMPLE1.DATASET) -                   (NAME(EXAMPLE1.DATASET) -
     VOLUMES(VOL001) -                           VOLUME(VOL001)  -
     CYL(10 1)       -                           CYL(10 1)       -
                            ADD --> OWNER($IAM) - <-- ADD
     SPEED REUSE )   -                           SPEED REUSE )   -
    DATA(             -                          DATA(            -
      NAME(EXAMPLE.DATASET.DATA) -                 NAME(EXAMPLE.DATASET.DATA) -
      RECORDSIZE(200 256)        -                 RECORDSIZE(200 256)        -
      KEYS(16 0)                 -                 KEYS(16 0)                 -
      CISZ(4096)                 -                 CISZ(4096)                 -
      FREESPACE(10 10)  )        -                 FREESPACE(10 10)  )        -
    INDEX(                       -               INDEX(                     -
      NAME(EXAMPLE.DATASET.INDEX)-                 NAME(EXAMPLE.DATASET.INDEX)-
      CISZ(1024) IMBED)  )                         CISZ(1024) IMBED)   )
  LISTCAT ENT(EXAMPLE1.DATASET) ALL            LISTCAT ENT(EXAMPLE1.DATASET) ALL
/*                                             /*

Example B: Basic IAM KSDS Define

This example demonstrates a basic IAM data set definition. In comparison to the above example, the DATA and INDEX component sections are eliminated. There is no need for them to exist for IAM data set, as IAM consists of a single physical data set, which uses the name specified for the CLUSTER as its data set name. This example includes the optional parameters of FREESPACE, SHAREOPTIONS, and REUSE. While in general REUSE is not necessary, as it is the default for IAM data sets, it is specified just in case the installation has changed the IAM Global Options to ENABLE=NOREUSE, in which case, the IDCAMS default of NOREUSE takes effect without the explicit specification of REUSE.

Example Basic IAM KSDS Definition (EX1020B)

   //IAMDEFIN  EXEC PGM=IDCAMS
  //SYSPRINT  DD   SYSOUT=*
  //SYSIN     DD   *
     DEFINE CLUSTER       -
      (NAME(MY.IAM.KSD)     -
      OWNER($IAM)        -
      VOLUMES(MYVOL1)     -
      CYL(10 2)        -
      RECORDSIZE(100 1000) -
      KEYS(24 8)         -
      FREESPACE(5 20)      -
      SHAREOPTIONS(2 3)     -
      REUSE  )
     LISTCAT ENT(MY.IAM.KSD) ALL
  /*

Example B1: IAM Encrypted KSDS Define

This example demonstrates an IAM data set definition that requests Pervasive Encryption be enabled.

Note

All users of this KSDS will need system security access to the Key Label on the KEYLABEL keyword. The data set must be defined with an SMS Data Class that includes the Extended Format and Extended Addressability attributes.

Example Basic IAM KSDS Definition (EX1020B1)

//*
//*   EXAMPLE OF IDCAMS DEFINE OF AN IAM FILE
//*   WITH PERVASIVE ENCRYPTION ENABLED.
//*
//IAMDEFIN EXEC  PGM=IDCAMS
//SYSPRINT DD    SYSOUT=*
//SYSIN    DD    *
DEFINE CLUSTER            -
  (NAME(MY.IAM.KSD)       -
   OWNER($IAM)            -
   KEYLABEL(MYDEPT.APPL.KEY01) -
   STORCLAS(MYSTORCL)     -
   DATACLAS(EXTANDEA)     -
   CYL(10 1)              -
   RECORDSIZE(100 1000)   -
   KEYS(24 8)             -
   FREESPACE(5 20)        -
   SHAREOPTIONS(2 3) )
LISTCAT ENT(MY.IAM.KSD) ALL
/*

Example B2: Converting an IAM KSDS from Non-encrypted to Encrypted

This example demonstrates converting an existing IAM KSDS file that is not encrypted to an IAM encrypted data set.

Example Basic IAM KSDS Definition (EX1020B2)

//*
//*   EXAMPLE OF CONVERTING A NON-ENCRYPTED IAM
//*   DATASET INTO AN ENCRYPTED IAM DATASET.
//*
//DEFNCRPK EXEC PGM=IDCAMS
//SYSPRINT  DD  SYSOUT=*
//IAMPRINT  DD  SYSOUT=*
//SYSIN     DD  *
DELETE IAMV.ILLUSTRT.ENCRYPT.KSDS CLUSTER PURGE
SET MAXCC=00
DEFINE CLUSTER                      -
       (NAME(IAMV.ILLUSTRT.ENCRYPT.KSDS) -
       OWNER($IAM)                  -
       STORCLAS(MYSTORCL)           -
       DATACLAS(EXTANDEA)     -
       INDEXED                      -
       KEYLABEL(IAM.KEY01)           -
       KEYS(49 8)                    -
       RECORDS(02000000 01000000)    -
       CISZ(4096)                    -
       RECORDSIZE(1412 1412)           -
       FREESPACE(7 7)               -
       SHAREOPTIONS(2,3))
/*
//NCRYPKSD EXEC PGM=IDCAMS,COND=(4,LT)
//SYSPRINT DD SYSOUT=*
//IAM1     DD DSN=IAMV.ILLUSTRT.PROD.KSDS,
//         DISP=SHR
//IAM2     DD DISP=OLD,DSN=IAMV.ILLUSTRT.ENCRYPT.KSDS
//SYSIN    DD *
   REPRO INFILE(IAM1) OUTFILE(IAM2)
/*
//RENAME EXEC PGM=IDCAMS,COND=(4,LT)
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
 ALTER IAMV.ILLUSTRT.PROD.KSDS          -
 NEWNAME(IAMV.ILLUSTRT.PRODX.KSDS)
 /*      */

ALTER IAMV.ILLUSTRT.ENCRYPT.KSDS        -
NEWNAME(IAMV.ILLUSTRT.PROD.KSDS)
/*
//DELOLD EXEC PGM=IDCAMS,COND=(4,LT)
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
 DELETE IAMV.ILLUSTRT.PRODX.KSDS
/*

Example C: Basic IAM ESDS File Define with $IAM in Data Set Name

This example demonstrates a basic ESDS data set definition. The file will be defined as an IAM data set due to the literal '$IAM' included in the data set name. Note that the keyword NONINDEXED has been included to indicate that the file is to be an ESDS type of file.

Basic IAM ESDS Define (EX1020C)

   //DEFINESD EXEC PGM=IDCAMS
   //SYSPRINT DD   SYSOUT=*
   //SYSIN    DD   *
     DEFINE CLUSTER          -
       (NAME(MY.ESDS$IAM.FILE)    -
         VOLUMES(MYVOL1)       -
         CYL(200 50)       -
         RECORDSIZE(80 100)   -
         CISZ(4096)            -
         SHAREOPTIONS(2 3)    -
         NONINDEXED
     LISTCAT ENT(MY.ESDS$IAM.FILE) ALL
   /*

Example D: Define of an IAM ESDS for > 4 Gigabyte

Unless the IAM Global Option has been changed, IAM ESDS data sets cannot exceed 4 gigabytes and will utilize a 4-byte RBA. Below is an example of using the IAM CREATE override of XESDS to force an 8-byte RBA. Note that such files do not have to reside on SMS managed volumes. If you need a >4 gigabyte ESDS file and your programs do not support an 8-byte RBA, you can substitute PSEUDORBA for the XESDS override keyword.

Define of > 4 GIGABYTE IAM ESDS File (EX1020D)

    //BIGESDS  EXEC PGM=IDCAMS
   //SYSPRINT  DD  SYSOUT=*
   //IAMOVRID  DD  *
     CREATE    DD=&ALLDD,XESDS
   /*
    //SYSIN     DD   *
      DEFINE CLUSTER       -
        (NAME(MY.BIG.ESDS)   -
        OWNER($IAM)       -
        CYL(1100 1100)    -
        NONINDEXED       -
        RECORDSIZE(200 4089)-
        CISZ(4096)        -
        VOLUMES(V33901 V33902 V33903 V33904)  )
      LISTCAT ENT(MY.BIG.ESDS) ALL
    /*

Example E: Define an IAM Data Set Using a Model Data Set

In the example below, an IAM data set is defined using a model data set. The model data set can be either VSAM or IAM. Amongst the attributes that will be used from the model, unless otherwise explicitly specified on the define request, are file format (KSDS or ESDS), record sizes, key length and offset, free space values, volume, and control interval size.

Example of an IAM Define with Model (EX1020E)

    //DEFMODEL EXEC PGM=IDCAMS
   //SYSPRINT DD   SYSOUT=*
   //SYSIN    DD   *
     DEFINE CLUSTER          -
       (NAME(MY.NEW.IAMFILE)    -
       OWNER($IAM)          -
       MODEL(MY.INDEXED.FILE) )
     LISTCAT ENT(MY.NEW.IAMFILE)
   /*

Example F: Define of an SMS Managed IAM Data Set

In the example below, an IAM data set is being defined that will be SMS managed. The SMS classes are explicitly specified by the user. One or more of the SMS classes could be automatically selected by the ACS routines. All of the data set attributes are being determined by SMS from the appropriate SMS classes. The following attributes are taken from the specified Data Class:

  • Type of data set (KSDS, ESDS, or RRDS)
  • Maximum Record Size (LRECL)
  • Key length and offset (for KSDS data sets)
  • Free Space and Share Options
  • Space allocation parameters
  • Control Interval Size

The data set will become an IAM data set because the $IAM literal is contained within the Data Class name.

Important

While a Data Class can be specified for data sets not managed by SMS, for  to pick up the Data Class name the data set must be SMS managed. Otherwise, IDCAMS does not pass the Data Class value on the DEFINE, although the other Data Class attributes are included.

Define of an SMS Managed IAM Data Set (EX1020F)

    //DEFSMSDS EXEC PGM=IDCAMS
   //SYSPRINT DD   SYSOUT=*
   //SYSIN    DD   *
      DEFINE CLUSTER       -
       (NAME(MY.SMS.FILE)    -
       DATACLAS(MY$IAM1)    -
       MGMTCLAS(DBSTNDRD)    -
       STORCLAS(BASE) )    
     LISTCAT ENT(MY.SMS.FILE) ALL
   /*

Example G: Defining Multiple IAM Data Sets with Overrides

This is an example of defining multiple IAM data sets within the same IDCAMS job step. Each IAM data set has its own unique overrides. Each of the overrides identifies the related data set by using the DSN= (data set name) operand. The first dataset has very high I/O activity, so it is being defined with a MAXBUFNO override to increase buffering. The second data set is used by COBOL programs with a variable length record lay out giving a maximum record size of 32,200. It is defined as containing SPANNED so that it will not use an inefficient block size of 32760. This dataset has an override to indicate that it is to use hardware compression.

Multiple Data Set Define (EX1020G)

    //DEF2FILE EXEC PGM=IDCAMS
   //SYSPRINT DD   SYSOUT=*
   //IAMOVRID DD   *
     CREATE  DSN=MY.HEAVYIO.CLUSTER,MAXBUFNO=512
     CREATE  DSN=MY.BIGREC.CLUSTER,DATACOMP=HW
   /*
    //SYSIN    DD   *
      DEFINE CLUSTER          -
         (NAME(MY.HEAVYIO.CLUSTER) -
         OWNER($IAM)          -
         RECORDSIZE(1000 2000)    -
         KEYS(24 0)          -
         VOLUMES(MYVOL1 MYVOL2)    -
         CYL(500 100)       -
         FREESPACE(10 10)       -
         SHAREOPTIONS(2 3)       -
         REUSE  )
      LISTCAT ENT(MY.HEAVYIO.CLUSTER) ALL
      DEFINE CLUSTER          -
        (NAME(MY.BIGREC.CLUSTER)    -
        OWNER($IAM)          -
        RECORDSIZE(500 32000)    -    
        KEYS(32 0)          -
        VOLUMES(MYVOL3 MYVOL4)    -
        CYL(1000 200)       -
        FREESPACE(10 10)       -
        SHAREOPTIONS(2 3)       -
        CISZ(8192)          -
        REUSE  SPANNED )
      LISTCAT ENT(MY.BIGREC.CLUSTER) ALL
     /*

Example G1: Fixed Length Record RRDS Define

This example demonstrates the definition of a fixed length record RRDS (numbered) IAM data set.

Example Fixed Length Record IAM RRDS Definition (EX1020G1)

      //IAMDEFIN  EXEC PGM=IDCAMS
   //SYSPRINT  DD   SYSOUT=*
    //SYSIN     DD   *
       DEFINE CLUSTER       -
       (NAME(MY.IAM.RRDS)     -
      OWNER($IAM)        -
       NUMBERED             -    
        VOLUMES(MYVOL1)     -
       CYL(10 2)        -
       RECORDSIZE(100 100)  -
       SHAREOPTIONS(2 3))    
        LISTCAT ENT(MY.IAM.RRDS) ALL
   /*

Example G2: Define on an EAV

This example shows the use of the EATTR parameter to have a data set allocated to an EAV volume.

Example of defining on an EAV volume (EX1020G2)

      //IAMDEFIN  EXEC PGM=IDCAMS
   //SYSPRINT  DD   SYSOUT=*
    //SYSIN     DD   *
       DEFINE CLUSTER       -
       (NAME(MY.EAV.CLUSTER)-
         VOL(*)             -
        CISZ(4096)           -
        OWNER($IAM)          -
         EATTR(OPT)          -
        DATACLAS(VSAMX4G)    -
        STORCLAS(SCEAV)      -
        CYL(2800 700)        -
        RECORDSIZE(500 500)  -
        KEYS(50,8)           -
        FREESPACE(00,00)     -
        SHAREOPTIONS(2,3))
        LISTCAT ENT(MY.EAV.CLUSTER) ALL
   /*

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*