I need to assign a date to a job parameter so it can be used to restrict the records returned from my source system.
The date I need will be extracted from SAP BW prior to the job being run so the job knows the last successful load date. It can be extracted into either a hashed file or a flat file.
Can someone please tell me how I can get the value from a file and assign it to a job parameter.
Is it possible to do this with a routine? I tried to write the code to simply set a job parameter using DSSetParam from a routine but it didn't work.
If someone could give me example code and explain where this code needs to be used I would be very grateful.
Thanks in advance,
Nick.
Assign Job Parameter from a File
Moderators: chulett, rschirm, roy
Assign Job Parameter from a File
Regards,
Nick.
Nick.
Re: Assign Job Parameter from a File
From where are you calling the Routine ? is it from before-job sub-routine ?
You can't set a Job Parameter from inside a job, even in a before-job subroutine, as at that point the job has already started and it's too late. A couple of ways to accomplish what you need...
You can write a routine to pick up the value from your file and then return it as the output of the routine. In a Sequence job, put a Routine Activity stage before your Job Activity stage, run your routine and set the Parameter value to the Routine Activity stage's return code.
Or, write a simple job that reads it and puts the value out into the User Status area. Again, in a Sequence job, run the first job and then set the Parameter value to the UserStatus value of the previous job.
You can write a routine to pick up the value from your file and then return it as the output of the routine. In a Sequence job, put a Routine Activity stage before your Job Activity stage, run your routine and set the Parameter value to the Routine Activity stage's return code.
Or, write a simple job that reads it and puts the value out into the User Status area. Again, in a Sequence job, run the first job and then set the Parameter value to the UserStatus value of the previous job.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
I am about to suggest the same after he answers my question.chulett wrote:You can't set a Job Parameter from inside a job, even in a before-job subroutine, as at that point the job has already started and it's too late. A couple of ways to accomplish what you need...
You can write a routine to pick up the value from your file and then return it as the output of the routine. In a Sequence job, put a Routine Activity stage before your Job Activity stage, run your routine and set the Parameter value to the Routine Activity stage's return code.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Re: Assign Job Parameter from a File
You must do this in a controlling job. In the controlling job:bondcaliwood wrote:I need to assign a date to a job parameter so it can be used to restrict the records returned from my source system.
The date I need will be extracted from SAP BW prior to the job being run so the job knows the last successful load date. It can be extracted into either a hashed file or a flat file.
Can someone please tell me how I can get the value from a file and assign it to a job parameter.
Is it possible to do this with a routine? I tried to write the code to simply set a job parameter using DSSetParam from a routine but it didn't work.
If someone could give me example code and explain where this code needs to be used I would be very grateful.
Thanks in advance,
Nick.
- attach the "real" job checking for success (DSAttachJob())
open the file (OpenSeq)
read the parameter name/value pair (ReadSeq)
set the parameter in the attached job, checking for success (DSSetParam())
close the file (CloseSeq)
request that the attached job be run (DSRunJob())
wait for the attached job to finish ("sleep" wait or "busy" wait)
check the exit status of the attached job, react accordingly (DSGetJobInfo())
check any other metrics you need do
detach the child job (DSDetachJob())
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.