Before job-subroutine --> need help

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

G.K.K
Participant
Posts: 61
Joined: Tue May 13, 2008 6:54 am

Before job-subroutine --> need help

Post 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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
G.K.K
Participant
Posts: 61
Joined: Tue May 13, 2008 6:54 am

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

Post 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
G.K.K
Participant
Posts: 61
Joined: Tue May 13, 2008 6:54 am

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

Post 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
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

use <CommandActivityName>.$CommandOutput<1> as a derivation of job parameter.

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

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
G.K.K
Participant
Posts: 61
Joined: Tue May 13, 2008 6:54 am

about parameterset derivation

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
G.K.K
Participant
Posts: 61
Joined: Tue May 13, 2008 6:54 am

Post 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
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

In the sequencer
-> Open job properties
-> go to the parameter (x)
-> set the value as the one mentioned
G.K.K
Participant
Posts: 61
Joined: Tue May 13, 2008 6:54 am

Post 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
G.K.K
Participant
Posts: 61
Joined: Tue May 13, 2008 6:54 am

Post 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
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
G.K.K
Participant
Posts: 61
Joined: Tue May 13, 2008 6:54 am

Post 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
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

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