Clearing HashFiles

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
sri75
Premium Member
Premium Member
Posts: 132
Joined: Thu Sep 09, 2004 12:42 pm

Clearing HashFiles

Post by sri75 »

Hi,

We got few jobs from peoplesoft.all hashfiles had been created in project directory.So we are creating new directory to create hash files in it.
in one job (this is reusable job), there is one after job subroutine to clear the hashfile.
for this the parameter is file name .But now i want to send the full path to this routine.I tried but it didn't work.Can you please help me in passing the parameter to after job subroutine

Thanks
Sri
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:? What exactly about it "didn't work"? It would still be a single parameter, so you should be able to replace one value with the other and be fine - assuming your routine is expecting a full path.

Might be helpful to post your routine code.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sri75
Premium Member
Premium Member
Posts: 132
Joined: Thu Sep 09, 2004 12:42 pm

Post by sri75 »

Sorry for the confusion and inconvenience

Here is the routine
Beginning of the routine


Open InputArg TO HashFile Else

End
CLEARFILE HashFile
Close HashFile


ErrorCode = 0 ;* set this to non-zero to stop the stage/job


this is after job subroutine.It expects file name.
So i send the full path name as parameter .it didn't work
I changed the routine like this, but no luck

Open InputArg TO HashFile Else

End
HashTable = "/apps/bea/pt848/psoft1/Ascential/DataStage/Projects/Test/HashFiles/":HashFile
CLEARFILE HashTable
Close HashFile


ErrorCode = 0 ;* set this to non-zero to stop the stage/job

Thanks
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Now, you need to change OPEN to OPENPATH in the first line of the code that you provided, as now your working with pathed hashed files.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sri75
Premium Member
Premium Member
Posts: 132
Joined: Thu Sep 09, 2004 12:42 pm

Post by sri75 »

DsGuru thanks for your reply

I changed like this , but it didn't work

OpenPATH InputArg TO HashFile Else

End
HashTable = "/apps/bea/pt848/psoft1/Ascential/DataStage/Projects/test/HashFiles/":HashFile
CLEARFILE HashTable
Close HashFile


ErrorCode = 0 ;* set this to non-zero to stop the stage/job

Thanks
sri75
Premium Member
Premium Member
Posts: 132
Joined: Thu Sep 09, 2004 12:42 pm

Post by sri75 »

DsGuru thanks for your reply

I changed like this , but it didn't work

OpenPATH InputArg TO HashFile Else

End
HashTable = "/apps/bea/pt848/psoft1/Ascential/DataStage/Projects/test/HashFiles/":HashFile
CLEARFILE HashTable
Close HashFile


ErrorCode = 0 ;* set this to non-zero to stop the stage/job

Thanks
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Try the following

Code: Select all

PathedHFile="/apps/bea/pt848/psoft1/Ascential/DataStage/Projects/test/HashFiles/":InputArg
OpenPATH PathedHFile TO HashFile Else
End
CLEARFILE PathedHFile
Close HashFile


ErrorCode = 0 ;* set this to non-zero to stop the stage/job
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Bad code!

You go on to attempt ClearFile even if the file is not opened!

Code: Select all

* Arg1 contains pathname of hashed file.
OpenPath Arg1 To hFile
On Error
   ErrorCode = Status()
   Call DSLogWarn('Error opening "' : Arg1 : '".', "Before Job")
End
Then
   ClearFile Arg1
   ErrorCode = 0
   Close hFile
   Call DSLogInfo(Quote(Arg1) : ' has been cleared.', "Before Job")
End
Else
   ErrorCode = 1
   Call DSLogWarn('Unable to open "' : Arg1 : '".', "Before Job")
End
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

:oops: I did not pay much attention to that, my bad. My focus was stuck on the fact that the OP was not opening the fully pathed hashed file, just the hashed file name.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sri75
Premium Member
Premium Member
Posts: 132
Joined: Thu Sep 09, 2004 12:42 pm

Post by sri75 »

Thanks Ray and DsGuru

I appreciate your help
I tried to follow Ray's Code

This is after job subroutine

my job is getting aborted ,but not giving any error message.

I am not able to test this routine in manager,the run button was disabled.Can you please tell me how to test. and also can you please tell me where did I go wrong in the routine


I passed only the file name as input value (#DeltaHashFile#)to the routine .path name is already in the routine

Arg1="/apps/bea/pt848/psoft1/Ascential/DataStage/Projects/test/HashFiles/":InputArg
OpenPath Arg1 To hFile
On Error
ErrorCode = Status()
Call DSLogWarn('Error opening "' : Arg1 : '".', "After Job")
End
Then
ClearFile Arg1
ErrorCode = 0
Close hFile
Call DSLogInfo(Quote(Arg1) : ' has been cleared.', "After Job")
End
Else
ErrorCode = 1
Call DSLogWarn('Unable to open "' : Arg1 : '".', "After Job")
End

Thanks you very much.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

What is the log entry for after job subroutine? Are there any warning messages? Reset the job and see if any messages, "From Previous run..." show up in the log.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Does this hashed file exist?

If not, you will need to create it using an mkdbfile command or by validating or running a DataStage job in which it appears.

The Hashed File Calculator will generate an appropriate mkdbfile command.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sri75
Premium Member
Premium Member
Posts: 132
Joined: Thu Sep 09, 2004 12:42 pm

Post by sri75 »

Yes,It is existed file.

I am clearing the hashfile using the job ,not using after job subroutine

Thanks for all of your help
Post Reply