What is the best way for me to handle clearing work files?

145 pts.
Tags:
AS/400
RPGLE
Work Files
Program in RPGLE. I have 2 work files in my program. They hold possible matching data for a name, birth, etc. I have rules where I search the file and determine how many parameters match. I have to delete records if I don't have a minimum of fields matching.  I make several runs through the file to get the final record. But I then need to clear the 2 work files and start over for the next lookup. What is the best way for me to handle clearing these work files? I think I have a problem with records that have been deleted. DSPFD shows I have 100,000 records, but I really only have 15 records in my file. 

Answer Wiki

Thanks. We'll let you know when a new response is added.

First, run:<pre>
CHGPF mylib/myworkfile REUSEDLT(*YES)</pre>
The file appears to be continually adding new records at the end of the file rather than reusing space that has been made available by previously deleted records.

Then:<pre>
RGZPFM mylib/myworkfile</pre>
The previously deleted records can have their space returned by reorganizing the file.

It probably doesn’t actually matter which one runs first. Once both commands run, the problem shouldn’t come back unless <mylib/myworkfile> is recreated without setting the REUSEDLT(*YES) attribute appropriately or changed again with CHGPF REUSEDLT(*NO).

Tom

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Pt0505
    thanks for the info!
    145 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following