Naming Files

Just as files are named in the manual system, computer files too are given names. A disk will not necessarily contain only one file. It will probably have more than one file and you may need to refer to a specific file. Hence there is a need for file names. A file name should be descriptive and meaningful. Certain conventions are followed while naming computer files. A file name can have two parts:

  • Primary name
  • Extension

The primary name and the extension are separated by a dot (.)

File Naming Conventions

File Naming Conventions

A primary name can have a maximum of eight characters while an extension can have a maximum of three characters.

A file name is valid even if it has no extension. However, extensions help in easy identification of a particular type of file. Therefore, a picture file has an extension of .bmp, a text file has an extension of .txt, and a program file has an extension of .prg and so on. File names can consist of the following characters:

  • An alphabet                        (A-Z)
  • A numeral                           (0-9)
  • Other characters                 ($, #,&,©,!, %, (), -, _, {},', ~,A) except ( \, /, *, ?, <>, and | )

While files are named by the people who create them, certain conventions are followed. Also, each file in a particular location on a disk needs to have a unique name.

Examples of some valid file names are:

  • EMPLOYEE.DAT
  • EXECUTIVE.T
  • XYZ
  • 123.45
  • HRD.RPT

The file name that you give must be meaningful. Meaningful file names enable easy identification of files. For example, if you want to create a file containing salary details of the employees, the name given to the file could be EMP.SAL or SALARY. These names indicate that these files contain data on salaries of employees.

If you were to name this file as XYZ.123 or $%$.TEN, you are most likely to forget the name of the file. Besides, the filename also does not convey what the file contains. Similarly, if your file contains a report of the financial status of a company, a name like FINANCE.RPT would make more sense than, say ABC.PQR.

Computer Files

In the Computer Overview module, you learnt about the various types of files and their storage. An organization maintains a number of files for keeping the records of various departments. Let us look at the manual system of file organization.

The employee file is one of the files that we examined in the Computer Overview module. The other files containing details of the stock of raw materials and the list of client details are also arranged in this filing cabinet (refer Figure).

Filing Cabinet

Different Files in a Filing cabinet

The files stored on a computer may be of different types which include text files that stores textual information, graphic files that stores information in the form of a picture or a graph or a program file that stores program code.

Data Organization

It has been mentioned earlier that in a computer system, the data that is input gets converted into information. We also identified the need for external storage media on which data can be stored for future use.

In our day-to-day lives, we store information in the form of files, be it our telephone directory, or the record of our monthly expenditure. The medium that is used in this type of manual storage is usually paper or other such physical media.

Similarly, information is also stored on the computer in the form of files, but the media is either external storage or internal storage. A computer may have the following types of files on its storage media:

  • Text files
  • Data files
  • Graphic files

Types of Files

Types of Files

Text Storage on a Storage Media

Example of a Text File

Example of a Text File

Any kind of text information, be it letters, documents or memorandums, is stored on the computer in the form of a file, which may be broadly classified as a text file. An example of a text file is shown in Figure.

Data Storage on a Storage Media

Manual Data File

A Manual Data File

Let us now look at how a company manually stores its data. In a manual system, data is stored in the form of a file. A manual file may contain the particulars of each employee in a company (refer Figure).

The manual employee file of a company has several cards, each with the details of one employee. The data to be used in a computer is also stored on a storage media i.e. the floppy disk or hard disk, in the form of a data file. However, a computer data file does not look like a manual data file. Data in a computer file is organized in a different manner (refer Figure).

Computer Data File

A Computer Data File

where

DESIG = designation

DEPT = department

AGE = age of the employee.

In a computer file, the particulars of each employee are contained in a single line. This is referred to as a record. For example, the complete data about employee ANN MURRAY, regarding his designation, department and age, is one record. Thus, a computer file is more compact than a manual file.

Each piece of data in the record is called a field. A field has two components—the field name and the field content (refer Figure). NAME, DESIG, DEPT and AGE are field names. Each record in the file contains these four fields. The field contents are JOHN BROWN, MARY MILLER, CONSULTANT, HRD, 52, etc. The contents of a field usually differ from record to record. You will recall that a character is any alphabet, numeral or symbol, such as %, *, etc. Each field comprises a number of characters. To sum it up, a field comprises several related characters, various related fields make up a record and many such records make up a file (refer Figure). Fields in the records have names.

Graphic Storage on a Storage Media

Example of a Graphic File

Example of a Graphic File

The computer is also capable of storing pictures, moving videos, sketches and other forms of visual information. This type of information is stored in the form of files that may be broadly classified as graphic files. An example of a graphic file is shown in Figure.