Hi,
It is required to pass a Job parameter to BuildOp Stage. Any prompt help in this regard is highly appreciated.
Thanks & Regards
Pinkesh
Passing Job Parameter to BuildOp Stage
Moderators: chulett, rschirm, roy
Re: Passing Job Parameter to BuildOp Stage
Trypkothana wrote:Hi,
It is required to pass a Job parameter to BuildOp Stage. Any prompt help in this regard is highly appreciated.
Thanks & Regards
Pinkesh
mybuildop -myparam #param_value#
Use the $argument directive to pass a parameter to the buildop.
Vitali.
Pinkesh,pkothana wrote:Hi Vitali,
Thanks for your time.
Actually I'm new to DataStage.
Can you please tell me in detail, where do i give mybuildop -myparam
and where and how do i give $argument directive?
Thanks & Regards
Pinkesh
Here's an example of a buildop that takes one integer parameter called myparam
$operator buildop_with_args
$class buildop_with_args_op
$input inrec auto record (
i:int32;
)
$output outrec auto record (
j:int32;
)
$argument param_value integer -myparam
$action
cout << "###### param_value = " << param_value << endl;
outrec.j = inrec.i + param_value;
$end
Here's an osh script that calls this buildop:
myparam=10
osh "
generator
-schema record
(
i:int32;
)
-records 10
|
buildop_with_args
-myparam $myparam
|
peek
-nrecs 10
-name
;
"
If you plan to use the DataStage GUI:
1. Drop a generic stage on the pallet.
2. Specify
Operator = buildop_with_args -myparam #myparam#
3. Define the input and output interfaces for the buildop stage (input - i:integer, output - j:integer)
4. Define an integer parameter myparam in your job.
In the job log you'll find something like
Generic_5,1: ###### param_value = 10
Vitali.
Re: Passing Job Parameter to BuildOp Stage
Vitali's solutions are particular to directly calling the stage using Orchestrate's programming language. What you probably are asking is way to do it using DataStage's BuildOPS stage. Do this:pkothana wrote:Hi,
It is required to pass a Job parameter to BuildOp Stage. Any prompt help in this regard is highly appreciated.
Thanks & Regards
Pinkesh
While viewing your stage, click on Properties tab. Add a new property, for example:
message | String | blah blah blah | I died for Spain! | Yes |
(enter each in its own column between the |'s.)
Click on Build tab, Logic tab, then Per-Record.
Write something like:
cout << message;
Generate it, and test it out in a job with a row generator creating a row to that stage. Taa daa, you have a dynamic variable that outputs to the log, "I died for Spain!". Now in your job where you use this stage, just pass the job's variable you want to use to this parameter.
-T.J.
Developer of DataStage Parallel Engine (Orchestrate).