Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Query regarding COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Query regarding COBOL
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us