I have a requirement to delete some rows from hashed file based on a flag value (UPDFLG) on a periodical basis. The UPDFLG is a non key , which will contian the value either 'Y' Or 'N'.
On regular basis, say once in a month , i need to delete all the rows with the value 'N' from the Hashed File.
I can write a job, with the UV stage , and delete the rows.. But i was thinking as the RT_LOGxxx is also a hashed file, and it is deleting the records based on the settings , we give in AutoPurge.
So , is there any way , i can instruct my hashed file also, to delete the rows periodically.
Simulating AutoPurge
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 232
- Joined: Fri Aug 04, 2006 1:20 am
- Location: Bangalore
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
No.
Auto-purge is not as automatic as the name suggests. It is triggered by successful completion of the job. So, even if auto-purge is set to 3 days (for example) the job log will not be purged until next time the job is completed successfully (without aborting), no matter when this is.
You would need to define a similar event that would trigger a routine to purge your hashed file, and then create a mechanism (such as a job or a routine) to give effect to that purge.
It's do-able, but it can not be triggered by time alone.
Auto-purge is not as automatic as the name suggests. It is triggered by successful completion of the job. So, even if auto-purge is set to 3 days (for example) the job log will not be purged until next time the job is completed successfully (without aborting), no matter when this is.
You would need to define a similar event that would trigger a routine to purge your hashed file, and then create a mechanism (such as a job or a routine) to give effect to that purge.
It's do-able, but it can not be triggered by time alone.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 232
- Joined: Fri Aug 04, 2006 1:20 am
- Location: Bangalore
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
FUNCTION DeleteN(HashedFilePath)
* Error handling omitted for clarity
* Deletes records from hashed file where field #3 = "N".
Equate FIELDNO To 3 ; * adjust as required
Ans = 0
OpenPath HashedFilePath To hHashedFile
Then
Select hHashedFile To 9
Begin Transaction
Loop
While ReadNext ID From 9
ReadU Record From hHashedFile, ID
Then
If Record<FIELDNO> = "N"
Then
Delete hHashedFile, ID
Ans += 1
End
End
End
Repeat
Commit
End Transaction
End
RETURN(Ans)
Last edited by ray.wurlod on Thu Sep 18, 2008 3:30 pm, edited 3 times in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 232
- Joined: Fri Aug 04, 2006 1:20 am
- Location: Bangalore
-
- Premium Member
- Posts: 232
- Joined: Fri Aug 04, 2006 1:20 am
- Location: Bangalore