JOB PARAMETER

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
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

JOB PARAMETER

Post by shrey3a »

Hi,

I've job which fetches only one record in Hash/Seq file and I need to use it as a Job parameter in next job.
Its a Date filed and I need to query my source against it , I want to filter the data at source stage only by embedding the hash file value as parameter in the SQL query 'WHERE' clause.

i.e. where updated_on >= #HashFileValue#

Regards,

Regards
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The job parameter value must be obtained before you run this job.
You can create a routine to read the value from the hashed file, then use the return value from this routine in a job sequence to provide the value for the job parameter in a Job Activity.

Code: Select all

FUNCTION GetHashedFileValue(HashedFilePath,KeyValue,FieldNumber)
RoutineName = "GetHashedFileValue"
Ans = @NULL
OpenPath HashedFilePath To HF.fvar
On Error
   Call DSLogWarning('Error opening "':HashedFilePath:'".', RoutineName)
End
Then
   ReadV Result From HF.fvar, KeyValue, FieldNumber
   On Error
      Call DSTransformError('Error reading from hashed file.', RoutineName)
   End
   Then
      Ans = Result
   End
   Else
      Call DSLogWarn('Record "':KeyValue:'" not found in "':HashedFilePath:'".', RoutineName)
   End
End
Else
   Call DSLogWarn('Unable to open "':HashedFilePath:'".', RoutineName)
End
RETURN(Ans)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sagara
Participant
Posts: 2
Joined: Mon May 30, 2005 10:41 pm

Post by sagara »

Have similar question..
Is there a function through which I can get the part a file name to be my job parameter? The sequential files which are input to the jobs carry date in the filenames (and no where in the content of the file) which needs to be used in the tranforms. Any thoughts?
Thanks,
Sangeetha
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Post a new thread. We don't hijack threads - it renders the search mechanism inefficient. Yours is an almost completely different requirement.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Post by shrey3a »

Thanks Guru...Gereat Help .....Thanks Again

[quote="ray.wurlod"]The job parameter value must be obtained before you run this job.
You can create a routine to read the value from the hashed file, then use the return value from this routine in a job sequence to provide the value for the job parameter in a Job Activity.
[code]FUNCTION GetHashedFileValue(HashedFilePath,KeyValue,FieldNumber)
RoutineName = "GetHashedFileValue"
Ans = @NULL
OpenPath HashedFilePath To HF.fvar
On Error
Call DSLogWarning('Error opening "':HashedFilePath:'".', RoutineName)
End
Then
ReadV Result From HF.fvar, KeyValue, FieldNumber
On Error
Call DSTransformError('Error reading from hashed file.', RoutineName)
End
Then
Ans = Result
End
Else
Call DSLogWarn('Record "':KeyValue:'" not found in "':HashedFilePath:'".', RoutineName)
End
End
Else
Call DSLogWarn('Unable to open "':HashedFilePath:'".', RoutineName)
End
RETURN(Ans)[/code][/quote]
Post Reply