Page 1 of 3

Before job-subroutine --> need help

Posted: Wed Jul 29, 2009 1:16 am
by G.K.K
Hi All,

I have a scenario like:
i have a source sequential file, i need to get the total number of rows for that file in to the transformer stage and need to be load the count in to the database.

i used the before-jobsubroutine by execut shell option and input value as
awk 'END{ print NR}' <filename>.

but i dont know how to get the result of the above command in to the datastage transformer .

could anyone please suggest how to overcome this hurdle.

Thanks in Advance
kamal

Posted: Wed Jul 29, 2009 1:23 am
by ArndW
This would not work with a before-job subroutine. The correct way to implement this is to use a job sequence where you execute your external command(s) and then pass the results to the job as parameters; those can then be used in your transform stage.

how to pass execute command o/p to job as a parameter?

Posted: Wed Jul 29, 2009 5:14 am
by G.K.K
ArndW wrote:This would not work with a before-job subroutine. The correct way to implement this is to use a job sequence where you execute your external command(s) and then pass the results to the job as parameters; those can then be used in your transform stage.
hi ArndW,

i create a job sequence with the executecommand follwed it jobactivity.
i mentioned in the command text box of ExecCommand Tab as,
awk 'END{ print NR}' dir/seq1.txt

it is giving in the output as 5, but i dont know how to pass this output to job as a parameter through job activity?

can u please say clearly how to do it..

Thank u very much for sharing the knowledge.
kamal

how to pass execute command o/p to job as a parameter?

Posted: Wed Jul 29, 2009 5:14 am
by G.K.K
ArndW wrote:This would not work with a before-job subroutine. The correct way to implement this is to use a job sequence where you execute your external command(s) and then pass the results to the job as parameters; those can then be used in your transform stage.
hi ArndW,

i create a job sequence with the executecommand follwed it jobactivity.
i mentioned in the command text box of ExecCommand Tab as,
awk 'END{ print NR}' dir/seq1.txt

it is giving in the output as 5, but i dont know how to pass this output to job as a parameter through job activity?

can u please say clearly how to do it..

Thank u very much for sharing the knowledge.
kamal

Posted: Wed Jul 29, 2009 5:21 am
by priyadarshikunal
use <CommandActivityName>.$CommandOutput<1> as a derivation of job parameter.

And please don't use SMS style words in your post.

about parameterset derivation

Posted: Wed Jul 29, 2009 6:12 am
by G.K.K
priyadarshikunal wrote:use <CommandActivityName>.$CommandOutput<1> as a derivation of job parameter.

And please don't use SMS style words in your post.
hi priyadarshikunal,

You mean <CommandActivityName>.$CommandOutput<1> mention this value as a default value in job parameter which i used in the job?
if not can you please explain clearly.

Thanks in Advance,
kamal

Posted: Wed Jul 29, 2009 6:48 am
by chulett
Use it in the Job Activity stage as the value passed to the parameter you've defined in the job for this purpose.

Posted: Wed Jul 29, 2009 7:04 am
by G.K.K
chulett wrote:Use it in the Job Activity stage as the value passed to the parameter you've defined in the job for this purpose. ...
hi chulett,

i am confused, see i have executecommand stage in jobsequence and followed to it jobactivity. as shown below

executecommand stage ------> jobactivity

i defined parameter in the job sequence as x which is used in the job as well.

now i want to pass a value from executecommand stage output to job as a parmeter.how to do this.

please say clearly.

Thanks for Sharing the Knowledge and helping,
kamal

Posted: Wed Jul 29, 2009 7:32 am
by Sainath.Srinivasan
In the sequencer
-> Open job properties
-> go to the parameter (x)
-> set the value as the one mentioned

Posted: Wed Jul 29, 2009 7:48 am
by G.K.K
Sainath.Srinivasan wrote:In the sequencer
-> Open job properties
-> go to the parameter (x)
-> set the value as the one mentioned ...
hi sainath,

what is the datatype need to mentioned for the parameter x?


thanks
kamal

Posted: Wed Jul 29, 2009 8:15 am
by G.K.K
G.K.K wrote:
Sainath.Srinivasan wrote:In the sequencer
-> Open job properties
-> go to the parameter (x)
-> set the value as the one mentioned ...
hi sainath,

what is the datatype need to mentioned for the parameter x?


thanks
kamal
Hi,

please some one help me in solving this issue..

what is the datatype need to mentioned for the parameter x?


Thanks very much in Advance
kamal

Posted: Wed Jul 29, 2009 8:20 am
by Sainath.Srinivasan
You were on hold for 30 mins and you posted expecting a response.

Please be patient as others have their regular work and posting is done when they get time.

As you are doing a line count, I guess this must be an integer.

Posted: Wed Jul 29, 2009 9:03 am
by chulett
I'm confused as to how this can be so confusing. :?

It's way too late to be worrying about a "data type" as you have (allegedly) already defined the parameter in the job you are running, have you not? And there's no need to define it again in the Sequence job as you are not passing it into the Sequence job from outside but rather deriving it inside the job. So...

Open up the Job Activity stage and find this parameter "X" in the Parameters section. Click once on its Value Expression field to get focus there and then press the Insert Parameter Value button which brings up the External Parameter Helper dialogue. From there find your Execute Command stage, open up its options by clicking on the plus sign next to it and then finally select the $CommandOutput item. Doing so will build the appropriate Value Expression for you automatically and will avoid typing errors.

Lastly just edit it and add the "<1>" at the end. Takes way longer to type up than to actually do.

Posted: Thu Jul 30, 2009 3:26 am
by G.K.K
chulett wrote:I'm confused as to how this can be so confusing. :?

It's way too late to be worrying about a "data type" as you have (allegedly) already defined the parameter in the job you are running, have you not? And there's no need to define it again in the Sequence job as you are not passing it into the Sequence job from outside but rather deriving it inside the job. So...

Open up the Job Activity stage and find this parameter "X" in the Parameters section. Click once on its Value Expression field to get focus there and then press the Insert Parameter Value button which brings up the External Parameter Helper dialogue. From there find your Execute Command stage, open up its options by clicking on the plus sign next to it and then finally select the $CommandOutput item. Doing so will build the appropriate Value Expression for you automatically and will avoid typing errors.

Lastly just edit it and add the "<1>" at the end. Takes way longer to type up than to actually do.
hi,

i am still facing fatal error for the sequence:
job_seq..JobControl (@Job_Activity_0): Controller problem: Error calling DSSetParam(x), code=-4
[ParamValue/Limitvalue is not appropriate]

how to rectify that.

Thanks in Advance,
kamal

Posted: Thu Jul 30, 2009 3:43 am
by Sainath.Srinivasan
It will be very useful to provide actual names of the parameters than talking relative reference names - x and y.

1.) What is the job name?
2.) What is the parameter in the job called as (not the job sequence) ?
3.) What is the name of the executeCommand stage in your sequence ?

If you answer the above questions, someone will be able to assist you better.