Output values of one job used as Parameter values in another

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Output values of one job used as Parameter values in another

Post by DS_MJ »

Hello:

Would like to use the output values of one job as my parameters input values in the second job.

Systems environment
Ascential Datastage(7.5.1A) running on Linux
R/3 PACK (5.2 unicode) running on Linux
SAP R/3 4.7 unicode running on AIX (64bit) Squadron server
DB2 IW running on either AIX or MVS.

Example:

JOB 1
Extract the the values of the two columns from DB2 API table into a Hashed file.
DB2 ----> Transform ---> Hashed File

OUTPUT of the 2 columns is as follows:
Col_A = 20060906
Col_B = 72000

JOB 2
We want to extract data from ABAP Extract from the value greater then or equal to the output values in the Hashed file. Hence want the values to be input values of the parameters in this job.

ABAP Extract ------> Transform -----> Seq File
Parameters and values defined
#Col_Dt# = 20060906
#Col_Tm# = 72000

Use these parameters in ABAP Extract to extract data.

How do I pass on Values as Parameters in this 2 Job?

Can one evaluate this return value in Sequencer and pass them to the second job via UserVariables Stage. If so can one give an example...?

Would appreciate any ideas on how to accomplish this.

Thank you
Thanks in advance,
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

It depends on how you plan to control the execution. If its via a sequencer then you can use user variable activity or even a routine activity to open the file where you have your parameter values. In this case you will need to write your date and time to a sequential file instead of a hash file.
If you are planning to control the execution via a unix script then in that case also you need to write to a seq file, read the file in your script and pass it as a parameter to your second job.
Regards,
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Post by gateleys »

I had this information with me from this forum. I could not locate it again, but the posting is with me. It goes as follows-

gateleys

Use UtilityRunJob to kick off a job from another job, and passing those values as parameter.
Example:
Lets say that you need to pass V1 and V2 to Job5. And lets say that you already had Job5.

Develop a job - Job1- that read the SQL Server table and create a sequential file with two columns - C1, C2- that should have the value that you will pass as parameter values.

Second develop a job -or add thsi stages in previous job- that will contain three stage: a Seq files stage, a transformer and another Seq file Stage, same order, conected with Links. Read the sequential file from previous step, in the first Seq Files Stage.

The last Seq File declare a column as dummy.

in the transformer fill the derivation to the dummy column with:

UtilityRunJob('Job5',"Par1=":C1:"|Par2=":C2, 0,0)
This job will execute Job5 with Parameter Par1 with using value C1 and Parameter Par1 using value C2 .

Notice that you must create and string to define all your parameter as :

" Paremeter = value | parameter2 = value | paramenter3 = value | ...| ParamenterN = ValueN"

the two remaining values: 0,0 mean Unlimeted Row limit ( Process all rows) and Unlimited warning ( Accept all warning ). You should change this according to your needs.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Pretty smooth gateleys :wink:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Post by gateleys »

DSguru2B wrote:Pretty smooth gateleys :wink:
Honestly DSguru (you've been promoted), I keep certain useful postings saved in my system so that I can refer to them when required. I started to do this since sometimes, you cannot get to the post that you have read sometime back. For example the above post; even when I copy and paste certain lines in 'search', it does not return any post. So, could not provide the link, but rather opted to paste what I had. So, no smooooth operation going on from my side.

The lousy part is that DS_MJ has not responded if the technique served his purpose.
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Post by DS_MJ »

Thanks gateleys and DSguru2B really appreciate your prompt replies.

Sorry Gateleys I thought I should try it first and then reply back. But maybe I should have responded earlier .... :?


I did what you said.
1. Develop a job - Job1- that read the SQL Server table and create a sequential file with two columns - C1, C2- that should have the value that you will pass as parameter values.

2. In the same job added the the transform and the Seq File.

3. Have Job 5 which has the following stages:

Abap Extract ----> Transform ----> DB2 Table


Need help with the following that you mentioned: How do I set the parameters par1 and par2...?

[/quote]
Notice that you must create and string to define all your parameter as :

" Paremeter = value | parameter2 = value | paramenter3 = value | ...| ParamenterN = ValueN"
[quote]
Thanks in advance,
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

OOPS gateleys, he heard ya. just kidding guys.
True, what i do is just add the post to my favourites. That really helps me.
chao :P
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

And thanks for the promotion gateleys but i dont deserve it yet, still a long way to go. Thanks for the encouragement though :wink:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Post by gateleys »

DS_MJ wrote: How do I set the parameters par1 and par2...?
With your values of Col_A and Col_B. Aren't they supposed to be the param values? :idea:

gateleys
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Post by DS_MJ »

gateleys wrote:
DS_MJ wrote: How do I set the parameters par1 and par2...?
With your values of Col_A and Col_B. Aren't they supposed to be the param values? :idea:

gateleys
yes values of Col_A and Col_B in Job 1 are suppose to be the param values for Job5 parameters. Let me check my job ......!!!
Thanks in advance,
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Post by DS_MJ »

Notice that you must create and string to define all your parameter as :

" Paremeter = value | parameter2 = value | paramenter3 = value | ...| ParamenterN = ValueN"
My job is failing because I am not doing the above correctly....!!! :(


This is what I have done.

Job 1 (Runs Fine)
Db2 Table ----> Transform ----> Seq File

JOB 2 ( Job finishes with 2 warnings)

Seq File (from previous job) ---> transform ---> Seqfile (Dummy file one column)

Parameters defined:
SeqFileName
DummyFile

In the Transform did the following:

UtilityRunJob ('JOB_5', "Par_1=" : COL_A : "Par_2=" : COL_B, 0,0)

Got 2 WARNING messages in director:

1 - Jobname.xfm (UtilityRunJob): Job Failed: JOB_5
2 - JobName.Dummy.dummy_out: nls_map_buffer_out() - NLS mapping error, row 1 (approx), row = ""JOB_5=3"


JOB 5 (Job Failed)

This job is a simple extract job using the output values of JOB 1 as params to extract the data.

ABAP EXTRACT ----> Transform ---> Seq File

Parameters defined:
PAR_1 = Left the value field blank since it has to be COL_A value
PAR_2 = Left the value field blank since it has to be COL_B value
Output_File

In the Director
Jobname: All Job Parameters must have values


Thanks and sincerely appreciate your patience
Thanks in advance,
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

UtilityRunJob ('JOB_5', "Par_1=" : COL_A : "Par_2=" : COL_B, 0,0)

Code: Select all

UtilityRunJob (JOB_5, "Par_1=" : COL_A : "Par_2=" : COL_B, 0,0)
Sam
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Seems to be more about the fact that the 'parameter value pairs' must be pipe delimited as gateleys showed in his post... and DS_MJ is not doing that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Post by DS_MJ »

Hello chulett
chulett wrote:Seems to be more about the fact that the 'parameter value pairs' must be pipe delimited as gateleys showed in his post... and DS_MJ is not doing that. ...
The params

UtilityRunJob ('JOB_5', "Par_1=" : COL_A : "Par_2=" : COL_B, 0,0) is working fine without the "|" in my job . I am able to pick the param values and put it in the dummy file when I run JOB2

This is what I see in the director log:
JOB2 (UtilityRunJob): Setting Job Param - COL_A Setting to 20050906 COL_B = 72000

However how do I get JOB5 to read the param values that JOB2 puts in the dummy file.....? JOB2 finishes with warning that JOB5 failed.

In JOB5 when I look in director it says in the director log "JOB5.All Job Parameters must have values"

I want the JOB2 that picks the COL_A and COL_B values to be put into JOB5 and not just in the dummy file. Its not putting the values in JOB5 hence JOB5 is failing.

Thanks in advance.
Thanks in advance,
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Job5 is not able to pickup the parameters because it is not in the format that it requires. It should be pipe delimited. Gateleys provided you with the correct format.
gateleys wrote: Notice that you must create and string to define all your parameter as :

" Paremeter = value | parameter2 = value | paramenter3 = value | ...| ParamenterN = ValueN"
In order to bring your parameters in that format, you have to use the command that gateleys provided

Code: Select all

UtilityRunJob('Job5',"Par1=":C1:"|Par2=":C2, 0,0) 
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply