Page 3 of 3

Posted: Thu Jun 30, 2011 10:01 pm
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

Posted: Thu Jun 30, 2011 10:34 pm
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).

Posted: Thu Jun 30, 2011 10:46 pm
by chulett
That probably came from me, I believe I failed to translate ExecSH properly to DSExecute when we entered the Routine Realm.

Posted: Fri Jul 01, 2011 1:51 am
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]

Posted: Fri Jul 01, 2011 3:02 am
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!

Posted: Fri Jul 01, 2011 6:34 am
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.

Posted: Fri Jul 01, 2011 9:58 am
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.

Posted: Fri Jul 01, 2011 10:13 am
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.

Posted: Fri Jul 01, 2011 12:47 pm
by pandeesh
Craig,

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

The problem arises only while introducing angle brackets.

Posted: Fri Jul 01, 2011 2:00 pm
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.

Posted: Fri Jul 01, 2011 6:36 pm
by ray.wurlod
You could replace the angle bracket notation with a Field() function.

Code: Select all

Field(rtn.$CommandOutput, @FM, 1, 1)

Posted: Mon Jul 04, 2011 1:28 am
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