Is it possible to pass a job parameter inside another?

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

yabhinav
Participant
Posts: 37
Joined: Wed Mar 05, 2008 11:54 pm
Location: Hyderabad

Is it possible to pass a job parameter inside another?

Post by yabhinav »

Hi,

Here's what im looking for

let say i have i have a parameter by the name
parcode = 'abc'
and i have another parameter
partranslation = 'alphabets #parcode#'

when i use the parameter partranslation in my transformer it is displaying "alphabets #parcode#" instead of "alphabets abc".
Is there a way in which i can get to DS to parse a job parameter which is within another parameter??

Thanks,
Abhinav
BugFree
Participant
Posts: 82
Joined: Wed Dec 13, 2006 6:02 am

Post by BugFree »

try in transformer --> 'alphabets' :#parcode#
Ping me if I am wrong...
BugFree
Participant
Posts: 82
Joined: Wed Dec 13, 2006 6:02 am

Post by BugFree »

One Parameter value directly into another parameter is not possible. If you have to achieve this, use a sequence activity variable stage to conctinate as mentioned in the earlier post and pass that as to the job.

Is that answers your question?
Ping me if I am wrong...
yabhinav
Participant
Posts: 37
Joined: Wed Mar 05, 2008 11:54 pm
Location: Hyderabad

Post by yabhinav »

wish it was that simple.:(

The example i gave was just to for ur understanding.

Lets say i have something like

partranslation ='select abc from #parcode# table where table.col1 = #par1#
and table.col2 = #par2#'

In this case what am i supposed to do??

Thanks,
Abhinav
miwinter
Participant
Posts: 396
Joined: Thu Jun 22, 2006 7:00 am
Location: England, UK

Post by miwinter »

If you can't achieve this "parameters within parameters" functionality, to produce full SQL on the fly, I think you will have to look instead at doing this upfront and passing the finalised SQL query as one final parameter to the job, with a call to this parameter as your user-defined SQL statement.
Mark Winter
<i>Nothing appeases a troubled mind more than <b>good</b> music</i>
yabhinav
Participant
Posts: 37
Joined: Wed Mar 05, 2008 11:54 pm
Location: Hyderabad

Post by yabhinav »

Well.. tht can be done but im not looking for a work around for this issue..We have a new project coming up which will require us to build a huge number of jobs.. if i can get this to work it greatly reduce our coding effort.

Thanks,
Abhinav
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Rather than using one parameter within another, you can concatenate both in the query as

Select ...
From ....
Where fieldname = '#parameter1# #parmaeter2#'
yabhinav
Participant
Posts: 37
Joined: Wed Mar 05, 2008 11:54 pm
Location: Hyderabad

Post by yabhinav »

Thanks for the suggestion sainath... but the entire query keeps changing depending on the user requirment. So i will not be selecting the same columns everytime.

case when for a specific output i ,might use the query

case 1

select name,deptid from #parcode# table where table.col1 = #par1#
and table.col2 = #par2#'

case 2

select deptname,branch from #parcode# table where table.col1 = #par2#
and table.col2 = #par1#'

So here my entire query is dynamic.

Would appreciate it if u could help me out in such a case!

Thanks,
Abhinav
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

You have options

Use 2 new parameters - say par3 and par4 and pass the corresponding values upfront from the calling sequencer depending on the case.

Use par3 and par4 in place of par1 and par2. So the new parameters will vary dynamically depending on your case.
miwinter
Participant
Posts: 396
Joined: Thu Jun 22, 2006 7:00 am
Location: England, UK

Post by miwinter »

So it's an issue of the columns you are selecting back changing each time then? Parameterise them.
Mark Winter
<i>Nothing appeases a troubled mind more than <b>good</b> music</i>
yabhinav
Participant
Posts: 37
Joined: Wed Mar 05, 2008 11:54 pm
Location: Hyderabad

Post by yabhinav »

@Sainath
i was not able to understand ur solution.. how will the use of two extra parameters solve my problem..

The queries that i posted are a mere sample of the original ones..

The original queries are more than 500 lines each and there are multiple places where i need to replace the parameters..

@miwinter
I dont have fixed number for each query, one query might have 100 columns the other may have 200 so i cant as such parametrize them..
miwinter
Participant
Posts: 396
Joined: Thu Jun 22, 2006 7:00 am
Location: England, UK

Post by miwinter »

I don't see why you can't. Either the parameter passes in a string of 100 column names or a string of 200 column names.
Mark Winter
<i>Nothing appeases a troubled mind more than <b>good</b> music</i>
yabhinav
Participant
Posts: 37
Joined: Wed Mar 05, 2008 11:54 pm
Location: Hyderabad

Post by yabhinav »

ya.. how stupid of me..!! :oops:
will try doing tht
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So, your plan is to have a single job that can process any number of columns from any number of tables? And then what do you need to do with these columns? Hopefully nothing in the way of transformations if you think RCP is going to be your big saviour here. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

yabhinav wrote:The example i gave was just to for ur understanding.
Ur was a city in ancient Babylon; it has not existed for thousands of years and is therefore probably beyond understanding anything - even assuming that a city can understand at all.

The second person personal possessive pronoun in English is spelled "your".

Please strive for a professional standard of written English on DSXchange. It helps particularly those whose first language is not English. English is hard enough to understand without idiosyncratic abbreviations.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply