Forcing Records to Disk

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Recently, I spent an hour or more debugging a new program that didn't have a bug. The program is a never-ending program that runs in a batch subsystem and spends most of its time waiting to read data from a data queue. When a user presses a certain function key, the interactive program writes information to the data queue with a call to QSNDDTAQ. The never-ending program then reads the data queue, performs some processing, and writes information to a file. During the unit-testing stage, I discovered that the program didn't appear to write to the file-or so I thought. After I ended the program, the records were there!

A colleague and I discovered that this strange behavior was due to the default value of the "Records to force a write" or FRCRATIO parameter of the Create Physical File (CRTPF) and Create Logical File (CRTLF) commands. The default is *NONE; when I changed it to 1, the program worked as I thought it should.

Here's why. When OS/400 writes records to DASD, it does not always write them immediately. Instead, the operating system writes the records to a buffer area in memory. Records are written to DASD when the buffer is full or when the file is closed. Assuming that the memory buffer is a fixed size, records for files with large record sizes will be written to DASD sooner than records for files with small record sizes.

When you set the FRCRATIO parameter to *NONE, you have no control over when the operating system writes the records to DASD. OS/400 determines when it is appropriate to write them. The AS/400 can operate more efficiently this way. If your program ends after writing to the file, then you should let this parameter default to *NONE because OS/400 writes the records then anyway. A program that writes several records before it closes the file will operate more efficiently if it can write all the records in one burst.

If you set this parameter to a number, you control when the records are written. The number represents how many records you want OS/400 to buffer before it will write them to DASD. In my situation, I wanted the record to be written immediately so I set FRCRATIO to 1.

Proper use of this parameter could save considerable time when you write or debug programs. It could also make your system more efficient once your program enters the production environment.

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: