mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Ajay,
The OS, at the request of the pgm, reads blks of recs into buffers (1 blk per buffer). Blk, rec, and buffer info is supplied by a combination of DSCB, Label, JCL DCB and/or pgm FD info.
When a COBOL pgm reads a rec, the 1st read fills all buffers w/data (blks). A pointer to the 1st rec of the 1st blk in the 1st buffer is presented to the pgm. On the next pgm read the pointer is then set to the next rec in the buffer, and so on until the last rec in the buffer is "read".
At that point the pointer is set to the 1st rec of the next buffer. The 1st buffer now is overlaid by a blk read from the external media. This is done in such a way as to "overlap" with the processing of the previous rec to make the whole process as efficient as possible.
And of course, this goes on until the entire file is read and processed.
So, the main point to remember is that when a pgm "reads" a rec it generally results in the buffer pointer being advanced to the next rec in the buffer. The data has previously been physically transferred to the pgm's memory long before the "read". |
|