VSAM Tutorial 02 – Using IDCAMS Utility(Part II)


Q. How to create an empty KSDS VSAM Object using IDCAMS?
To work with VSAM Files, you need to use the IBM Supplied Utility program called IDCAMS. With IDCAMS, you can create an empty KSDS cluster, load VSAM KSDS Cluster with data, take a backup of KSDS, and perform other operations.

Let us see a sample JCL that creates an empty KSDS Cluster. You need to use the DEFINE CLUSTER command to create a KSDS cluster. The different parameters of the KSDS Cluster are given as Instream control statements(DD *) to the IDCAMS program.

The basic format of the IDCAMS Batch JOB/JCL is as follows-

//JOB01 JOB A123,QUASAR
//STEP01 EXEC PGM=IDCAMS,REGION=4096K
//SYSPRINT  DD SYSOUT=A
//SYSIN DD *
   /* Utility Command Statements */
/*
//  

Note: It is upto the system programmers to ensure that the necessary USER catalogs, and data space has been defined. Please check out with your shop, if this has already been done.

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
//JOB01  JOB  A123,QUASAR                                              
//STEP01 EXEC PGM=IDCAMS,REGION=4096K                                  
//SYSPRINT DD SYSOUT=A                                                 
//SYSIN DD    *                                                        
  DEFINE CLUSTER(                                                      -
    NAME(HERC04.DEMO.KSDS)                                             -
    TRACKS(1 1)                                                        -
    RECORDSIZE(80 80)                                                  -
    KEYS(10 0)                                                         -
    INDEXED                                                            -
    )                                                                  -
  DATA(                                                                -
    NAME(HERC04.DEMO.KSDS.DATA)                                        -
    )                                                                  -
  INDEX(                                                               -
    NAME(HERC04.DEMO.KSDS.INDEX)                                       -
    )                                                                  


The DEFINE CLUSTER Command of IDCAMS is used to define a VSAM KSDS Cluster. The word INDEXED indicates that this is KSDS Cluster, since ESDS and RRDS don’t have Index component. The three main parameter lists that may be specified are :
1) CLUSTER (Parameters relating to the cluster as a whole)
2) DATA (Parameters relating to the DATA Component of KSDS)
3) INDEX (Parameters relating to the INDEX Component of KSDS)

NAME Parameter : The NAME Parameter is used to specify the name of the cluster. So, the MVS O/S will refer to the KSDS Cluster in the above example as HERC04.DEMO.KSDS. When we will load data into the KSDS Cluster, we must write to HERC04.DEMO.KSDS.

SPACE Allocation : We can specify how much space to allocate for the KSDS Cluster in terms of TRACKS, CYLINDERS, RECORDS, or VOLUMES.

CONTROLINTERVALSIZE Option : We can also specify the Control Interval Size(CISZ) ranging from 512 bytes to 32,768 bytes. If it is between 512 bytes and 8,192 bytes, it should be a multiple of 512. On the other hand, if it is between 8,192 and 32,768 bytes in size, a multiple of 2,048 should be specified. By default the size of CI = 4096 bytes.

ERASE Option : The ERASE Parameter specifies, that when you delete the cluster, the space occupied by the cluster should be zeroed out(written with binary zeros), and then declare the space as free for use.

FREESPACE Option : The FREESPACE(CI CA) is used to specify, how much free space to leave in CIs and CAs. CI option tells how much space in a control interval should be left free for future inserts. CA option tells how much space in Control Area should be left free for new Control Intervals.

REPLICATE and IMBED Option : REPLICATE means that the Index Record should be duplicated on a track as many times as possible. This was in order to avoid a rotational delay in seeking the Index record. The IMBED option means that Sequence Set should be on the first track of the cylinder. NOTE that these options have been leftover from the times, of classical DASD, i.e. when DASD Drives were slow. Nowadays, we have cached controllers and DASD devices are pretty much fast enough.

KEYS Option : The KEYS Option specifies the Key field of the records in a KSDS Cluster. It has the following format.

KEYS(length offset)

length specifies the length of the key-field. offset specifies the position or column from where the key starts. So, if specify KEYS(5 10), it means the key-field length is 5 and it starts from position 10. Thus, the key-field will span the positions 10-14.

RECORDSIZE option : The RECORDSIZE option can be used to specify the record length. It has the following format -

RECORDSIZE(avg-length maximum)

If the KSDS Cluster has same fixed length records, then avg-length and max-length are the same e.g. RECORDSIZE(80 80) specifies that all the records in this KSDS Cluster have same length 80.

Technorati Tags: ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Comments
Advertisements
Zimbio Entertainment
Copyright © 2012 - Zimbio, Inc. Some rights reserved. Coming soon: Livingly
Share
. . .
Follow
. . .