Mathematics in ExecSh

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

Post Reply
just4u_sharath
Premium Member
Premium Member
Posts: 236
Joined: Sun Apr 01, 2007 7:41 am
Location: Michigan

Mathematics in ExecSh

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Did you try #parameter#+1 ?
-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 »

Even then, don't you need to use expr in the shell script?

Code: Select all

result=`expr $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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes, if indeed there is a shell script involved here. Kind of hard to tell from the original post.
-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 »

just4u_sharath wrote:perform mathematics in ExecSH
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 »

:? 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
just4u_sharath
Premium Member
Premium Member
Posts: 236
Joined: Sun Apr 01, 2007 7:41 am
Location: Michigan

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
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