Surrogate Key Generator questions

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

ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Probably. Try it and let us know. You might also like to time the two approaches with the same set of data. (You may be surprised.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

In the case of hash file, i have used GetHashValueByKey() in user variabl activity stage.
but is there any functions or routines available for reading the value from sequential file?

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

Post by chulett »

'cat' is one simple way. (Windows equivalent would be 'type')
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

chulett wrote:'cat' is one simple way. (Windows equivalent would be 'type')
Is it possible to use cat or type in user variable activity stage?

i need to pass the result of cat or type as parameter to SKG stage.

is it possible using ExecSh?
thanks!
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Craig,

if i give 'type filename' in user variable activity stage,it gives syntax error.(i have tested in datastage 7.5.x installed in windows)

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

Post by chulett »

It's a "shell" command, you can't just type it there and expect it to work. So that means using ExecSH in a routine and then using that routine in the UVA stage which will capture the output of the command when you pass it back out.
-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 »

Without writing a routine you can't execute shell commands directly from a User Variables activity. Use an upstream Execute Command activity.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Actually i have tried with sequential file in stead of hash file.

i have created a sequential file with initial value of 1.

In the sequence i have placed a routine activity stage befor user variable activity stage,

In that routine activity stage i have called ExecSh and passed 'cat filename' as input argument.

In the user variable activity stage i have used 'routine.$ReturnValue as user variable.

While executing , the output SK are starting form 0.

But i am expecting from 1.

In the log ,i am able to see:

Code: Select all

CopyOfskg_seq..JobControl (ExecSH): Executed command: cat /work/crm/tem
*** Output from command was: ***
1

What i feel is $? value for that cat command is passed to the User variable and then thats passed as the key for SKG stage.

In stead of $? value,how to pass the actual result of cat command?

Thanks
pandeeswaran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You're not stripping the mapped newline from the command output. Search DSXchange for examples of how to do so.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Hi Ray,

I have tried like rtn.Returnvalue[1] in the user variable stage.
But still it's starting from 0.

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

Post by chulett »

Angle brackets, not square brackets.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

pandeesh wrote:I have tried rtn.<$ReturnValue> .But it gives "Expected Expression".
I'm curious why in the world you would have tried that? All I meant was for you to replace one set of brackets for another, not completely change the expression. :?

What happens when you try rtn.$Returnvalue<1> there?

Making some assumptions here, one is that "rtn" is the name of the Routine Activity stage in question and that you accidentally left off the $ in your first example. I have no idea what "below symbol" you found in your googling as all I see are two boxes, doesn't really matter though as you are correct in that I meant use <> rather than [] for the array element notation.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

sorry craig!!

For rtn.$ReturnValue<1> only i have got Expected Expression
pandeeswaran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Show us your routine code. In particular, what value are you putting into the Ans variable?

But why are you using a Routine activity at all? Surely an Execute Command activity would be more appropriate?
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