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

QSAM Buffering Options


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

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Tue Sep 08, 2009 4:21 pm
Reply with quote

I have a COBOL program which writes about 80,192,091 records into a QSAM file. This step consumes a total of about 2.5 CPU minutes and over 15 clock minutes.
The total EXCP count consumed on this file is about 431141.
This shows that there should be one write operation for every 186 records.
The record length of the file is 150. The Blocksize of the output file is currently 27900. which is nothing but 150 * 186.. Hence one write operation takes place whenever a block is getting filled..

My doubt now is, will a I-O operation take place whenever a block gets filled ? Or when 'n' number of blocks that can fill a track gets filled ?

Because here in my case, a WRITE takes place whenever one block is getting filled and not when 2 blocks that constitutes a track gets filled.

I have a COBOL program which writes about 80,192,091 records into a QSAM file. This step consumes a total of about 2.5 CPU minutes and over 15 clock minutes.
The total EXCP count consumed on this file is about 431141.
This shows that there should be one write operation for every 186 records.
The record length of the file is 150. The Blocksize of the output file is currently 27900. which is nothing but 150 * 186.. Hence one write operation takes place whenever a block is getting filled..

My doubt now is, will a I-O operation take place whenever a block gets filled ? Or when 'n' number of blocks that can fill a track gets filled ?

Are there any other ways of improving the performance of a COBOL write with the help of QSAM buffering options ???
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Sep 08, 2009 4:49 pm
Reply with quote

Do you have DCB=BUFNO= on the file? If so, how many buffers are you giving it? If not, add DCB=BUFNO=30 (or 50 or 100 or ...) on your DD statement and you could see some improvement. With half-track blocking, I tell my programmers to use at least 30 buffers although there are times when 50 or 100 improves performance. I've seen some old studies that indicate giving more than 200 buffers decreased performance but I haven't had a chance to study that myself.
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Tue Sep 08, 2009 4:57 pm
Reply with quote

Thanks Robert for your reply.

I was actually just about to add that to my post.
The JCL has DCB=BUFNO=5 specified in it.

But could you pls clarify on how this works ? As I already typed, i find a WRITE operation taking place whenever a block is getting filled, then where does this BUFNO come into picture ??

Is it like, the records will get written into buffers and whenever the number of the writes reaches the BUFNO specified, the actual write takes place ? In that case, is it like increasing BUFNO may not reduce EXCP, but just decrease the elapsed time alone ???
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Sep 08, 2009 5:09 pm
Reply with quote

DCB=BUFNO=5 is the default for QSAM. It is a default that has been set for many,many years and is extremely out of date. If you're running on a z10, the machine can run 4 billion instructions per second (what that means, exactly, is another question we won't discuss today) whereas an ESCON channel is pumping 17 million bytes per second through it (which could be many disk reads or writes, of course). Do we see a 235-to-1 difference? So with 5 buffers the system fills each, writes it, goes to the next. After the 5th one is filled, the system then has to wait for the first I/O operation to complete before starting to fill the first one again.

DO NOT become concerned with the actual physical writes -- that is well beyond the control of applications programmers; accept that the system will do so as efficiently as possible given the constraints you, the programmer, put on it (such as limiting it to only 5 buffers).

While actual results may vary, I have personally cut run time for a job by 80% (75 minutes to 15 minutes) merely by changing the buffers for each file from the default to something in the 30 to 50 range. Note that doing this may increase region requirements for the program.
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Tue Sep 08, 2009 5:14 pm
Reply with quote

Thanks for your explanation Robert.

I will test my program with different BUFNO values and will publish the most optimal one I was able to use.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Sep 08, 2009 7:50 pm
Reply with quote

Not sure if it applies to your version of cobol, but insure that you are not using the WRITE Immediate option.
Back to top
View user's profile Send private message
Singaram

New User


Joined: 19 Aug 2009
Posts: 19
Location: India

PostPosted: Tue Sep 08, 2009 11:20 pm
Reply with quote

Can you please clarify the relation of BUFNO value and the BLKSIZE for QSAM??
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Sep 09, 2009 12:03 am
Reply with quote

BUFNO is the number of buffers used by QSAM for reading (or writing) the file.

BLKSIZE is the physical size read or written -- the size of the data "chunks" (I know, not a very technical term) written to the disk at one time.

The amount of memory required by a program for the file buffers is the number of buffers times the block size; since buffers can now go above the line the performance impact of more buffers is lessened.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Sep 09, 2009 3:08 am
Reply with quote

Mr. J, I'm guessing that your guess will be correct: Increasing BUFNO will not significantly affect the EXCP count but you will probably see a slight decrease in elapsed time. Keep in mind that unless you have a dedicated machine, elapsed time is not a good measurement because of a variable job mix. Please let us know the results of your benchmark.
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 COBOL MVS options COBOL Programming 8
No new posts Default FTP options All Other Mainframe Topics 2
No new posts Edit large number of datasets (QSAM) TSO/ISPF 3
No new posts DB2 Unload format options DB2 2
No new posts Endevor - Compiler Options. Mainframe Interview Questions 4
Search our Forums:

Back to Top