fhg
Volume 6, Number 2 -- February 1, 2006

Alternatives to Clear Physical File Member

Published: February 1, 2006

by Ted Holt

Suppose a file of summary figures is used for inquiry throughout the day and is repopulated with the latest information on the hour. How do you clear the file, a process which requires an exclusive lock, while the inquiry program is in use? This is the type of problem I have faced several times, and here are a couple of ways I have addressed it.

One method is to place an activity code field in the file, with values of A and D, for example, to indicate active and deleted records. The inquiry program uses a logical file to select active records only.

A          R SOMEREC                   PFILE(SOMEPF)
A          K CUSTNO                                     
A          K TRANSDATE                                  
A          S RECCODE                   CMP(EQ 'A')

Reloading the file is a two-step process: First, change the activity code to the deletion value. Second, write new data to the file.

The other method I have used is similar, but does not require the file to have an activity field. This method is also a two-step process. First, delete all the records in the file. You might use a generic program, like this one:

 * Delete all records in a file
FDBFile    UF   F   80        DISK
DDS               DS            80

C              DOU     *INLR
C              READ    DBFile       DS          LR
C              IF      NOT *INLR
C              DELETE  DBFile
C              ENDIF
C              ENDDO

Or, if you prefer shorter programs, this one:

 * Delete all records in a file
FDBFile    up   f   80        disk
IDBFile    ns  01
ODBFile    ddel 01

Before calling the program, override to the file whose records are to be deleted.

OVRDBF FILE(DBFILE) TOFILE(SALES)
CALL   PGM(DLTRCDS)
DLTOVR FILE(DBFILE)

Second, write new data to the file.

In either case, the file accumulates more and more physically or logically deleted records throughout the day. At some point, such as during nightly or weekend processing, the file will need to be cleared.



Sponsored By
ADVANCED SYSTEMS CONCEPTS

SEQUEL can be used for virtually ALL data access functions on the iSeries.

A Windows-based user interface makes it easy to design queries and reports.

SEQUEL offers executive dashboards, drill-down data analysis and run-time prompts to deliver important iSeries data to managers and other non-technical users.

E-mail and FTP delivery let you deliver information to remote users and servers.

www.asc-iseries.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

Computer Keyes:  Rapidly convert *SCS printer files into black and white or full color PDF documents
Cosyn Software:  Audit Trail/400 for Sarbanes Oxley
COMMON:  Join us at the Spring 2006 conference, March 26-30, in Minneapolis, Minnesota

 


 
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