![]() |
|
Submit VSAM Questions |
|
Interrelated Information Technology |
|
| Mainframe Questions | Utilities and Development Tools Questions |
The Computer Education Techniques knowledge base is a service for answering questions, inclusive of the research and validation of the accuracy of information in the public domain. Utilization of the information of this service and reliance on the answers, information or other materials received through this web site is done at your own risk.
| 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? For 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. There are five types of entry sequenced datasets:
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, ie. to all parts of the dataset simultaneously.
We cover these concepts, inclusive of hands-on machine workshops, in both our VSAM for Programmers and VSAM: Structures and Strategies courses. |
| Q | Why is it important for me to acquire expertise with VSAM? Isn’t learning COBOL and CICS, or COBOL and IMS or DB2 sufficient for me to perform first rate work on my job? |
| A |
VSAM is one of several access methods in z/OS. It
only applies to data stored in DASD devices. An access method is re-entrant code
contained in DFSMSdfp, a component of the DFSMS z/OS product. This access method
makes it more efficient for an application to execute an I/O operation. During the application development process, the application programmer needs to make the following important decisions:
It is true that not every application programmer requires a comprehensive knowledge of VSAM. However, many online systems use VSAM. In addition, VSAM is heavily used in DB2 tablespaces. Knowledge of VSAM will improve your expertise with DB2. |
| 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:
|
| 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.
|
| 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)
|