User VAriable Activity

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

Post Reply
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

User VAriable Activity

Post by PRIYARAJ »

Hi All,

I have defined multiple User Variables in my sequence.I am getting some parameters from Hash Table using UtilityHashLookup. I have a User variable "A" which is extracted from Hash table and its value is abc/def/ghi.
I have another User variable "B" and its avlue is abc/def/ghi/jkl/mno/.
Since part of "B" has A's value,I need to concatenate A with B.Can anyone please give me the Correct format of Concatenating the User Variable "A" with hardcoded value of "B".
So that the output of "B" would be abc/def/ghi/jkl/mno

Thanks in Advance!
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

How much help do you need? You use a colon to concatenate so simply mention the two field names separated by a ":".
-craig

"You can never have too many knives" -- Logan Nine Fingers
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Post by PRIYARAJ »

Hi,

It looks very simple.But it doesn't work and I tried lot of other combinations.I In User Variable activity,under Name tab for Variable "B" the expression which I gave was 'A':'/jkl/mno/pqr'.The outbound that I get is A/jkl/mno/pqr.
But the Value of variable A is not Concatenated.
I even tried A:'/jkl/mno/pqr' but it says Variable 'A' not defined.
It is not that I don't know to use concatenation but I wanted to use a varibale within an expression for another variable.

Thanks!
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You can't quote a field name, it will end up as a literal as you found. And you need to qualify the field name with the stage name, StageName.A would be more appropriate if you've got the field name correct.
-craig

"You can never have too many knives" -- Logan Nine Fingers
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Post by PRIYARAJ »

I did try the expreesion UserVariables.A:'/jkl/mno/pqr' for varaible "B" but it says Variable 'UserVariables.A' not defined.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Then you need to find out what the stage/field name really is. The 'Insert Parameter' helper widget should allow you to pick it from the GUI rather than you hand typing it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Post by PRIYARAJ »

Yes,I even tried to select from "Insert Parameter' but it didn't show me the list of User Variables in there to select.So I dont think so I can use one UserVariable within the Expression of other Variables.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You can, but now I'm confused. Where exactly are you trying to concatenate these two UserVariables stage values together?
-craig

"You can never have too many knives" -- Logan Nine Fingers
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Post by PRIYARAJ »

Inside the User Variable Activity,I want to Concatenate One User Variable with the expression value for another User Varaible.
Inside User Variable Activity I have two Variables :
1.ETLROOTDIR (The expreesion for this variable is extracted from hashtavle using UtilityHashLookup ) which is /mdm/dev/datastage/customer(output value).This will differ based on the ENV Parameter that we pass.For TEST Env it would be /mdm/test/datastage/customer.
2.ShFileDir (The expression for this is hard coded as /mdm/dev/datastage/customer/SCRIPTS/OUTBOUND.I thought instead of hardcoding the entire expression,I would use ETLROOTDIR variable for '/mdm/dev/datastage/customer/' and concatenate with '/SCRIPTS/OUTBOUND')
Right now,I had to manually Change ShFileDir expression whenever we migrate from one environment to another environment.So that is why I thought I would make use of ETLROOTDIR in ShFileDir which is extracted appropriately based on each environment .
So IF I concatenate ETLROOTDIR with ShFileDir then I dont have to manually change the expression value for ShFileDir in each environment
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A User Variables activity derivation can not access other variables in the same User Variables activity. I don't like it either (or the need to add a row to the grid manually) but that's how things are. You need a second, downstream, User Variables activity that can use the variables from the first.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Post by PRIYARAJ »

Thanks a lot for all your Quick Replies.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sorry, I was under the impression you had two UserVariable stages for some reason, which is why I said you could use one from another. You could also concatenate them together when you use them rather than in the stage itself.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply