JCL -MainFrames - Part 4 (VSAM)

Ø VSAM is an interface between application program and storage device (DASD)
Ø VSAM files are famous in COBOL file handling
Ø VSAM files are called ‘Clusters’
Ø Cluster contain two components. They are…….
a.     DATA Component
b.     INDEX Component
Ø DATA Component stores the actual data of a file whereas INDEX Component stores primary key values
Ø VSAM clusters mainly classified into ‘4’ types. They are……..
1.     KSDS – Key Sequenced Data Set
2.     ESDS – Entry Sequenced Data Set
3.     RRDS – Relative Record Data Set
4.     LDS – Linear Data Set
Ø The data stored in VSAM Clusters in the form of ‘LOGICAL RECORDS’
Ø Collection of ‘LOGICAL RECORDS’ is “CONTROL INTERVAL(CI)”
Ø Collection of “CONTROL INTERVAL” is “CONTROL AREA(CA)”
Ø Min size of Control Interval is 512 bytes and max is 32 kb
Ø The min size of Control Area is 1track and max is 1cylinder
Ø When there is no free space, there may be a chance of Splits
Control Interval Split (CI Split)
                   If there is no free space in one Control Interval to store a new logical record in it, then it splits the current CI and creates a new CI with a max size of 32kb and stores the new record in it                              
                                                                                                         
 




                                                                                                                


CONTROL AREA SPLIT(CA SPLIT)
           If there is no free space available in one control area to store a new control interval it splits the current CA and creates a new CA with max size of 1cylinder and stores new CI in it
                             CI3








 
                             CI1













                             CI2

 
                                           1Cylinder                            CI3                        1Cylinder
 







 





CLUSTERS AND THEIR PROPERTIES
1. KSDS
Ø It contains both Data and Indexed components
Ø KSDS contain Primary Key
Ø Records can be accessed by using Keys and RBA(Relative Byte Address)
Ø KSDS supports both fixed and variable length records
Ø KSDS can be accessed in sequential, random and dynamic access modes. Dynamic by using Primary Key
Ø In KSDS insertion , deletion, updation of records is possible
Ø KSDS auto arranges the data
Ø KSDS supports Alternate Index and Spanned Records
Spanned Records
          Whenever a new record is required to insert into a CI, if free space is not sufficient for this entry, then a new record will occupy the space in new Ci this process is called ’Spanning of Records’


2. ESDS
Ø ESDS contain only data component
Ø ESDS support both fixed and variable records
Ø Records can be accessed using ‘RBA’
Ø ESDS supports sequential and random access modes
Ø Insertion at the end only possible
Ø Deletion is not possible
Ø It supports Alternate Index and Spanned Records
3. RRDS
Ø It contains data component
Ø Record accessed by RRN(Relative Records Number)
Ø It supports only fixed length records
Ø It supports sequential, dynamic and random access mode
Ø It contains preformatted fixed slots
Ø Insertion in empty slots is possible
Ø Deletion and updation also possible
Ø Alternate Index is not possible
4. LDS
Ø It contains data component
Ø Insertion is not possible because LDS doesn’t contain any fixed format
Ø All bytes are data bytes
Ø Mainly used data base as a file
REQUIRED PARAMETERS FOR CREATION OF CLUSTER
To create any VSAM cluster we require some parameters as follows……
To define any object in VSAM we use the command ‘DEFINE’
1.     NAME – specifies ‘NAME’ of a cluster and max length is 44 characters and contains 5 qualifiers and 1st qualifier must be User ID possible values are a-z, 0-9 and must start with alphabet.


2.     SPACE – used to allocate memory for cluster
SYNTAX:
SPACEUNITS=(PRIMARY QUANTITY,SECONDARYQUANTITY)
Required  spaceunits are tracks
3.     RECORD SIZE(RECSZ) – it specifies the type of record either fixed or variable
SYNTAX:
          RECSZ(AVG,MAX)
Ø If (AVG,MAX) are equal then it is fixed length record
Ø If (AVG,MAX) are unequal then it is variable length record
Ø In general the value is RECSZ(80,80)
4.     CONTROL INTERVAL SIZE(CISZ) – it specifies the total size of a control interval
SYNTAX:
          CISZ(BYTES)
In general the value is CISZ(4096)
5.     KEYS
Ø It is required only for KSDS
Ø Keys cannot be altered
SYNTAX:
     KEYS(LENGTH,OFFSET)
Ø We cant duplicate the keys
Ø It is optional because by default the value is KEYS(64,0)
Ø In key field duplication of data is not possible
6.     VOLUME – specifies name of volume in DASD
SYNTAX:
          VOLUME(VOLUME NAME)
EX – VOLUME(DEVMA0)
7.     ORGANIZATION – All clusters are having their own organization as follows…
KSDS – INDEXED
ESDS – NONINDEXED
RRDS – NUMBERED
LDS – LINEAR
8.     SHAREOPTIONS – Specifies how the data set is going to be shared in the environment
SYNTAX:
          SHAREOPTIONS(N,M)
N – Cross region
M – Cross system
CROSS REGION Specifies how the data is going to be shared in standalone system
CROSS SYSTEM – Specifies how the data set is going to be shared among the systems
The possible values for SHAREOPTIONS are…….
1.     1 – Multiple Read or Single Write
2.     2 – Multiple Read and Single Write
3.     3 – Multiple Read and Multiple Write
4.     4 – same as ‘3’ but Buffer will be refreshed for every Random Access
It is optional because the default value is
                   SHAREOPTIONS(1,3)
9.     FREESPACE(FSPC) – It is required for KSDS flexible insertion, deletion and updation of records or data
SYNTAX:
          FSPC(%CI,%CA)
%CI – specifies the total amount of FSPC in one Control Interval
%CA – specifies the total amount of FSPC in one Control Area
It is optional because the default value is………
                             FSPC(0,0)


CREATION OF CLUSTERS
EX1. KSDS
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=* 
//SYSIN DD *                           
     DEFINE CLUSTER(NAME(MATE05.GRP.KSDS)-                             
     TRK(50,60)-                                                     
     RECSZ(80,80)-                                                     
     CISZ(4096)-                                                        
     VOLUME(DEVMA0)-                                                   
     KEYS(5,0)-                                                        
     FREESPACE(20,30)-                                                 
     INDEXED)                                                         
//SYSOUT DD SYSOUT=*                                                  
/* 
EX2. ESDS
//MATE05AB JOB NOTIFY=&SYSUID                   
//STEP1 EXEC PGM=IDCAMS                                  
//SYSPRINT DD SYSOUT=*                                    
//SYSIN DD *                                                           
     DEFINE CLUSTER(NAME(MATE05.GRP.ESDS)-                             
     TRK(50,60)-                                                        
     RECSZ(80,80)-                                                     
     CISZ(4096)-                                                      
     VOLUME(DEVMA0)-                                                   
     NONINDEXED)                                                       
//SYSOUT DD SYSOUT=*                                                   
/*
EX3. RRDS
//MATE05AB JOB NOTIFY=&SYSUID                                 
//STEP1 EXEC PGM=IDCAMS                                                
//SYSPRINT DD SYSOUT=*                                                  
//SYSIN DD *                                                          
     DEFINE CLUSTER(NAME(MATE05.GRP.RRDS)-                             
     TRK(50,60)-                                                       
     RECSZ(80,80)-                                                  
     CISZ(4096)-                                                       
     VOLUME(DEVMA0)-                                            
    NUMBERED)                                                         
//SYSOUT DD SYSOUT=*                                                   
/*
EX4. LDS
//MATE05AB JOB NOTIFY=&SYSUID        
//STEP1 EXEC PGM=IDCAMS  
//SYSPRINT DD SYSOUT=*      
//SYSIN DD *                                                          
     DEFINE CLUSTER(NAME(MATE05.GRP.LDS)-                              
     TRK(50,60)-                                                       
     CISZ(4096)-                                                        
     VOLUME(DEVMA0)-                                                   
     LINEAR)                                                           
//SYSOUT DD SYSOUT=*                                                
/*
NOTE:
          In VSAM the continuation character is’ – ‘
AMS (Access Method Service) COMMANDS
          In VSAM we have some required AMS commands as follows………
1.     REPRO
2.     DELETE
3.     EXPORT
4.     IMPORT
5.     LISTCAT
6.     ALTER
7.     VERIFY
1. REPRO
Ø REPRO is a general purpose command
Ø Using REPRO we can load the data into VSAM and NON-VSAM files
Ø REPRO can be done from cluster to cluster, cluster to PS file and from PS to any cluster
SYNTAX:
          REPRO-
          INDATASET(DATASET NAME)/INFILE(DD NAME)-
          OUTDATASET(DATASET NAME)/OUTFILE(DD NAME)-
OPTIONAL PARAMETERS
1.     FROM KEY(KEY NAME)/TO KEY(KEY NAME)   REPROfrom                
2.     FROM ADDRESS(RBA)/TO ADDRESS(RBA)          Cluster to
3.     FROM NUMBER(RRN)/TO NUMBER(RRN)            PS only  
4.     SKIP(n)
5.     COUNT(n)
6.     REPLACE
7.     REUSE
DESCRIPTION
1. FROM KEY(KEY NAME)/TO KEY(KEY NAME)
          When you are doing REPRO from KSDS cluster to any cluster or PS then only it is required based on the key values we can copy selected records from KSDS cluster.
2. FROM ADDRESS(RBA)/TO ADDRESS(RBA)
          KSDS and ESDS data can be accessed by using RBA
3. FROM NUMBER(RRN)/TO NUMBER(RRN)
          Based on RRN we can copy required records from RRDS
4. SKIP(n), COUNT(n)
Ø Using ‘SKIP’ we can bypass any no of records from REPRO
Ø Using ‘COUNT’ we can copy selected records
5. REPLACE
Ø It is mainly used for appending the data to the existing
Ø Using ‘REPLACE’ we can also modify the existing records data
6. REUSE
          It replaces(overrides) the existing data with new data

NOTE:
          To use ‘REPLACE’ and ‘REUSE’ in REPRO, we have to create cluster with ‘REUSE’ option
EX1. REPRO from PS to KSDS
CASE1. PS to KSDS using INDATASET and OUTDATASET
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                            
        REPRO-                                     
        INDATASET(MATE05.GRP.PS1)-
        OUTDATASET(MATE05.GRP.KSDS)
//SYSOUT DD SYSOUT=*                          
/*
CASE2. PS to KSDS using INFILE and OUTFILE
//MATE05AB JOB NOTIFY=&SYSUID                       
//STEP1 EXEC PGM=IDCAMS                                     
//SYSPRINT DD SYSOUT=*                                
//DD1 DD DSN=MATE05.GRP.PS1,DISP=SHR 
//DD2 DD DSN=MATE05.GRP.KSDS,DISP=SHR
//SYSIN DD *                                  
        REPRO-                                                         
        INFILE(DD1)-
        OUTFILE(DD2)                                                  
//SYSOUT DD SYSOUT=*
/*
EX2. PS to ESDS
CASE1. PS to ESDS using INDATASET and OUTDATASET
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                            
        REPRO-                                    
        INDATASET(MATE05.GRP.PS1)-
        OUTDATASET(MATE05.GRP.ESDS)
//SYSOUT DD SYSOUT=*                          
/*
CASE2. PS to ESDS using INFILE and OUTFILE
//MATE05AB JOB NOTIFY=&SYSUID                       
//STEP1 EXEC PGM=IDCAMS                                     
//SYSPRINT DD SYSOUT=*                                 
//DD1 DD DSN=MATE05.GRP.PS1,DISP=SHR 
//DD2 DD DSN=MATE05.GRP.ESDS,DISP=SHR
//SYSIN DD *                                  
        REPRO-                                                         
        INFILE(DD1)-
        OUTFILE(DD2)                                                  
//SYSOUT DD SYSOUT=*
/*
EX3. PS to RRDS
CASE1. PS to RRDS using INDATASET and OUTDATASET
//MATE05AB JOB NOTIFY=&SYSUID                       
//STEP1 EXEC PGM=IDCAMS                                      
//SYSPRINT DD SYSOUT=*   
//SYSIN DD *                            
        REPRO-
        INDATASET(MATE05.GRP.PS1)-
        OUTDATASET(MATE05.GRP.RRDS)                                                        
//SYSOUT DD SYSOUT=*
/*
CASE2. PS to RRDS using INFILE and OUTFILE
//MATE05AB JOB NOTIFY=&SYSUID                       
//STEP1 EXEC PGM=IDCAMS                                     
//SYSPRINT DD SYSOUT=*                                
//DD1 DD DSN=MATE05.GRP.PS1,DISP=SHR 
//DD2 DD DSN=MATE05.GRP.RRDS,DISP=SHR
//SYSIN DD *                                  
        REPRO-                                                         
        INFILE(DD1)-
        OUTFILE(DD2)                                                  
//SYSOUT DD SYSOUT=*
/*
EX1. REPRO from KSDS to PS
CASE1. KSDS to PS using INDATASET and OUTDATASET
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                             
        REPRO-                                    
        INDATASET(MATE05.GRP. KSDS)-
        OUTDATASET(MATE05.GRP. PS1)
//SYSOUT DD SYSOUT=*                          
/*
CASE2. KSDS to PS using INFILE and OUTFILE
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                                                               
//DD1 DD DSN=MATE05.GRP. KSDS,DISP=SHR 
//DD2 DD DSN=MATE05.GRP. PS1,DISP=SHR
//SYSIN DD *                                  
        REPRO-                                                         
        INFILE(DD1)-
        OUTFILE(DD2)                                                  
//SYSOUT DD SYSOUT=*                          
/*
EX2. ESDS to PS
CASE1. ESDS to PS using INDATASET and OUTDATASET
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                            
        REPRO-                                    
        INDATASET(MATE05.GRP. ESDS)-
        OUTDATASET(MATE05.GRP. PS1)
//SYSOUT DD SYSOUT=*                          
/*
CASE2. ESDS to PS using INFILE and OUTFILE
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                                                                
//DD1 DD DSN=MATE05.GRP. ESDS,DISP=SHR 
//DD2 DD DSN=MATE05.GRP. PS1,DISP=SHR
//SYSIN DD *                                  
        REPRO-                                                          
        INFILE(DD1)-
        OUTFILE(DD2)                                                  
//SYSOUT DD SYSOUT=*                          
/*
EX2. RRDS to PS
CASE1. RRDS to PS using INDATASET and OUTDATASET
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                            
        REPRO-                                    
        INDATASET(MATE05.GRP. RRDS)-
        OUTDATASET(MATE05.GRP. PS1)
//SYSOUT DD SYSOUT=*                          
/*
CASE2. RRDS to PS using INFILE and OUTFILE
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                                                               
//DD1 DD DSN=MATE05.GRP. RRDS,DISP=SHR 
//DD2 DD DSN=MATE05.GRP. PS1,DISP=SHR
//SYSIN DD *                                  
        REPRO-                                                         
        INFILE(DD1)-
        OUTFILE(DD2)                                                   
//SYSOUT DD SYSOUT=*                          
/*
REPRO USING OPTIONAL PARAMETERS
          By using optional parameters we can copy selected records from cluster to PS
EX1. REPRO from KSDS to PS Using KEYS
1230
1231
1232
1233
 
1230 
1231
1232
1233
1234
1235
 
//MATE05AB JOB NOTIFY=&SYSUID            KSDS                                          PS
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                            
        REPRO-                                    
        INDATASET(MATE05.GRP. KSDS)-
        OUTDATASET(MATE05.GRP. PS1)-
        FROM KEY(1230)-
        TO KEY(1233)
//SYSOUT DD SYSOUT=*                          
/*





EX1. REPRO from KSDS to PS Using ADDRESS
1230 
1231
1232
1233
1234
1235
 
//MATE05AB JOB NOTIFY=&SYSUID            KSDS                                          PS
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                            
        REPRO-                                    
        INDATASET(MATE05.GRP. KSDS)-
        OUTDATASET(MATE05.GRP. PS1)-
        FROM ADDRESS(80)-
        TO ADDRESS(240)
//SYSOUT DD SYSOUT=*                          
/*
EX1. REPRO from ESDS to PS Using ADDRESS
1230 
1231
1232
1233
1234
1235
 
//MATE05AB JOB NOTIFY=&SYSUID            ESDS                                          PS
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                   
//SYSIN DD *                                            
        REPRO-                                    
        INDATASET(MATE05.GRP. ESDS)-
        OUTDATASET(MATE05.GRP. PS1)-
        FROM ADDRESS(0)-
        TO ADDRESS(160)
//SYSOUT DD SYSOUT=*                          
/*
EX1. REPRO from RRDS to PS Using RRN
1230 
1231
1232
1233
1234
1235
 
//MATE05AB JOB NOTIFY=&SYSUID                RRDS
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                            
        REPRO-                                    
        INDATASET(MATE05.GRP. RRDS)-
        OUTDATASET(MATE05.GRP. PS1)-
        FROM NUMBER(2)-
        TO NUMBER (5)
//SYSOUT DD SYSOUT=*                          
/*
EX1. REPRO using SKIP and COUNT
1230 
1231
1232
1233
1234
1235
 
//MATE05AB JOB NOTIFY=&SYSUID                RRDS
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                            
        REPRO-                                    
        INDATASET(MATE05.GRP. RRDS)-
        OUTDATASET(MATE05.GRP. PS1)-
        SKIP(3)-
        COUNT (3)
//SYSOUT DD SYSOUT=*                          
/*
          In the above example it copies only 3 records from input cluster
2. EXPORT
Ø Mainly used for backup
Ø Using ‘EXPORT’ we can take backup of any cluster data into a PS file only
SYNTAX:
          EXPORT-
          IDS(DATASETNAME)/INFILE(DDNAME)-
          ODS(DATASETNAME)/OUTFILE(DDNAME)
OPTIONAL PARAMETERS
1.     INHIBITSOURCE/NOINHIBITSOURCE
2.     INHIBITTARGET/NOINHIBITTARGET
3.     PERMANENT
4.     TEMPORARY
5.     ERASE/NOERASE
6.     PURGE/NOPURGE
DESCRIPTION
1. INHIBITSOURCE/NOINHIBITSOURCE
          After successful ‘EXPORT’ the input cluster will made as ‘READ ONLY’
2. INHIBITTARGET/NOINHIBITTARGET
          After ‘EXPORT’ the portable copy of the cluster will made as ‘READ ONLY’
3. PERMANENT
          Once we do ‘EXPORT’ the input cluster name will be permanently deleted from catalog


4. TEMPORARY (TEMP)
          In case of temporary after export the input cluster name will remain until the import is done
5. ERASE/NOERASE
          `When retention was reached it deletes the cluster
6. PURGE/NOPURGE
          In case of PURGE it overrides the retention period and deletes the cluster
NOTE:
          NOINHIBITSOURCE, NOINHIBITTARGET, PERMANENT, NOERASE and NOPURGE are default
3. IMPORT
Ø The main use of import is to recover the information of the cluster into same name
Ø Import can be done from PS to same exported cluster name only
SYNTAX:
          IMPORT-
          IDS(DATASETNAME)/INFILE(DDNAME)-
          ODS(DATASETNAME)/OUTFILE(DDNAME)
OPTIONAL PARAMETERS
1.     ERASE/NOERASE
2.     PURGE/NOPURGE
EX1. EXPORT
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                            
        EXPORT-                                    
        MATE05.GRP.KSDS-
        OUTDATASET(MATE05.GRP.PS)-
        TEMPORARY
//SYSOUT DD SYSOUT=*                          
/*
EX1. IMPORT
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                            
        IMPORT-                                    
        MATE05.GRP.PS-
        OUTDATASET(MATE05.GRP.KSDS)-
//SYSOUT DD SYSOUT=*                          
/*
4. DELETE
Ø Using DELETE we can delete both VSAM and NON-VSAM data sets
SYNTAX1:
          DELETE CLUSTERNAME
SYNTAX2:
          DELETE NON-VSAM DATASETS
EX. DELETE
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                            
        DELETE MATE05.GRP.KSDS-
//SYSOUT DD SYSOUT=*                          
/*
5. PRINT
Ø By using PRINT command we can view the data of a cluster in any required format
Ø In PRINT we have 3 possible ways to view the data of a cluster
SYNTAX:
          PRINT-
          IDS(DATASETNAME)/INFILE(DDNAME)-
OPTIONAL PARAMETERS
1.     CHAR – Character
2.     HEX – Hexadecimal
3.     DUMP - (CHAR+HEX)
In ‘PRINT’ ‘DUMP’ is default.
EX. PRINT
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                             
        PRINT-
        IDS(MATE05.GRP.KSDS)-
        DUMP
//SYSOUT DD SYSOUT=*                          
/*
6. LISTCAT
          By using LISTCAT command we can view the information of cluster in required form
          SYNTAX:
                   LISTCAT ENTRIES(CLUSTER NAME)-
          OPTIONAL PARAMETERS
1.     NAME
2.     ALLOCATION
3.     VOLUME
4.     HISTORY
5.     ALL
EX.
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                            
        LISTCAT ENTRIES(MATE05.GRP.KSDS)-
        ALL
//SYSOUT DD SYSOUT=*                          
/*
          In the above example it displays complete information regarding the cluster KSDS


7. VERIFY
Ø By using VERIFY command we can correctly identify the flag status of a file while using in application program
Ø Before we reopen the file we need to run VERIFY command to correctly identify the status of a file
SYNTAX:
          VERIFY FILE(DD NAME)/DATASET(DATASET NAME)
EX
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                            
        VERIFY DATASET(MATE05.GRP.KSDS)-
//SYSOUT DD SYSOUT=*                          
/*
8. ALTER
1.     By using ALTER command we can change the properties of a cluster
2.     Using ALTER we can change
a.     NAME
b.    FREE SPACE
c.      VOLUME
d.    BUFFER SPACE
3.     By using ALTER command we cant change
a.     RECSZ
b.    CISZ
c.      KEYS
d.    ORGANIZATION
4.     The main use of alter is to change the FREE SPACE
EX
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                            
        ALTER
        MATE05.GRP.KSDS-
        FREESPACE(20,30)
//SYSOUT DD SYSOUT=*                          
/*
MODAL COMMANDS
Ø By using MODAL COMMANDS we can execute or bypass any no one AMS command
Ø In MODAL COMMANDS based on MAXCC and LASTCC
MAXCC – MAXimum Condition Code
LASTCC – Last Command Condition Code
EX
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                   
//SYSIN DD *                                            
DELETE MATE05.GRP.KSDS-
IF LASTCC=0
REPRO-
INDATASET(MATE05.GRP2.PS)-
OUTDATASET(MATE05.GRP2.KSDS)
ELSE
PRINT-
IDS(MATE05.GRP2.ESDS)-
CHAR
ENDIF
SET MAXCC=0
//SYSOUT DD SYSOUT=*                           
/*
          By using MODAL COMMANDS we can write a scenario with help of REPRO, LISTCAT and VERIFY
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                             
REPRO-
INDATASET(MATE05.GRP2.PS)-
OUTDATASET(MATE05.GRP2.KSDS)
IF LASTCC=0
VERIFY DATASET(MATE05.GRP2.ESDS)
ELSE
LISTCAT ENTRIES (MATE05.GRP2.ESDS)-
ALL
ENDIF
SET MAXCC=0
//SYSOUT DD SYSOUT=*                          
/*
ALTERNATE INDEX
Ø Alternate Index is a relative cluster which is mainly used to create one or more KEYS for a cluster
Ø Alternate Index doesn’t contain any ORGANIZATION because it is related name only, physically it doesn’t contain any reference in VSAM
Ø Alternate Index is possible only for KSDS and ESDS
Ø AIX is not possible for RRDS and LDS
Ø AIX, we can create as ‘UNIQUE KEY’ and also a ‘NON-UNIQUE KEY’
Ø ‘UNIQUE KEY’ does not allow duplications whereas ‘NON-UNIQUE KEY’ allows duplications
Ø While creating a AIX we are having mainly 3 steps
1.     Creation of AIX
2.     Creation of Build Index
3.     Creation of Path
Ø We can insert the data only into a Base cluster
Ø With the help of Path we can update the data in AIX
Ø Path is a bridge between cluster and AIX
EX
1. Creation of Base Cluster
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=* 
//SYSIN DD *                          
     DEFINE CLUSTER(NAME(MATE05.GRP.KSDS)-                             
     TRK(50,60)-                                                     
     RECSZ(80,80)-                                                     
     CISZ(4096)-                                                       
     VOLUME(DEVMA0)-                                                   
     KEYS(5,0)-                                                         
     FREESPACE(20,30)-                                                 
     INDEXED)                                                         
//SYSOUT DD SYSOUT=*                                                  
/*
2. Creation of AIX
//MATE05AB JOB NOTIFY=&SYSUID
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=* 
//SYSIN DD *                          
     DEFINE ALTERNATE INDEX(NAME(MATE05.GRP.AIX)-
     RELATE(MATE05.GRP.KSDS)-                             
     TRK(50,60)-                                                     
     RECSZ(80,80)-                                                     
     CISZ(4096)-
     UPGRADE-                                                      
     VOLUME(DEVMA0)-                                                    
     KEYS(5,0)-
  NONUNIQUEKEY)                    
//SYSOUT DD SYSOUT=*                                                  
/*
3. Creation of Build Index
Before we create Build Index we need to load some data into the cluster
//MATE05AB JOB NOTIFY=&SYSUID               
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                            
        BUILD INDEX-                                    
        INDATASET(MATE05.GRP. KSDS)-
        OUTDATASET(MATE05.GRP. AIX)-
//SYSOUT DD SYSOUT=*                          
/*
4. Creation of Path
//MATE05AB JOB NOTIFY=&SYSUID               
//STEP1 EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                                            
        DEFINE PATH(NAME(MATE05.GRP.PATH)-                                    
        PATH ENTRY(MATE05.GRP. AIX)-
        UPDATE)
//SYSOUT DD SYSOUT=*                          
/*
DESCRIPTION
RELATE – specifies for which cluster we are creating an AIX
UPGRADE – for every change in base cluster, AIX will be updated
PATH – is a bridge or logical connection between cluster and AIX
BUILD INDEX – using Build Index we can create an Index field for AIX
LIMITATIONS OF AIX
Ø We cant create more than 253 AIX fields for the cluster
Ø For RRDS and LDS we cant create AIX

Ø The max length of AIX is 255 characters

No comments:

Post a Comment