Page 1 of 1

Call a Routine in a Parameter value

Posted: Mon Jun 04, 2007 2:53 pm
by kab123
Hi,

Can we call a routine as a parameter value in job properties.
like, I would like to use previous month end date as a parameter.
I know if it is a UNIX server, we can use a shellscript. but we are using a NT server.
Can somebody give me some inputs..

Thanks

Re: Call a Routine in a Parameter value

Posted: Mon Jun 04, 2007 2:59 pm
by Perwezakh
kab123 wrote:Hi,

Can we call a routine as a parameter value in job properties.
like, I would like to use previous month end date as a parameter.
I know if it is a UNIX server, we can use a shellscript. but we are using a NT server.
Can somebody give me some inputs..

Thanks
No can't use script in parameter. But yes use can use shell scripts as a before and after routine. As per your use you can use your date shell scripting as a before routine and feed this date value to you job.

Posted: Mon Jun 04, 2007 3:17 pm
by kab123
We are on NT platform, we cannot call any shell script.
I wanted to used a parameter that should have a previous month end date at runtime. we use this parameter in the source stage SQL get data for that month only.. any ideas ??

Thanks in advance..

Posted: Mon Jun 04, 2007 4:00 pm
by rcanaran
Have you tried using DOS EXEC (.bat) instead of .sh ?

Posted: Mon Jun 04, 2007 9:31 pm
by ray.wurlod
In a job sequence you can call a routine OR a command/script/BAT file. Provided it's upstream of your Job activity, its return value can be used to supply the parameter value.

Posted: Tue Jun 05, 2007 9:42 am
by kab123
Ray - We are using Batch Control program, we are not using DS sequencer.

Re: Call a Routine in a Parameter value

Posted: Sat Jun 23, 2007 2:51 am
by sachin1
hello, if my interpretation about your doubt is clear, i think you want to use a parameter, just like all other parameters used in JOB-PROPERTIES.

If you want to use this job to be executed from Batch file.
Then i think below could be a solution which is quite cumbersome.
you have to use these coding in JOB-CONTROL tab of Job-properties.

DSGetJobInfo.
DSSetParam
DSRunJob
DSWaitForJob
DSDetachJob, with DSSetParam you can set your parameter at run-time and use it for further processing.

Posted: Mon Jun 25, 2007 6:53 am
by DSguru2B
If you have the info in afile, you can certainly write a small routine to type the value of the file, capture its return and send it back [using DSExecute()]. Call this routine in the job parameter's area,the return value of the routine will then be populated in the job parameter.
I think thats what you were asking right?

Posted: Tue Jul 17, 2007 7:24 am
by ivannavi
DSguru2B said:
Call this routine in the job parameter's area
I have just tested this. Created a rutine (Transform function server routine)that does nothing but assign to "Ans" like this:
Ans="test_text".

Then I put a call to this function into "default value" of a parameter on parameters tab of job properties. The value of the parameter is sent to a seq file.
My function name is Expand. Well it didn't expand. Instead of "test_text", I see "Expand("dummy")".

What am I missing?

Posted: Tue Jul 17, 2007 7:36 am
by chulett
ivannavi wrote:What am I missing?
Nothing, other than the fact that you cannot use a routine in a Job Parameter's default value. You have been led astray. :cry:

Note Ray's answer - Sequence job, Routine Activity stage, downstream Job Activity stage takes the result of the routine call. If you want a 'GUI' solution, that is.

Otherwise, if you are using hand rolled Job Control code, simply call your routine to 'expand' the pathname before you do your DSSetParam calls. You'll need a DEFFUN statement so your job knows it's a 'user defined' routine and not one of its own. Search the site for quite a number of discussion on the subject. You'll need something like:

Code: Select all

DEFFUN Expand(A) calling "DSU.Expand"
Depending on the number of arguments required.

Posted: Tue Jul 17, 2007 8:42 am
by ivannavi
Thank you Chulett very much. I was hoping to avoid involving job sequence in this. I guess DSguru was talking about setting parameters through job sequence.
I know everything about job setting its own parameters not being possible.
But there is always hope... :lol:

Posted: Tue Jul 17, 2007 2:30 pm
by ray.wurlod
You can, of course, do anything in job control (batch) code that a job sequence can do - a job sequence is nothing more than a job control code generator.
Therefore, in your batch code, use DSExecute() to execute your command, script, BAT file, whatever and to capture its output, then use that to provide a value to the job parameter using DSSetParam() before calling DSRunJob().