DB2 or VSAM?
Sometimes we can get so caught up in the details of our day-to-day job that we forget some of the basics of information technology. One request that I get every now and then from mainframe developers is to explain why VSAM shouldn’t be used instead of DB2. So I put together this brief synopsis of the advantage of DB2 over VSAM (and other flat file approaches).
VSAM and DB2: What are They?
VSAM is a file access method whereas DB2 is a DBMS — with all the inherent benefits of a DBMS. The main advantage of using a DBMS is to impose a logical, structured organization on the data. A DBMS delivers economy of scale for processing large amounts of data because it is optimized for such operations.
Additionally, using a DBMS provides a central store of data that can be accessed by multiple users, from multiple locations. Data can be shared among multiple applications, instead of new iterations of the same data being propagated and stored in new files for every new application. Most flat file approaches are designed to be accessed by a single user (or single process) at a time.
- Central storage and management of data within a DBMS provides:
- Data abstraction and independence.
- Data security.
- A locking mechanism for concurrent access with ACID properties (ACID is an acronym for atomicity, consistency, isolation, and durability).
- An efficient handler to balance the needs of multiple applications using the same data.
- The ability to swiftly recover from crashes and errors.
- Robust data integrity capabilities.
- Simple access using a standard API.
- Uniform administration procedures for data.
A DBMS offers the ability to provide many views of a single database schema. A view defines what data the user sees and how that user sees the data. The DBMS provides a level of abstraction between the conceptual schema that defines the logical structure of the database and the physical schema that describes the files, indexes, and other physical mechanisms used by the database. Users function at the conceptual level — for example, by querying columns within rows of tables — instead of having to figure out how to access data using the many different types of physical structures used by the DBMS to store the data.
When a DBMS is used, systems can be modified much more easily when business requirements change. New categories of data can be added to the database without disruption to the existing system. With DB2, for example, adding a new “field” is as simple as issuing an ALTER statement to add the new column to the table. Performing a similar task in VSAM is much more difficult — especially if the file does not have any unused “filler” area at the end.
A DBMS provides a layer of independence between the data and the applications that use the data. In other words, applications are insulated from how data is structured and stored. The DBMS provides two types of data independence:
- Logical data independence: Protection from changes to the logical structure of data.
- Physical data independence: Protection from changes to the physical structure of data.
As long as the program uses the API (application programming interface) to the database as provided by the DBMS, developers can avoid changing programs because of database changes.
Furthermore, ad hoc access to your data is very, very difficult — nigh on impossible - when using VSAM. Ad hoc access to SQL data is simple — thereby giving your end users better data availability and access.
Summary
Hopefully this short synopsis of the advantages of the database approach over the flat file approach helped to reinforce concepts and knowledge that you already had. And the next time your boss or clueless Lou the user wants to know why your project needs to use DB2, you can just refer him to this article.
--
Craig Mullins is an independent consultant and president of Mullins Consulting, Inc. Craig has extensive experience in the field of database management having worked as an application developer, a DBA, and an instructor with multiple database management systems including DB2, Sybase, and SQL Server. Craig is also the author of the DB2 Developer’s Guide, the industry-leading book on DB2 for z/OS, and Database Administration: Practices and Procedures, the industry’s only book on heterogeneous DBA procedures. You can contact Craig via his web site at http://www.craigsmullins.com.
Contributors : Craig S. Mullins
Last modified 2006-01-16 04:35 AM