delete records in a RPG flat file

0 pts.
Tags:
RPG
RPG Flat Files
Hi I have created a flat file which holds the DSPLNK details of a text file that is dsplnk creates a splf which is copied to this flat file.This file is read for purging the text file once in 2 months.This happens on a daily basis and i have merged this piece of code with the one that retreives date also.Now the records in the file keeps adding as and when new files are created.Is there a way to delete the records in this file when the text file is deleted from dir.otherwise this file keeps growing.Please suggest me a way out of this.
ASKED: January 9, 2009  3:03 PM
UPDATED: January 12, 2009  6:49 PM

Answer Wiki

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

I think you only want the currrent DSPLNK in the file
Either use CLRPFM before the CPYSPLF
or in the CPYSPLF change MBROPT to *REPLACE

Phil

Discuss This Question: 4  Replies

 
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
  • I dont think this would help...As of now my prog does the following create a txt file on a daily basis and also check for files older than 2 months for purging.If i do a CLRPFM or replace dont you think it will be a problem because it will not have details of older files. that is if i run today a file abc20090110 will be created.the details of this should exist in the purge file for it to get deleted after a period of 2 months.
    0 pointsBadges:
    report
  • philpl1jb
    I'm not sure I understand You're running DSPLNK each day? You're running DSPLNK with default object = '*' You're running DSPLNK with Output = *PRINT You're using CPYSPLF with defaults TOMBR *FIRST MBROPT *REPLACE to copy this result into a flat file Then you're scanning the flat file to find txt files to delete. The next time you run DSPLNK it will clean up the flat file. If you want it cleaned up at the end of the job - repeat the steps DSPLNK CPYSPLF At that time you will only get a list the existing txt files. Phil
    48,545 pointsBadges:
    report
  • I will explain it clearly.Assume the prog starts running today.So the purge file will not have details initially.Now as the program runs each day dsplnk and cpysplf will load details of text file to this purge file.These details should remain in the purge file until it is deleted after 2 months.So if a clear of th purge file is done befroe that wont that be a problem?Please let me know if am clear
    0 pointsBadges:
    report
  • philpl1jb
    Delete if you like. You need an RPG program to read the records and delete those you don't want. Open it with the U/update code use DELETE command Or use the SQL delete ... But I'm too thick for your discussion Why use DSPLNK and not use it to get a current picuture of all the .txt files in you're directory? Phil
    48,545 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