IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Query regarding COBOL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ajay_diaz
Warnings : 1

New User


Joined: 12 Sep 2005
Posts: 28

PostPosted: Fri Sep 16, 2005 6:09 pm
Reply with quote

We code BLOCK CONTAINS 8000 (say) RECORDS in DATA DIVISION of a file section of a COBOL program.

As far as I know, these many records are read in one go from the memory. (not sure though!!)

But the program can read only one record at a time.

So is there any buffer kind of thing where these records are stored?

Thanks
Ajay
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Sep 17, 2005 5:23 am
Reply with quote

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".
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top