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

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 placed a routine activity stage initially.
In that i have selected ExecSh as routine.
In the InputArg i have passed 'cat filename.txt'.
Next in the user variable activity stage , i have used rtn.$ReturnValue <1>.
But still the value is being passed as 0 not 1.

Is there any mistakes in my design?

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

Post by ray.wurlod »

Yes you have (erred in your design).

ExecSH is a "before/after subroutine". This type of routine is not suitable for use as a Routine activity - only "transform functions" can be used. The reason for that is that before/after subroutines do not have a mechanism for returning a value.

But, as stated, you would be better off eschewing the Routine activity completely, preferring an Execute Command activity. This will return the output of the command completely (including any newline characters).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That probably came from me, I believe I failed to translate ExecSH properly to DSExecute when we entered the Routine Realm.
-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 »

Hi,

I have replaced the routine activity stage with Execute command activity stage.
I have given the command as cat filename.

in the user variable activity stage, i have used rtn.$CommandOutput where rtn is the execute command stage name.

It's working fine and the SKG are generated properly.

But still i am wondering, if i give rtn.$CommandOutput<1> it throws expected expression.

In the runtime the job gets aborted if i use within a single quote'rtn.$CommandOutput<1>' with the below error:

Code: Select all

CopyOfCopyOfskg_seq..JobControl (@rtn): Executed: cat /work/crm/tem
Reply=0
Output from command ====>
1
CopyOfCopyOfskg_seq..JobControl (@Job_Activity_3): Controller problem: Error calling DSSetParam(key), code=-4
[ParamValue/Limitvalue is not appropriate]
pandeeswaran
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

it seems the angle bracket notation rtn.$CommanOutput<1> is not supported in 7.5.x.
Then i need to stick with Convert().

A long discussion!!Lot of learning for me!

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

Post by chulett »

Did you search for "ParamValue/Limitvalue is not appropriate"? That would tell you that (for whatever reason) the string still had a Field Mark in it. I'll also note that the angle bracket notation certainly is supported in any release, it might just be the "where" of it that has changed over time.
-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 »

so in the user variable activity stage ,we need to mention 'rtn.$CommandOutput' (with single quote).Am i correct?

Without single quotes, it throws Expected Expression.

So i need to concentrate on removing @FM.
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I sincerely doubt you need to quote anything. And you really shouldn't be typing this in by hand but rather using the "External Parameter Helper" you can find under the "..." button so you can pick them from the list of valid values. Feel free to edit them afterwards (a little) but let it start you off.
-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,

I am still wondering how it works perfectly while using rtn.$CommandOutput alone.

The problem arises only while introducing angle brackets.
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Then skip the introduction. And I thought you still had an error 4 with the parameter so not sure how that is "working perfectly". :wink:

If the angle bracket notation is not supported there, use the EReplace() or Convert() functions that I'm sure we've already mentioned to strip the @FM.
-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 »

You could replace the angle bracket notation with a Field() function.

Code: Select all

Field(rtn.$CommandOutput, @FM, 1, 1)
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 »

Thanks Ray!!

I have tested with two different expressions in User variable Activity Stage.

Test1:

In the user variable activity stage, i have used rtn.$CommandOutput.
Initially i have stored 2 as the sequential file where we keep track of the SK.
In the first run:

Code: Select all

CopyOfCopyOfskg_seq..JobControl (@rtn): Executed: cat /work/crm/tem
Reply=0
Output from command ====>
2
Since there were 3 records in the input file it generates Sk from 2 to 4 and write 5 in to the file.

In the second run:

Code: Select all


CopyOfCopyOfskg_seq..JobControl (@rtn): Executed: cat /work/crm/tem
Reply=0
Output from command ====>
5

CopyOfCopyOfskg_seq..JobControl (@Job_Activity_3): Controller problem: Error calling DSSetParam(key), code=-4
[ParamValue/Limitvalue is not appropriate]
Since @FM hasn't removed , it throws the error.
But i am wondering why it ran successfully in the first run.
It's aborting in the second run only.

Test2:
In the User Variable activity stage, i have used field function as you mentioned.
It's running fine without any issues even in the successive runs too.
Thanks
pandeeswaran
Post Reply