Passing Job Parameter to BuildOp Stage

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
pkothana
Participant
Posts: 50
Joined: Tue Oct 14, 2003 6:12 am

Passing Job Parameter to BuildOp Stage

Post by pkothana »

Hi,
It is required to pass a Job parameter to BuildOp Stage. Any prompt help in this regard is highly appreciated.

Thanks & Regards
Pinkesh
vzoubov
Participant
Posts: 28
Joined: Tue Feb 05, 2002 12:30 pm
Location: Boston, MA

Re: Passing Job Parameter to BuildOp Stage

Post by vzoubov »

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
Try

mybuildop -myparam #param_value#

Use the $argument directive to pass a parameter to the buildop.

Vitali.
pkothana
Participant
Posts: 50
Joined: Tue Oct 14, 2003 6:12 am

Post by pkothana »

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
vzoubov
Participant
Posts: 28
Joined: Tue Feb 05, 2002 12:30 pm
Location: Boston, MA

Post by vzoubov »

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
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.
Teej
Participant
Posts: 677
Joined: Fri Aug 08, 2003 9:26 am
Location: USA

Re: Passing Job Parameter to BuildOp Stage

Post by Teej »

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
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:

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).
Post Reply