I wanted to answer it here because I think others are confused. The trick Peter figured out is this. You have access to the actual paramater values. Most of us use the variable with the same name as the parameter to get its value but to set it you cannot do:Kim,
When you have a minute I would appreciate a hand. If this private message isn't the proper way of asking this question, please let me know or just disregard it. I don't want to take up too much of your time.
I'm trying to understand how to implement the routine that you posted for setting a Job Param from a hash file. Could you please explain the process again in just a bit more detail. I think where I'm getting lost is 1) how does the routine know which job(s) to set params for and 2) you put a ---Wait--- step in the Job Sequence you described. I'm not sure what that means.
As far as 1) goes, I don't understand how it knows what jobs are in JobActivity stages downstream from the RoutineActivity where the routine is executed.
Thanks again,
Tony
ParamName = "Param Value"
It does not work in job control. In routine activity you can change this value indirectly or actually directly based on how the run time code actually works. The parameter names are stored in
STAGECOM.JOB.CONFIG<CONTAINER.PARAM.NAMES>
This list is multivalued. The parameter values are stored in:
STAGECOM.JOB.STATUS<JOB.PARAM.VALUES>
So if you locate the parameter name in STAGECOM.JOB.CONFIG<CONTAINER.PARAM.NAMES> and then set the value in:
STAGECOM.JOB.STATUS<JOB.PARAM.VALUES,JobParamPos> = JobParamValue
Then from this point on in the job sequence the parameter value is exactly what you just set it to. So I need to make sure all my jobs run after this routine activity.
What I did in KgdSetLastKeyParam was read my parameter value from a hash file called MaxHashKeyHash. The parameter name is the first argument to this routine. The second argument is the hash file id. Using this I can read the parameter value from MaxHashKeyHash and set ParamName to the value just read by locating it in STAGECOM.JOB.CONFIG<CONTAINER.PARAM.NAMES>. Based on what position this parameter name is in this multivalued field then I change STAGECOM.JOB.STATUS<JOB.PARAM.VALUES,JobParamPos>.
The reason this routine is named KgdSetLastKeyParam is because I wanted to load new keys from my dimensions into my crossref hash file. This hash file has source keys and looks up the surrogate key to see if it is new or not. So if I already have a million records in this hash file then why load them all. So first I get the max(surrogate_key) from this hash file. I use a UV stage. I works just like the job that reads max key from our dimension.
select max(#SurrogateKey#) from #HashFile#
Now that I have the last key in my crossref hash file then I need to feed it in to job that builds my crossref hash file. So my select for building this hash file is now:
select * from DimTable where Key > #MaxKeyValue#
I can set this to zero if I want to totally rebuild this hash file.
This is very complex but should see large gains by not reading millions of rows. We all try to do incremental loads from source to target. Why not do incremental loads from target to crossref hash files.
Cool huh?