jeudi 23 octobre 2014

Buffer in cobol file handling


Vote count:

0




i have written a code to match the date given by user(instream data) with the date mentioned in an input file. When the date matches, the record is moved to an output file. The program ran successfully. Now i am inserting a header in output file by declaring a variable 'header' in working-storage section, moving the 'header' field to output record and writing the output record. Though it is running successfully i have a doubt. I looked for it everywhere but unable to find it. The problem is-


The concept of buffer tells us that while declaring File Description(FD) it creates a structure. The file description(FD) given with all the records and fields creates a buffer structure. Now all the read/write operation happens through it.

If a program processes more than one file, a record buffer must be defined for each file.


To process all the records in an INPUT file, we must ensure that each record instance is copied from the file, into the record buffer, when required.


To create an OUTPUT file containing data records, we must ensure that each record is placed in the record buffer and then transferred to the file.


To transfer a record from an input file to an output file we must read the record into the input record buffer, transfer it to the output record buffer and then write the data to the output file from the output record buffer.


So when i am giving the date separately and moving it to the output record it is SURELY not going into that buffer which i created using FD in output record. So how is it going there?? If it is creating its own buffer then all data can be moved directly, what is the need of declaring FD??


This is the link to see the concept of buffer

[1]: http://ift.tt/1xbYn0N



asked 5 mins ago







Buffer in cobol file handling

Aucun commentaire:

Enregistrer un commentaire