In this file organization the records, of the file are stored one after another both physically and logically. That, is. Record with sequence number 16 is located just after the 15th record.
A record of a sequential file can only be accessed. By reading all the previous records.
.The records are discriminated from one another using the record length declared in the associated FD statement of the, FILE-SECTION. For example If the, record structure that the programmer has declared is 52 bytes blocks of, 52 byte data (records are.) Assumed to placed one after another in the file. If the programmer is reading the data in a, sequential fileEvery READ statement brings 52 bytes into the memory.
If the, file contains say 52 byte, records; but the programmer. Tries to read this file with a program which has declared 40 byte records (i.e the total length of the FD structure is 40 bytes),. The program will certainly read some pieces of information into the memory but the after the first, READ statementSome meaningless pieces of records will be brought into memory and the program will start processing some physical records. Which contain logically meaningless data.
It is the programmer 's responsibility to take care of the record sizes in, files. You must be careful when declaring record structures for files.Any mistake you make in record sizes will cause your program to read / write erroneous information. This is especially dangerous. If the file contents are being, altered (changed updated).
Since the records are simply appended to each other when building. SEQUENTIAL files you simply, end up with a STREAM of byte.If this string does not contain any "Carriage Return / Line Feed" control characters, in it the whole file will appear as. A single LINE of character and would be impsossible to process with regular text editors. As you should know, by now text. Editors are good in reading / writing / modifying text files.These programs will assume that the file consists of LINES and expect the lines to separated from each other by a pair. Of control characters called "Carriage Return / Line Feed" (or CR / LF).
COBOL has a special type of sequential, file organizationWhich is called the LINE SEQUENTIAL ORGANIZATION which places a CR / LF pair at the end of each record while adding records. To a file and expect such a pair while reading. LINE SEQUENTIAL files are much easier to use while developing programs because. You can always use a simple text editor to see the contents of your sequential file and trace / debug your program.
.Please note that LINE SEQUENTIAL files have two extra characters for each record. For files which have, millions, of records. This might use up a significant amount of disk space.
SEQUENTIAL files have only one ACCESS MODE and that is sequential. " Access. "Therefore you need not specify an ACCESS MODE in the SELECT statement. Typical SELECT statements for SEQUENTIAL. Files are.
การแปล กรุณารอสักครู่..
