Page 1 of 1

Clearing hash file with CLEAR.FILE command

Posted: Fri May 13, 2005 7:07 am
by SonShe
I want to clear a hash file with a before-job command "CLEAR.FILE hashfilename". WHen the hash file was being created in the default project directory, this was working. However, when the hash file is being created in a separate directory other than the default project directory it looks like the CLEAR.FILE is not working.

I need to clear the file. How can I make CLEAR.FILE command to work when the hash file is in a separate directory. I will appreciate any help.

Thanks.

Posted: Fri May 13, 2005 7:24 am
by Sainath.Srinivasan
You can tick the box saying 'clear before writing'.

Posted: Fri May 13, 2005 8:00 am
by SonShe
Sainath thanks for the reply. There are three input links writing data to the hash file. That is why I clear the file using the CLEAR.FILE command before the job start. I believe in this case I cannot check the clear box in the hash stage. Please clarify.

Posted: Fri May 13, 2005 8:13 am
by Sainath.Srinivasan
Have a pre-job that does this for you with no rows passed to it.

Posted: Fri May 13, 2005 9:45 am
by SonShe
Thanks again, Sainath. I liked the idea!

Posted: Fri May 13, 2005 9:57 am
by chulett
Another option would be to establish a VOC record to the hash so that CLEAR.FILE would work for your pathed hash file. Search the forum for the syntax as it's been posted many times here.

Yet another option would be to simply leverage your O/S - since pathed hashes are created by the mkdbfile command which works strictly at the O/S level - you could write a script that is called pre-job to delete the existing structures and recreate them with the same command. You could also just do the delete and let the job recreate them if taking the defaults is ok.

Food for thought...

Posted: Fri May 13, 2005 11:25 am
by Sainath.Srinivasan
I agree with Craig's idea but did not mention in that in my mail because there is a degree of risk involved in performing operations outside DataStage - for instance, when you migrate jobs to from dev to test to prod.