Page 1 of 1

Mathematics in ExecSh

Posted: Thu Feb 07, 2008 7:11 pm
by just4u_sharath
My Scenario is, i have to pick a parameter and update the same parameter adding 1 to it. How can i perform matematics in ExecSh after SubRoutine.i,e how can i add 1 to the parameter. if i use parameter+1, then the Updates value appears as parameter+1. Please help

Posted: Thu Feb 07, 2008 7:37 pm
by chulett
Did you try #parameter#+1 ?

Posted: Thu Feb 07, 2008 8:57 pm
by ray.wurlod
Even then, don't you need to use expr in the shell script?

Code: Select all

result=`expr $1 + 1`

Posted: Thu Feb 07, 2008 9:03 pm
by chulett
Yes, if indeed there is a shell script involved here. Kind of hard to tell from the original post.

Posted: Thu Feb 07, 2008 11:47 pm
by ray.wurlod
just4u_sharath wrote:perform mathematics in ExecSH

Posted: Fri Feb 08, 2008 7:30 am
by chulett
:? I can read. Still unclear as there's no specific mention of any script. Sounded to me that all they put in the 'Input Value' field after setting the 'After-job subroutine' to ExecSH was 'parameter+1'. Hence the rather generic answer I gave in the hopes of garnering something more specific when that led to more questions.

Posted: Fri Feb 08, 2008 4:47 pm
by just4u_sharath
ray.wurlod wrote:Even then, don't you need to use expr in the shell script?

Code: Select all

result=`expr $1 + 1`
In the after-subroutine how can we write specify unix Expr. we only give parameters and #parameter#+1 is not working when updating a field in oracle table

Posted: Fri Feb 08, 2008 4:59 pm
by ray.wurlod
So this is user-written after-job subroutine, not ExecSH? This is new information. Forgive us for being tricked by your Subject!

I always use DSGetParamInfo() to retrieve the value of a job parameter in a user-written routine.

Others will tell you that it is not strictly necessary; I find that it gives better "idiot proofing", for example against the future when someone removes that parameter from the job.

Having retrieved the parameter value (use DSJ.ME as the job handle argument), assign its value to a variable, to which you can then add 1 provided that the value is numeric.