fhg
Volume 7, Number 32 -- September 19, 2007

Don't Disable Blocking

Published: September 19, 2007

by Ted Holt

Do you ever bother to look at warning messages after a successful program compilation? Most warning messages contain no useful information, but the few that do can make a difference. One message that I am always glad to see in RPG compiler listings is RNF7086.

So what is RNF7086? The text reads, "RPG handles blocking for the file. INFDS is updated only when blocks of data are transferred." This message is a good indicator that the system is going to handle the transfer of data between a database file and the program's buffers in an efficient manner. As efficiently as possible? Maybe not, but well enough.

Assume a program that reads a database file sequentially. Each time the program issues a read operation (sometimes called a get operation), the system gives it the data for one record. This behavior suits the program just fine, because the program can only process one record at a time anyway. If the system has to go to disk each time the program reads, the program is left with nothing to do while the slow disk access takes place.

Blocking has long been used to speed up input/output operations. Memory operations are fast; disk access is much slower. Blocking makes a program use more memory in order to reduce the number of disk accesses. Reducing the number of disk accesses makes the program run faster.

Assume the same program with blocking applied. Each time the system goes to disk for data, it brings back more than one record into memory. Maybe it brings back the data of 10, 50, or 100 records. Each time the program reads, the system first looks to see if there are any unprocessed records in memory. If so, it sends data for one record to the program. This is a memory operation, which is fast. But if not, it goes to disk for another group of records, then passes the first one of the group to the program.

Occasionally I work on a program in which a programmer has inadvertently disabled buffering. That is, each read to a file retrieves only one record. The programmer disabled buffering by including an unnecessary random-access operation. The operation I most often see is the Set Lower Limit (SETLL) operation in RPG programs. (COBOL programmers will know this operation as START.)

FSomeFile  if   e           k disk
 /free
     setll *loval SomeFile;
     dow '1';         
        read SomeFile;  
        if %eof();    
           leave;     
        endif;        
          // do more stuff to process the record
     enddo;           

The program processes the record sequentially, from top to bottom. That is, the READ op code is a sequential operation. The programmer has disabled blocking by using the unnecessary SETLL op code.

How much of a gain could he expect if he removed SETLL? It's hard to say, but I ran a quick unscientific test against a file of almost eleven and a half million records, and the version with SETLL ran 25 percent longer.

So that's your tip for the day: Don't disable blocking. Now for another tip: If you don't need to access a file by key, then don't. I ran a third test, with the record address type of K removed from the F spec. Run time was about one-fourth of the blocked keyed version. The following short table summarizes the results of the three runs.


Test

Run time in CPU seconds

Arrival sequence

16

Keyed sequence, blocked

60

Keyed sequence, unblocked

75



--Ted




                     Post this story to del.icio.us
               Post this story to Digg
    Post this story to Slashdot


Sponsored By
PRODATA COMPUTER SERVICES

*Remote Database Access!*

DBU Remote Database plug-in allows you to access your MySQL, SQL, DB2 and Oracle databases from your System i! Instantly display and edit these files using DBU.

Team it up with DBU Audit to capture the adds, changes and deletes made to the data!

Order today and SAVE $$$!

800.228.6318
sales@prodatacomputer.com
www.prodatacomputer.com


Senior Technical Editor: Ted Holt
Technical Editors: Howard Arner, Joe Hertvik, Shannon O'Donnell, Kevin Vandever
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Brian Kelly, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

Sponsored Links

COMMON:  Join us at the annual 2008 conference, March 30 - April 3, in Nashville, Tennessee
ARCAD Software:  Organize and automate multi-platform application change around your System i
NowWhatJobs.net:  NowWhatJobs.net is the resource for job transitions after age 40


 

IT Jungle Store Top Book Picks

The System i Pocket RPG & RPG IV Guide: List Price, $69.95
The iSeries Pocket Database Guide: List Price, $59.00
The iSeries Pocket Developers' Guide: List Price, $59.00
The iSeries Pocket SQL Guide: List Price, $59.00
The iSeries Pocket Query Guide: List Price, $49.00
The iSeries Pocket WebFacing Primer: List Price, $39.00
Migrating to WebSphere Express for iSeries: List Price, $49.00
iSeries Express Web Implementer's Guide: List Price, $59.00
Getting Started with WebSphere Development Studio for iSeries: List Price, $79.95
Getting Started With WebSphere Development Studio Client for iSeries: List Price, $89.00
Getting Started with WebSphere Express for iSeries: List Price, $49.00
WebFacing Application Design and Development Guide: List Price, $55.00
Can the AS/400 Survive IBM?: List Price, $49.00
The All-Everything Machine: List Price, $29.95
Chip Wars: List Price, $29.95


 
The Four Hundred
EGL: The Future of Programming for the System i?

Rumored Layoffs at IBM Rochester Not True

HP Beats the System i on Integration for Midrange Shops

LANSA Packages Modernization; Leasing Covers it All

The Linux Beacon
Canonical, VMware Create Skinny Linux for Virtual Appliances

HP Engineers New Blade Server Box for SMB Shops

SCO Files for Bankruptcy Protection

Transitive Rejiggers Emulation Software, Adds Partners

Four Hundred Stuff
Windows Vista Poses Challenges to Emulation Vendors

NetCustomer Capitalizes on Dissatisfaction with Oracle

Infor Provides Details on SOA Roadmap

Microsoft Ships BizTalk Server R2

Big Iron
IT Skills Shortage Could Play Out in Favor of Mainframes

Top Mainframe Stories From Around the Web

Chats, Webinars, Seminars, Shows, and Other Happenings

System i PTF Guide
September 15, 2007: Volume 9, Number 37

September 8, 2007: Volume 9, Number 36

September 1, 2007: Volume 9, Number 35

August 25, 2007: Volume 9, Number 34

August 18, 2007: Volume 9, Number 33

August 11, 2007: Volume 9, Number 32

The Windows Observer
New Test Releases of Windows Server 2008, 'Viridian' Imminent

AMD Gets Aggressive About Watts with Quad-Core Barcelonas

Microsoft Ships BizTalk Server R2

Microsoft Patches Four Security Flaws

The Unix Guardian
Sun Rolls Out Update for Solaris 10 Unix

AMD Gets Aggressive About Watts with Quad-Core Barcelonas

Transitive Rejiggers Emulation Software, Adds Partners

Sirius Expands Northeast Presence with SCS Buy

Four Hundred Monitor
Four Hundred Monitor's
Full iSeries Events Calendar

THIS ISSUE SPONSORED BY:

WorksRight Software
ProData Computer Services
Twin Data


Printer Friendly Version


TABLE OF CONTENTS
System i Developers and .NET 2.0: ASP.NET and the Declarative Programming Model

Don't Disable Blocking

Admin Alert: When APPN Prevents You from Changing Network Attributes

Four Hundred Guru

BACK ISSUES

From the IT Jungle Forums
What's coalesce good for?

Duplicated printer files

Urgent Help Needed--Limit the result set in SQL stored procedure

Problem with "cpyfrmimpf"

FNDSTRPDM Output Member Name to *OUTFILE





 
Subscription Information:
You can unsubscribe, change your email address, or sign up for any of IT Jungle's free e-newsletters through our Web site at http://www.itjungle.com/sub/subscribe.html.

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc., 50 Park Terrace East, Suite 8F, New York, NY 10034

Privacy Statement