Ibm-jcl&vsam Placement Papers - Ibm-jcl&vsam Interview Questions and Answers updated on 03.Mar.2024

Below are the 3 types of VSAM files.

  1. ESDS (Entry sequenced dataset). DB2 uses a special type of ESDS.
  2. RRDS (Relative record dataset). Records are accessed using a relative number.
  3. KSDS (Key sequenced dataset) is the most common type encountered. The record sequence is determined by a unique key field.

There are 2 data buffers by default for ESDS. For KSDS it allots 2 data buffers and 1 index buffers. Each buffer is about 4k.

They are end of file (10), duplicate Key (22), record not found (23), Out of space condition is raised (28) ,VSAM logic error (90), open problem (92) and space problem (93).bIt is a COBOL II enhancement to VSAM batch processing expanding the FILE STATUS field.It is defined in WORKING - STORAGE as a six byte group item with three two byte elements, the normal return code, the function code and the feedback code.

VSAM increases the disk space requirements of systems. This is because VSAM offers certain capabilities like partial self-reorganization to make things more efficient in data sets that can be modified.

IDCAMS is the utility, the access method services utility.

An INCLUDE statement identifies a member of a PDS that contains this set of JCL statements is called an INCLUDE group. The system replaces the INCLUDE statement with the statements in the INCLUDE group.

It is used to define the cross-region and cross-system sharing capabilities of the DataSet. Syntax is SHR (CRvalue CSvalue)

  1. me multiple read OR single write (read integrity).
  2. me multiple read AND single write (Write integrity).
  3. me Multiple read AND multiple write.
  4. is same as 3, which refreshes the buffer with every random access. Default is SHR(1 3).

S0C7 - Data exception error - you will get it whenever you are trying to move the low values or spaces into the numeric field, or compare the numeric fields with low values, or try to do some arithmetic operations on the low values. To avoid this you have to always initialize the numeric fields otherwise they will contain the low values.

Whenever a new cluster is created using IDCAMS, the cluster will be empty. By the use of REPRO command, we are able to load records into the cluster. REPRO is used to:

  • Copy Datasets (VSAM or NON-VSAM), copy catalogs.
  • Conversion of sequential and index sequential Datasets to VSAM format.
  • Backup VSAM catalog
  • Conversion of VSAM and Index sequential Datasets to sequential format
  • Read a backup copy of VSAM catalogs.

The index and the distributed free space. CI and CA splits upon updates. Record length may be changed during the time of update. The records are accessed by a particular Key in KSDS.

COND is a condition parameter, consists of 2 subparameters, 1st - return code from the previous step, 2nd - condition. If COND is true, the step on which COND is coded will be BYPASSED. It is compared with system return code of previous step //STEP1 EXEC PGM=ABCD //STEP2 EXEC PGM=XYZ, cond=(4,lt) STEP 2 will be executed when system return code of step1 is less than 4.

Dynamic processing me one program uses both sequential and random processing for a VSAM KSDS file. It is however rarely used in VSAM.

For loading we can use the REPRO command.

Libraries are of three types: System

  1. Libraries:- such as SYS1.LINKLIB Private 
  2. Libraries:- Specified in a JOBLIB or STEPLIB DD STATEMENTS.
  3. Temporary Libraries:- Created in a previous step of the Job.

In VSAM, the START command is used to read other than the next VSAM record. For this, A value must be moved into the RECORD KEY. However, the KEY clause is optional, but it can be used to specify a relational operator.

We can fix it by the following. 

  • By defining new VSAM Dataset allocated with more space.
  • By using IDCAMS to REPRO the old VSAM file to new VSAM Dataset.
  • By using IDCAMS to ALTER / rename the old VSAM Dataset or set IDCAMS to DELETE the old VSAM Dataset.
  • By using IDCAMS to ALTER / rename the new VSAM Dataset to the name of the original VSAM Dataset.

The parameters RECOVERY (default) and SPEED are mutually exclusive. Recovery is used to pre-format the control areas during the initial DataSet load, if the job fails, you can restart but you must have a recovery routine already written to restart the job. SPEED does not pre-format the CAs. It is advisable that you specify SPEED to speed up your initial data load.

Every AMS command issues a condition code. If multiple commands are being executed successively, there might be a requirement to execute or bypass certain commands on the Success or failure of a previous command. The normal condition codes returned by AMS commands are :

0 - The function was executed successfully.
4 - A problem was encountered while executing the function, WARNING.
8 - The requested function was executed, but major specifies were unavoidably bypassed,ERROR.
12 - The requested command could not be performed because of a logical error, SEVERE.
16 - A severe error occurred causing the remainder of the command stream to be bypassed., FATAL.

The three possibilities for ACCESS can be RANDOM, SEQUENTIAL or DYNAMIC.

The RECORD KEY in the SELECT clause identifies the files Primary Key as it will be made available to the program.

  • ALTER is used for modification of information for a catalog, alternate index, cluster or path.
  • BLDINDEX is used to build the alternate index.
  • DEFINE is used for ALTERNATEINDEX, CLUSTER or PATH.
  • DELETE is used to remove the catalog entry for a catalog, cluster, alternate index or path.
  • LISTCAT is for listing Information about the Dataset.
  • PRINT is used to print the Dataset contents.
  • REPRO is used to copy records from one file to another.

We can 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) 

You can write a dummy program that will just open the file for output and thereafter closes it.

base-file-name.GnnnnnV00 where nnnn= generation number (upto 255). nnnn will be 0000 for the 1st generation.

The upgrade set is the list of all AIXs that VSAM must be maintaining for a specific base cluster, so that when data in the base cluster is modified or updated, the AIX files are also updated.

IDCAMS, also known as Access Method Services, is used to perform the following tasks cited below.

  • Createing a VSAM data set, VSAM alternate index, or catalog.
  • Conversion of non-VSAM to VSAM data set.
  • Listing a catalog entry for a data set, Dataset/catalog contents.
  • Copy a Dataset or catalog.
  • Loading of a VSAM Dataset from VSAM records
  • Renaming of VSAM data sets.

DEFINE MODEL parameter specifies whether the MODEL parameter allows you to model your cluster by modelling it after an existing cluster.

VSAM will inform COBOL program of the problem and terminate the processing of the program.

By specifying the DISP as PASS for the temp dataset.

 

  • S0C1 (Operation Exception Error) - May be due to Missing or misspelled DD name ,Read/Write to unopened dataset ,Reading a dataset opened output mode Writing into a dataset opened input mode ,Called subprogram not found.
  • S0C4 may be due to Missing Select statement (during compile) ,Bad Subscript/index ,Protection Exception Missing parameters on called subprogram ,Read/Write to unopened file ,Move data from/to unopened file;
  • S0C5 May be due to Bad Subscript/index ,Close an unopened dataset ,Bad exit from a perform ,Access to I/O area (FD) before read;
  • S0C7 may be due to Numeric operation on non-numeric data ,Un-initialized working storage ,Coding past the maximum allowed subscript
  • S0CB might be due to 1.Division by Zero.

The base cluster in VSAM consists of the data component as well as the index component that is required for the primary index of a KSDS.

With the help of the IDCAMS utility with the REPRO option.

In VSAM, Sequential(QSAM) files can be created on tape while ESDS files cannot be created. Again, you can have ALTINDEX for an ESDS while no such facility that exists for QSAM files.

The code is: //*MAIN DEADLINE=(0700,B,012086)

Pass all the JCL codes to a COBOL variable (should be declared using OCCURS clause) and then write the line one by one to the spool using CICS commands like SPOOLClose, SPOOLOpen and SPOOLWrite. For more help refer CECI of CICS or CICS manual.

  • Entry sequenced Datasets (ESDS),
  • Key sequenced Datasets (KSDS) and relative record
  • Dataset (RRDS), LDS (linear Data Set)

i) Skip and Count :
Syntax:
SKIP(2)
COUNT(4)

In this case, the first two records are skipped and the next four records are printed. The default for SKIP is 0, and for COUNT will be printing records from beginning to end.

ii) FromKey and ToKey :
PRINT -
INDATASET (CUSTOMER.KSDS.CLUSTER) -
FROMKEY (111111) -
TOKEY (444444)
Will print all records with Key value ranging from 111111 to 444444.
iii) FROMADDRESS and TOADDRESS.
iv) FROMNUMBER and TONUMBER.

In your JCL define as:

//JOBA JOB 1111,JOB1 //STEP01 EXEC PGM=PROG1 //ddname DD SYSOUT=
(*,INTRDR)....and your COBOL (PROG1) should look like this: SELECT JCL-FILE ASSIGN TO ddname.
Open this file and write the JCL statements into this file.

Example: MOVE '//TESTJOB JOB 1111,VISVEISH' TO JCL-REC.MOVE '//STEP01 EXEC
PGM=IEFBR14' TO JCL-REC.and close this file. Then TESTJOB will be submitted.

Yes it slower because the alternate Key would first locate the primary Key, which in turn locates the actual record. It requires twice the number of I/Os.

GDG me Generation Data Group.

A CONTROL CARD can be a member of a PDS or a sequential dataset and is used for storing the date fields, definitions of VSAM files etc., We use CONTROL CARD because we cannot use an in-stream procedure in a procedure. Generally you will be calling a PROC from your JCL and you cannot code instream procedure in the PROC and so you will point to the dataset, which is called controlcard.

 

We cannot delete, you have to give a separate DELETE command in the VSAM cluster.

 There are two ways to achieve that.Firstly by using the REPRO command and secondly by using COBOL program.

 

SHAREOPTIONS parameter specifies how the file may be shared between jobs and between batch and CICS Environments.

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.

You use the IDCAMS utility with the DEFINE CLUSTER option.