Mathematics in ExecSh
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 236
- Joined: Sun Apr 01, 2007 7:41 am
- Location: Michigan
Mathematics in ExecSh
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
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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
"You can never have too many knives" -- Logan Nine Fingers
-
- Premium Member
- Posts: 236
- Joined: Sun Apr 01, 2007 7:41 am
- Location: Michigan
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 tableray.wurlod wrote:Even then, don't you need to use expr in the shell script?Code: Select all
result=`expr $1 + 1`
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.