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.
Note: these can be used only under IDCAMS and not from the TSO prompt.
IF LASTCC(or MAXCC) >(or <,= etc..) value - THEN - DO -
command set (such as DELETE, DEFINE etc..)
ELSE - DO -
command set
LASTCC - Condition code from the last function(such as delete) executed
MAXCC - Max condition code that was returned by any of the prev functions
SET is also a valid AMS command. SET LASTCC (or MAXCC) = value
The maximum condition code is @A cond code of 4 indicates a warning. A cond code of 8 is usually encountered on a DELETE of a dataset that is not present.
Can write a dummy program that just opens the file for output & then closes it.
No, the DCB of the model dataset can be overridden when you allocate new versions.
Using alternate indexes in batch programs:
JCL, has DD statements for cluster and for paths.
For the COBOL program :
The command SELECT ASSIGN TO ddname For the base cluster RECORD KEY IS...... ALTERNATE RECORD KEY IS… used
Using alternate indexes in CICS programs:
The creation of FCT entries are mandatory for both cluster and the path
Utilize the dd name of the path in CICS file control commands, by using the alternate index
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).
Note: This element may behave differently when the CMPR2 compiler option is used. The file status key is divided into two status keys: the first character is known as file status key1; the second character is file status key 2.
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.
Can write a dummy program that just opens the file for output & then closes it.
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)
base-file-name.GnnnnnV00 where nnnn= generation number (upto 255).
nnnn will be 0000 for the 1st generation.
The maximum condition code generated is returned as the condition code of the IDCAMS step.
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.
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.
The maximum condition code generated is returned as the condition code of the IDCAMS step.
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..).
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 RECORD SIZE, KEYS, SHARE OPTIONS.
Value of 2 for cross region me that the file can be processed simultaneously by multiple users provided only one of them is an updater. Value of 3 for cross system me that any number of jobs can process the file for input or output (VSAM does nothing to ensure integrity).
Use GDG name(-2).
Note: these can be used only under IDCAMS and not from the TSO prompt.
IF LASTCC(or MAXCC) >(or <,= etc..) value - THEN - DO -
command set (such as DELETE, DEFINE etc..)
ELSE - DO -
command set
LASTCC - Condition code from the last function(such as delete) executed
MAXCC - Max condition code that was returned by any of the prev functions
SET is also a valid AMS command. SET LASTCC (or MAXCC) = value
The maximum condition code is @A cond code of 4 indicates a warning. A cond code of 8 is usually encountered on a DELETE of a dataset that is not present.
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.
Step 1: Deleting the existing VSAM file:
IF LASTCC =8 ; SET MAXCC=0
Step 2: DEFINE VSAM-FILE(COND=(0,LT,STEP1)
Return-code = 8 when the file that is trying to delete does not exist.
Utilize the command VERIFY in TSO
To re-sync the end of the file information with the catalog information, the VERIFY function is used.
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
KSDS cluster can be defined by
-Using the file-aid
-or by using IDCAMS utility:
The record can be defined with average length of 100 and maximum length of 150, in IDCAMS, with key length 10 starting at 0.
The following example illustrates :
//step01 EXEC pgm=IDCAMS
//SYSIN DD *
DEFINE CLUSTER(NAME(userid.name.sample) -
VOLUMES(MVS801) -
RECORDSIZE(100 150) -
TRACKS(10 20)
KEYS(10 0) -
INDEXED ) -
DATA ( NAME(userid.name.sample.data)) -
INDEX( NAME(userid.name.sample.index)) -
/*
//
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.
The following is the syntax of AMS modal commands:
IF LASTCC(or MAXCC) >(or <,= etc..) value - THEN - DO -
command set (like DELETE, DEFINE etc..)
ELSE - DO -
command set
where
LASTCC - Condition code from the last function(such as delete) executed
MAXCC - Max condition code that was returned by any of the prev functions
SET is also a valid AMS command. SET LASTCC (or MAXCC) = value
PS: These can be used only under IDCAMS and not from the TSO prompt.
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
Unique Case: 5 + ( alt-key-length + primary-key )
Nonunique Case: 5 + ( alt-key-length + n * primary-key )
where n = # of duplicate records for the alternate key
????Any one who knows - can you explain ?
Using the REPRO command.
A data set is a physical records that are stored on a disk or tape , is a collection with a unique name
The data set is normally identified by the MVS with labels
The label information need to be supplied in JCL
The data set organization in NON-VSAM files are sequenced, Indexed Sequential, Direct and partitioned
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).
Duplicate alternate key . Happens on both input and output operation
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..).
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).
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.
It must be opened as I/O.
ESDS: Entry Sequence Data Set
KSDS: Key Sequence Data Set
RRDS: Relative Data Set
Virtual Storage Access Method(VSAM) is a disk storage system.
It was implemented in OS/VS2 operating system.
Subsequently, it was used through out the MVS architecture.
VSAM comprises of the following access methods:
ESDS: Entry Sequence Data Set
KSDS: Key Sequence Data Set
RRDS: Relative Data Set
VSAM records can be of fixed or variable length.
These are organized in fixed size blocks, known as Control Intervals, and later into larger divisions known as Control Areas.
CI sizes are measured in terms of bytes, while CA sizes are measured in terms of disk tracks or cylinders.
ESDS : It contains the files which are interface specific and
accessed through Relative Byte Address
KSDS : It contains the files which are interface specific and accessed through a secondary index
RRDS : It contains the files which are interface specific and accessed through Relative Record Number
Each file has two objects.
DELETE,READ,REWRITE,UNLOCK,WRITE,STARTBR operations.
ENDBR,READNEXT,READPREV,RESETBR
Give (+1) as the generation number, give (new,catlg) for disp, give space parameter, can give the dcb parameter if you want to override the dcb of the model dataset.
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
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.
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.
FREESPACE 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.
Relative generation numbers are updated only at the end of the job, not at the end of a step. To allocate a new generation, we would be using (+1) with a DISP of (NEW,CATLG,DELETE). To refer to this in a subsequent step in the same job, we would again use (+1) but with a DISP of SHR or OLD.