FLAT FILE SYSTEMS AND THEIR DRAWBACKS (TRADITIONAL FILE SYSTEM) Database Management System

FLAT FILE SYSTEMS AND THEIR DRAWBACKS (TRADITIONAL FILE SYSTEM) Database Management System

FLAT FILE SYSTEMS AND THEIR DRAWBACKS (TRADITIONAL FILE SYSTEM)

Before the development of DBMS, only flat files were used to maintain database through the application software written in some high level language. For example most of the insurance, banking and retail Software were developed using Cobol and data was Stored inflat files on hard disk using file handling features of Cobol. Similarly some of the application software were developed using Clanguage which also supports proper file handling features. They were called flat files because data was stored in them as a stream of bytes and retrieval was also insequential manner. Moreover without the application software the data could not be read from them. Recall your C/C++file handling program in which you might have written Some data to a disk file and another program to read that data using fopen, file pointer etc.

The following Code Snippet of C++ illustrates Creation of flat file for a particular software:

void read all records ()

{

cassette C;

fstream file ;

file.open (“Cassette, dat”, ios: : in);

fi1e.read((char*)&c, sizeof(c));

while (file)

}

Count++;

Stock [Count]  = C ;

file. read ( (char*) &c, sizeof (c));

}

file. close();

}

Void putdata ()

{

int k;

fstream file;

file. open (“cassette. dat”, ios: : out);

for (k=0;k<=count;k++)

file.write ( (char*) &stock [k] , sizeof(stock [k] ) ) ;

file.close();

The above Code illustrates Creation of two data files (flat files) using the file handling Commands of C++. An application Software developed in C, C++, Cobo make use of large number of such files in a single project. But these flat files have many drawbacks such as they are not secured, any one can see their contents on dos prompt by simply typing the command:

C: \> type Cassette. dat

All the data stored in this file will be visible on screen. Similarly there are other drawbacks of such flat file approach as listed ahead.

The file-based approach to data storage and usage meant that data was stored in individual files which could only be accessed by a specific program or programs which had the file structure and parameters incorporated in them. In other words, the order department could only access files used by the order department programs, the accounts department could only access files used by the accounts department programs and the payroll department could only access files used by the payroll department. A diagram an example of the file-based structure is shown on the next slide.

  • All data was stored in individual data files
  • Specific programs used to create and manipulate data in specific files
  • Data specifications and parameters were defined in the user program

File-Based Data Handling System

 Remove term: FLAT FILE SYSTEMS AND THEIR DRAWBACKS (TRADITIONAL FILE SYSTEM) Database Management System FLAT FILE SYSTEMS AND THEIR DRAWBACKS (TRADITIONAL FILE SYSTEM) Database Management System

The above figure is a example of file-based data handling System. Notice that each department has its own data files and programs to access their data. This data handling structure had several problems :

  • File structure embedded in the program
  • Data repeated in multiple files
  • Data responsibility is dispersed
  • Difficult to add new programs
  • Considerable program maintenance

The file-based system had several potential problems. One problem was that since the data definition and structure was controlled by the program, a change in these parameters required a change in the program. This required increased program maintenance and program development time. Another problem was the responsibility for data was dispersed to the program which was using it. This changeable responsibility caused files to be developed in a rather inconsistent style. Yet another problem was redundant data in different files because there was no communication between user programs. Therefore, a better method for data handling was needed. Thus, the DBMS was created to address these shortcomings.

Drawbacks of Flat File Systems       

Unanticipated Oueries       

In a file-based system, handling sudden/ad-hoc queries can be difficult, since it requires changes in the existing programs.

Data isolation :

Though data used by different programs in the application may be related, they reside in isolated data files.

Security Problems :

In data-intensive applications, security of data is a major Concern. Users should be given access only to required data and not the whole database. In a file-based system, this can be handled only by additional programming in each application.

Multiple Unrelated Data Files :

Multiple data files are Created in such software and there in no enforced relationships among Such files. For eg. The following illustrates few data files required for different modules of same banking project:

As shown in the figure, in a file-based system, different programs in the same application may be interacting with different private data files. There is no system enforcing any standardized Control on the organization and structure of these data files.

Moreover with the execution of software more version such files are created due to updation, insertion

or deletion of records.

FLAT FILE SYSTEMS AND THEIR DRAWBACKS (TRADITIONAL FILE SYSTEM) Database Management System

Data redundancy and inconsistency :

Since data resides in different private data files, there are chances of redundancy and resulting inconsistency. For example, in the above example shown, the same Customer can have a savings account as well as a mortgage loan. Here the customer details may be duplicated since the programs for the two functions store their corresponding data in two different data files. This gives rise to redundancy in the Customer’s data. Since the same data is stored in two files, inconsistency arises if a change made in the data in one file is not reflected in the other.

Concurrent access anomalies :

In large multi-user systems the same file or record may need to be accessed by multiple users simultaneously. Handling this in a file-based systems is difficult.

Integrity problems :

In any application, there will be certain data integrity rules which needs to be maintained. These could be in the form of certain conditions/constraints on the elements of the data records. In the savings bank application, one such integrity rule could be “Customer ID, which is the unique identifier for a customer record, should be non-empty”. There can be several such integrity rules. In a file-based system, all these rules need to be explicitly programmed in the application program.

Program and data dependency :

There is a rigid program and data dependency in such traditional file oriented approach. A flat file Created using Cobol cannot be easily readby program written in Cor C++. Also if a field is to be added in some data structure then it may not be possible after large volume of data is stored in the data files.

It may be noted that, we are not trying to say that handling the above issues like Concurrent access, security, integrity problems, etc., is not possible in a file-based system. The real issue was that, though all these are common issues of concern to any data-intensive application, each application had to handle all

these problems on its own. The application programmer needs to bother not only about implementing the application business rules but also about handling these Common issues.