What is an alternate index?
An alternate index is another file related to the cluster but sorted using an alternate key that can have duplicates.
How do you create an alternate index?
You use the IDCAMS utility with the DEFINE AIX option after you build the cluster and then do another IDCAMS with the BLDINDEX option to populate the alternate index.
what parameter in the define AIX option is used to determine the maximum number of duplicate keys allowable?
The RECORDSIZE parameter. There are 2 numbers that follow this: the 1st is the average and the 2nd is the maximum. The values are equal to 5 + (cluster key length) + N*(alternate key length), where N is the allowable number of duplicates.
Name a few common VSAM status codes?
00-OK
02-READ a duplicate alternate key
10-end of file reached while doing a READ
22-trying to WRITE a duplicate primary key
23-record not found while doing a READ
97-file integrity verified, do an IDCAMS VERIFY
What is buffering and how does it apply to VSAM files?
When large blocks of data are used, more main storage is required than when smaller blocks are used, but large blocks save CPU time and disk space. Additionally, extra buffers may save elapsed time since the program does not have to wait for an I/O to complete for it to continue processing.
In the JCL, you specify BUFNI (number of index buffers) and BUFND (number of data buffers) as sub parameters of the AMP parameter.
For random access, the BUFNI is one more than the number of index levels and a BUFND of 2 is fine.
For sequential access, a BUFNI of 1 and a minimum of 5 for BUFND is fine.
For dynamic access, the values of each is the higher of the numbers for either random or sequential.
What are the different types of VSAM files available?
ESDS: Entry Sequence Data Set
KSDS: Key Sequence Data Set
RRDS: Relative Data Set
What is IDCAMS?
IDCAMS is the Access Method Services program. You run the IDCAMS program and supply AMS commands thru SYSIN. (examples of AMS commands are DELETE, DEFINE, REPRO etc..)
What is control interval, control area?
Control Interval is analogous to a physical block for QSAM files. It is the unit of i/o. Must be between 512 bytes to 32 k. Usually either 2K or 4K. A larger control interval increases performance for sequential processing while the reverse is true for random access. Under CICS when a record is locked, the entire CI gets locked.
Control area is a group of control intervals. CA is used during allocation. CA size is calculated based on the allocation type (cyl, tracks or records) and can be max of 1 cylinder
What is FREESPACE?
Coded in the DEFINE as FREESPACE (ci ca) where ci is the percentage of each control interval to be left free for insertions, ca is the percentage of control intervals in each control area to be left empty.
How do you decide on optimum values for CI, FREESPACE etc.?
CI size should be based on record length, type of processing. Usually CI is 4K. If record length is larger(>1K), choose 6K or 8K.
FREE SPACE should be large if more number of insertions are envisaged. Usual values are (20 20) when heavy updates are expected. CI size can be calculated.
Would you specify freespace for an ESDS?
No. Because you cannot insert records in an ESDS, also when you rewrite a record, it must be of the same length. Thus, putting any value for freespace does not make any sense.
What is shareopts?
SHAREOPTS is a parameter in the DEFINE and specifies how an object can be shared among users. It is coded as SHAREOPTS(a b), where a is the cross region share option ie how two or more jobs on a single system can share the file, while b is the cross system share option ie how two or more jobs on different MVSes can share the file. Usual value is (2 3).
What is the meaning of each of the values in shareopts(2 3)?
Value of 2 for cross region means that the file can be processed simultaneously by multiple users provided only one of them is an updater. Value of 3 for cross system means that any number of jobs can process the file for input or output (VSAM does nothing to ensure integrity).
How do you define a KSDS ?
DEFINE CLUSTER(cluster name) with the INDEXED parameter. Also specify the ds name for the DATA component & the ds INDEX component. Other important parms are RECORDSIZE, KEYS, SHARE OPTIONS.
What happens when you open an empty vsam file in a cobol program for input?
A VSAM file that has never contained a record is treated as unavailable. Attempting to open for input will fail. An empty file can be opened for output only. When you open for output, COBOL will write a dummy record to the file & then delete it out.
What does a file status of 02 on a VSAM indicate?
Duplicate alternate key. Happens on both input and output operation
What is the difference between Sequential files and ESDS files?
Sequential(QSAM) files can be created on tape while ESDS files cannot.
Also, you can have ALTINDEX for an ESDS while no such facility exists for QSAM files.
How do you load a VSAM data set with records?
How do you define a GDG?
Use the DEFINE GENERATIONDATAGROUP command. In the same IDCAMS step, another dataset must be defined whose DCB parameters are used when new generations of the GDG are created. This dataset is known as the model dataset. The ds name of this model dataset must be the same as that of the GDG, so use a disp of keep rather than catlg and also specify space=(trk,0)
How are different versions of GDG named?
base-file-name. GnnnnnV00 where nnnn= generation number (upto 255).
nnnn will be 0000 for the 1st generation.
What is IDCAMS?
IDCAMS is the Access Method Services program. You run the IDCAMS program and supply AMS commands thru SYSIN. (examples of AMS commands are DELETE, DEFINE, REPRO etc..).
What is control interval, control area?
Control Interval is analogous to a physical block for QSAM files. It is the unit of i/o. Must be between 512 bytes to 32 k. Usually either 2K or 4K. A larger control interval increases performance for sequential processing while the reverse is true for random access. Under CICS when a record is locked, the entire CI gets locked.
Control area is a group of control intervals. CA is used during allocation. CA size is calculated based on the allocation type (cyl, tracks or records) and can be max of 1 cylinder
What is Freespace?
Coded in the DEFINE as FREESPACE (ci ca) where ci is the percentage of each control interval to be left free for insertions, ca is the percentage of control intervals in each control area to be left empty.
What is Shareopts?
SHAREOPTS is a parameter in the DEFINE and specifies how an object can be shared among users. It is coded as SHAREOPTS (a b), where a is the cross region share option ie how two or more jobs on a single system can share the file, while b is the cross system share option ie how two or more jobs on different MVSes can share the file. Usual value is (2 3).
What is File Status in VSAM?
The File STATUS clause of the FILE-CONTROL paragraph allows for each file to be associated with a file status key (i.e., the 2-character data item specified in the FILE STATUS clause). If the FILE STATUS clause is specified for a given file, a value indicating the status of each I/O operation against that file is placed in the associated file status key. This value is stored in the file status key as soon as the I/O operation is completed (and before execution of any EXCEPTION/ERROR declarative or INVALID KEY/AT END phrase associated with the I/O request).
How do you convert flat files to VSAM files?
Flat files are converted into VSAM files by following process:
- Identify the primary key, when the whole record can be primary key.
- Alternate key can also be used, if needed
- File is to be sorted by primary key or the whole record
- Utilize the SORT statement for dropping duplicates.
- A JCL command (IDCAMS – Define Cluster) need to be submitted by using the result of sorting mechanism (mentioned above) as input
- Use the command IDCAMS REPRO for loading the flat file into the VSAM file.
Explain the information contained in CI?
- Control information consists of Record Descriptor Field and Control Interval Descriptor Field.
- Each CI contains one CIDF that consists of the last 4 bytes
- CIDF consists of information about the offset and length of free space in the CI
- In case of fixed size records, each CI contains 2 RDFs each RDF is of 3 bytes length
- In case of variable length size records, there will be a separate RDF for each record in the CI.
- The data portion of the CI should be in the multiples of 512 bytes / 2048 bytes.
- The maximum size of the CI is 32 KB. – The size of index portion of CI could be any of these
- 512, 1024,2048,4096
Difference between VSAM and database tables?
- VSAM file cannot run SQL queries. -VSAM lacks any kind of relation -VIEWS and SYNONYMS cannot be defined on VSAM files -RDBMS concepts cannot be applied in VSAM files.
- SQL queries can be run in database table – Data fetching is more efficient than VSAM files – RDBMS concepts are applicable in DB2 database – ALIAS VIEWS can be defined on tables for sharing customized data.
What is meant by dirty read in VSAM?
- High degree of concurrent access to VSAM files is achieved by dirty read – It is done by avoiding the complications associated with CI and CA splits – The dirty read protocol is summarized as:
- The VSAM file mandatorily be defined with cross-region SHARE POINTS 4. – The file allocation must be with DISP=SHR – ENQ must be followed for all operations of the files, for data set – Data set name is specified for ENQ name – Any string can be used for the ENQ gname – The user’s buffer must be refreshed with GET request, after obtaining a lock – No lock is held during a wait – DEQ function should be called at the end of all the file operations of enqueue.
What is the purpose of the verify function oF IDCAMS?
To re-sync the end of the file information with the catalog information, the VERIFY function is used.
Â