Select value into Job Parametr

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
snassimr
Premium Member
Premium Member
Posts: 281
Joined: Tue May 17, 2005 5:27 am

Select value into Job Parametr

Post by snassimr »

Hi !

I need to set Job Parametr to value from database

How i can do it ?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

snassimr,

since job parameters cannot be changed within the job they are used in you will need an indirect approach. Write a DataStage job to read the database values and write them to a hash file or sequential file. Then write a short function in Uv/BASIC to read this value and return it to the caller. Then write a DataStage sequence which calls this routine activity and gets the parameter value to pass to a DataStage job.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Read the value from the database
Set it in a variable
Pass it to the job via the parameters - via api if from OS, via job control if from DS Batches, via job routines if from sequencer.
snassimr
Premium Member
Premium Member
Posts: 281
Joined: Tue May 17, 2005 5:27 am

Post by snassimr »

May be you can post the code extracting non-key field from hash file

Thank in advance
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

snassimr,

no code for this from me, although I think a good search will pick up some. You need to use the BASIC commands "OPEN" to open the hash file, and "READ" to read a record.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

SELECT the value into a text file, use an Execute Command activity to read the value from that file.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

May be you can post the code extracting non-key field from hash file
Why you want to do this? The purpose of a hash file is to use keys. If you are reading parameter values then the key should be the parameter name. The value should be field 1.

Code: Select all

ParamName = Arg1
open "MyParamValues" to ParamHashFile else stop
read ParamRec from ParamHashFile, ParamName else
   ParamRec = ''
end
ParamValue = ParamRec<1>
Ans = ParamValue
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

STOP statement in Routine is bad practice. Routines should always return. Prefer something like

Code: Select all

ParamName = Arg1
ParamRec = ""
OpenPath "C:\users\mydir\MyParamValues" To ParamHashedFile
Then
   Read ParamRec From ParamHashedFile, ParamName
   Else
      ParamRec = ""
      Call DSLogWarn("Value for " : ParamName : " not found.", "Loading")
   End
End
Ans = ParamRec<1>
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kerensho
Participant
Posts: 13
Joined: Mon Jul 11, 2005 5:36 am

Post by kerensho »

Hello,

You can read the value from the DB into a transformer in which you can use a StageVariable to call the UtilityRunJob routine like that:

UtilityRunJob("JobName", "JobParam1=value1|Jobparam2=value2....","RowsLimit","WarningsLimit")

You need to pass all of the jobs parameters, though.
this is also good for a loop (when you want to run a job for each record you read from a file and transfer parameters from the same record).

hope it helps'
Keren
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
Just wanted to state that if you use the option of the routine givven to run DS jobs verify no passwords will be written to the logs.

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
Post Reply