The concept of files in COBOL is different from that in C/C++. While
learning the basics of 'File' in COBOL, the concepts of both languages
should not be co-related. Simple text files cannot be used in COBOL,
instead PS (Physical Sequential) and VSAM files are used. PS files will be discussed in this module.
To understand file handling in COBOL, one must know the basic terms. These terms only serve to understand the fundamentals of file handling. Further in-depth terminology would be discussed in the chapter 'File Handling Verbs'. Following are the basic terms:
To understand file handling in COBOL, one must know the basic terms. These terms only serve to understand the fundamentals of file handling. Further in-depth terminology would be discussed in the chapter 'File Handling Verbs'. Following are the basic terms:
- Field
- Record
- Physical Record
- Logical Record
- File
Field
Field is used to indicate the data stored about an element. It represents a single element as shown in the above example such as student id, name, marks, total marks, and percentage. The number of characters in any field is known as field size, for example student name can have 10 characters. Fields can have the following attributes:- Primary keys are those fields that are unique to each record and are used to identify a particular record. For example, in students marks file, each student will be having a unique student id which forms the primary key.
- Secondary keys are unique or non-unique fields that are used to search for related data. For example, in students marks file, full name of student can be used as secondary key when student id is not known.
- Descriptors fields are used to describe an entity. For example, in students marks file, marks and percentage fields that add meaning to the record are known descriptors.
No comments:
Post a Comment