I have created a routine Before/After Subroutine .
It has two parametrs: InputArg and ErrorCode
It's code is
ErrorCode = 0 ;* set this to non-zero to stop the stage/job
Cmd ='SELECT UNKNOWN_NUM FROM ':InputArg:';'
Call DSExecute('UV',Cmd,Value,Error);
ErrorCode =Value
InputArg will have a hash file name.
My requirement is i have to return the Routine output i,e value of ErrorCode. If that value is not 0 then i have to trigger the output link.
When i tried to test the routine, test button is disabled.
I used a routine activity stage namely "hash_sales_rep_key" and called this routine.In the trigger tab i used Custom -(Conditional) and the expression is hash_sales_rep_key.$ReturnValue>0. The problem is i checked the value for 'SELECT UNKNOWN_NUM FROM ':InputArg:'; It is 0. But the output link for the routine activity is triggering. It means hash_sales_rep_key.$ReturnValue>0 is true. How is this happening. Can you please tell me where i went wrong.
Thanks
Routine return value
Moderators: chulett, rschirm, roy
Routine return value
Aim high
-
- Participant
- Posts: 18
- Joined: Mon Nov 25, 2002 3:23 am
- Location: Switzerland
Re: Routine return value
Hello
You probably wrote your routine as a Before/After routine. In order to get more flexibility, you can redefine your routine as a Transform function. Then the ErrorCode can be passed either as a parameter as you do now or within the Ans. The Ans is the code returned by the activation of the routine during runtime.
Good luck
Jean-Pierre
You probably wrote your routine as a Before/After routine. In order to get more flexibility, you can redefine your routine as a Transform function. Then the ErrorCode can be passed either as a parameter as you do now or within the Ans. The Ans is the code returned by the activation of the routine during runtime.
Good luck
Jean-Pierre
nkln@you wrote:I have created a routine Before/After Subroutine .
It has two parametrs: InputArg and ErrorCode
It's code is
ErrorCode = 0 ;* set this to non-zero to stop the stage/job
Cmd ='SELECT UNKNOWN_NUM FROM ':InputArg:';'
Call DSExecute('UV',Cmd,Value,Error);
ErrorCode =Value
InputArg will have a hash file name.
My requirement is i have to return the Routine output i,e value of ErrorCode. If that value is not 0 then i have to trigger the output link.
When i tried to test the routine, test button is disabled.
I used a routine activity stage namely "hash_sales_rep_key" and called this routine.In the trigger tab i used Custom -(Conditional) and the expression is hash_sales_rep_key.$ReturnValue>0. The problem is i checked the value for 'SELECT UNKNOWN_NUM FROM ':InputArg:'; It is 0. But the output link for the routine activity is triggering. It means hash_sales_rep_key.$ReturnValue>0 is true. How is this happening. Can you please tell me where i went wrong.
Thanks
As Jean-Pierre stated, a Before/After subroutine cannot be tested like a function. I usually write and test my routine as a function by changing the parameters around to match the function format, and when I'm ready I cut-and-paste the code portion (because by switching from routine to function and vice-versa you will lose all of your code). Apart from that slight anomaly Jean-Pierre's method works like a charm.