VSAM Training Services

SYS-ED Experience

Submit VSAM Questions

Home

Submit VSAM Questions

Technology Driven IT Training

Knowledge Base


Submit VSAM questions to SYS-ED Advanced search
     

Interrelated Information Technology

Mainframe Questions Utilities and Development Tools Questions

The SYS-ED knowledge base is a service for answering questions, inclusive of the research and validation of the accuracy of information in the public domain. Citation of source documentation and examples are used to provide answers to the questions.  Utilization and reliance on the answers, information, or other materials received through this website is done at your own risk.

Q

We have an ESDS VSAM file which needs to be accessed by RBA using COBOL. What is the best way to set up the SELECT, FD, and READ statements?

A

Standard batch COBOL can not be used to access the ESDS VSAM file using the RBA. It is a restriction imposed by COBOL.

When CICS COBOL is used, the CICS commands allow RBA access to an ESDS and alternate index access to an ESDS. Based on the sample code that was provided, a FD has been coded; this is not used in CICS COBOL and indicates that batch is being used. A possible workaround would be to code the I/O routine in Assembler.

Q

I have been told that the high date a VSAM field can handle is 9-17-2029 and not any further out. Is this true? Is a system high date of 9-17-29 a VSAM limitation? More specifically, there is a date field within the VSAM file layout that was provided. There are data fields in the VSAM data record.

A

The dates associated with VSAM catalog should now go to the year 9999. The dates associated with the data is dependent on the data and application software and not VSAM. The date field is completely dependent on the application software, size of the fields and format of the fields: BINARY, DECIMAL etc.

Q

Can I have a batch program that accesses a VSAM two ways. I want to be able to BROWSE through a VSAM file which has been declared as access is sequential. While I'm reading this file I also want to be able to read this same file directly using "access is dynamic" reading other data in random locations in the file.

Read Next (record 1)
Read Next (record 2)
Read Next (record 3)
Read dynamic (record 5000)
Read Next (record 4)
Read dynamic (record 5355)
Read Next (record 5)
Read Next (record 6), etc. end of the file.

A

This answer assumes that the COBOL language is being used with VSAM.

The COBOL READ statement can be used for accessing a VSAM dataset sequentially and randomly. The sequential access requires the use of READ with the NEXT keyword and random access uses READ with the KEY IS keyword. ORGANIZATION IS DYNAMIC should be specified in the SELECT.


Q

Our installation uses VSAM with the COBOL language. My understanding is that two read options exist in the COBOL language.

There is one VSAM file where there is a requirement to perform both sequential and dynamic reads, how does the record pointer know to go back to the sequential read where it left off in the file? Would there need to be one Select /FD for the VSAM FILE?

Example:

SELECT CLIENT-ACCOUNT ASSIGN TO FPPCLACT
ORGANIZATION IS INDEXED
ACCESS IS DYNAMIC
RECORD KEY IS CLT-ACCT-KEY
FILE STATUS IS CLT-ACCT-STATUS.

The requirement is to start at the beginning of the file and continue to READ NEXT.... and in certain situations, based on data from the record returned, I will then want to build the key and READ with KEY. Once the READ has been performed with KEY, then how does VSAM know where the original READ NEXT process left off.

READ NEXT - RECORD 1
READ NEXT - RECORD 2
READ NEXT - RECORD 3
READ KEY - RECORD 2000
READ NEXT - RECORD 4

If a READ NEXT has been performed after reading with key for record 2000, then will the READ NEXT provide record 2001 instead of record 4?

A

Usually there is only one VSAM string in a batch COBOL program; there will be issues that need to be addressed. If you are not familiar with VSAM strings, the IBM Redbook, VSAM Demystified, will provide a comprehensive explanation on VSAM strings. After every random read, the current record point must be reset to the point where departure occurred from the sequential access. This is done by saving the key from the last sequential read and performing a COBOL START to restore the position. This sample program will illustrate the technique of switching from sequential to random mode using a file with a single VSAM string.

COBOL Program - Example

ID DIVISION.

PROGRAM-ID. VSAM3.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
       SELECT MOVMAST ASSIGN TO MOVMAST
       ORGANIZATION IS INDEXED
       ACCESS IS DYNAMIC
       RECORD KEY IS MOV-ID
       FILE STATUS IS FILE-STAT.

DATA DIVISION.

FILE SECTION.
FD MOVMAST.
01 MOVMAST-RCD.
      05 MOV-ID            PIC X(5).
      05 MOV-REST          PIC X(95).

WORKING-STORAGE SECTION.
01  SAVE-ID                PIC X(5).
01  INP-CNT                PIC S9(4)     COMP VALUE 0.

PROCEDURE DIVISION.
     OPEN INPUT MOVMAST
     PERFORM UNTIL FILE-STAT NOT = 0

          READ MOVMAST NEXT
          IF FILE-STAT =0 MOVE
                  MOV-ID TO SAVE-ID
                  ADD 1 TO INP-CNT
                  DISPLAY 'SEQ READ ' MOVMAST-RCD
                  END-IF

          IF INP-CNT = 3
                  MOVE '11111' TO MOV-ID
                  READ MOVMAST KEY IS MOV-ID
                  DISPLAY 'RANDOM READ ' MOVMAST-RCD
                  MOVE SAVE-ID TO MOV-ID
                  START MOVMAST KEY EQUAL MOV-ID
                  END-IF

         START MOVMAST KEY EQUAL MOV-ID
         END-IF
END-PERFORM
     CLOSE MOVMAST
     STOP RUN.

Q

Our group is using VSAM files as the back-end for storing data from the organization website. We consistently have been experiencing CI and CA splits which result in the user's experience being painfully slow. In an attempt to address this issue, REORGs have been performed weekly and now nightly. The records are variable length and can range from very small to extremely large depending upon user input. Is there a better less resource costly solution to this problem?

A

Depending on the type of processing that is being done on the VSAM dataset, reasonably good performance can be realized by allocating more Free Space in the CA and the CI. In most cases, this will consume additional DASD and decrease the number of splits. With a high volume of updates, a REORG is a standard practice. A daily REORG would appear to be an extreme implementation; however, it will vary and be dependent on the type of processing being performed.

If this does not address the problem, an analysis of the type of processing being performed would be recommended. The key should then be redesigned and the records preformatted.


Q

I am new to the IBM mainframe environment and one of my first assignments is to improve our IO and DASD utilization. What is VSAM and what are the fundamental architectural concepts that I have to be concerned with?

A

VSAM stands for Virtual Sequential Access Method. VSAM can be a complex topic and there isn’t an easy reference to a comparable built-in PC or client/server utilization of the software.

These are the entry sequenced datasets: ESDS: Entry sequenced datasets, KSDS: Key sequenced datasets, RRDS: Relative record datasets, LDS: Linear datasets, and VRRDS: Variable length RRDS.

Each of the VSAM datasets contains a cluster. A cluster is a combination of the index, sequence set and data portions of the dataset. The operating system gives program access to the cluster; this is to all parts of the dataset simultaneously.

VSAM dataset is organized by a Control Interval. Each CI: Control Interval consists of a Which consists of Record Descriptor Field: RDF and Control Interval Descriptor Field.

Fixed Size Records Each CI contains two RDF's and each RDF is 3 bytes in length.
Variable Size Records There is a separate RDF for each record in the CI.
CIDF Every CI contains one CIDF which is a field consisting of the last 4 bytes of a CI. It contains information about the offset and the length of free space in the CI.
CI Size Data Portion The size of the data portion of the CI should be multiples of 512 or 2,048 bytes. Max size of the CI is 32K.
CI Size Index Portion The size of the index portion of CI can be one of the following: 512, 1024, 2048, 4096.

We cover these concepts, inclusive of machine workshops, in both our VSAM for Programmers and VSAM: Structures and Strategies courses.


Q

I am a mainframe programmer with 25 years experience in coding COBOL programs for the big three in IBM systems software: CICS, IMS, and DB2. What improvements have been made to VSAM recently?

A

The most significant improvements which have been made are:

  • Extended format and extended addressability which allows a dataset to go beyond the 4 GB limitation.
  • SMB: System managed buffering for improved performance, data compression, data striping, RLS: record level sharing, and transactional VSAM.

Q

What is extended format?

A

Extended format is a technique that affects the way CKD: Count Key Data is stored in a 3390/3380 logical track. Extended format was introduced to implement data striping. It increases the performance and the reliability of an I/O operation.


Q

What does the term “split” refer to when working with VSAM?

A

When there isn't enough space in the control interval VSAM performs a control interval split by moving some records to the free control intervals. If there isn't a free control interval, VSAM performs a control area split by allocating a new control area and moving half of the control intervals to it.

There are two types of splits used extensively in VSAM.

CI-SPLIT is the movement of some records from an existing CI to another free CI in the same CA because a record add or update cannot be accommodated in the existing one. A CI split requires a number of I/O operations and this degrades the performance of the VSAM file. The correct amount of the space will need to be allocated for the CI (internal percentage of free space allocation). This will result in two half-empty CI's instead of one full and one empty CI.

CA-SPLIT is the movement of the half of the records in an existing CA to a new CA because a record add or update cannot be accommodated in the existing CA. This results in two approximately half-full CA's instead of one full and one empty CA. This is inefficient because it involves a high level of I/O operations.


Q

I attended your VSAM for Programmers course in 2001 and I have a question relating to tuning. How can you determine what is the amount of unused space for a specific VSAM cluster?

A

This is done by comparing the higher allocated RBA with the higher used RBA in the LISTCAT function listing.


Q

How is a VSAM file renamed?

A

The procedure for renaming a VSAM file in z/OS is:

      // EXEC PGM=IDCAMS
    //SYSPRINT DD SYSOUT=*
    //SYSIN DD *
         ALTER -
           SYSED.MYNAME.DATA.CLUSTER -
           NEWNAME(SYSED.YOURNAME.DATA) -
           CATALOG(CATALOG.zOS.MASTER)

Schedule