One Star

job recursive calls

Hello,
How can I call recursively a job (TOS 3.0.4) ?
The component tRunJob does not allow calling the job in which the component is used.
I want to do something like :

MyRecursiveJob =
+subJob1
|
|
OnSubJobOK
|
|
+tDBInput ---If (tMSSqlInput_NB_LINE >0) ---> tRunJob_1(MyRecursiveJob)

Is there a simple way to do that ?

Thanks
7 REPLIES
Employee

Re: job recursive calls

Hello,

yes you can :

1) Create a job that call your "MyRecursiveJob"
2) Call this job from MyRecursiveJob !

But isn't the better way. Are you sure to need to use recursivity ? be aware with memory and exit condition.
One Star

Re: job recursive calls

Hi,
I would like to use recursive calls too, to be able use a hierarchy table with this kind of structure :
hierarchy_table(id_parent number, id_child number)
like the nodes of a tree...
I've been looking several ways with the loop component, but i did not find any solution.
I'm not asking you to do my job, but do you have any idea of how to make easy and not so heavy for the memory, or do i have to use job calls like you explained before?
Just for information, i'm using TOS 3.0.5 with Java and a MySQL 5 db,
Thanks and have a nice day...
One Star

Re: job recursive calls

Hi,
first: did anyone tried Menuet solution? I think this is not possible because different variables are defined as static. This will lead in many problems. This is, from my point of views, a big design issue. So you need to transform your recursive call to an loop. This should (theoretical) always be possible.
If you give some more information about your job, we could try to help you out Smiley Wink
Bye
Volker
One Star

Re: job recursive calls

Sorry I forgot to give you some feedback.
Here it is :
I tried emenuet's solution but it did not work (can't remember the error but when I cliked on the run button I got an error message before the process really started).
Anyway you were right, it was possible to avoid this recursive call with a loop and a global variable.
Thanks
Fred
One Star

Re: job recursive calls

Hello,
Can anybody post the answer here?
MyRecursiveJob =
+subJob1
|
|
OnSubJobOK
|
|
+tDBInput ---If (tMSSqlInput_NB_LINE >0) ---> tRunJob_1(MyRecursiveJob)


I have the same problem, and I do not know how to create and call a recursive job.
Thanks in advance.
Five Stars

Re: job recursive calls

I think the answer to this question is to use tLoop.
tLoop(Iterate)->tRunJob(OnSubJobOK)->SubJob
Where SubJob is your logic to determine if the loop should end.
And maybe adding a Thread.sleep() before the next iteration of the loop may be useful.
This is iteration not recursion.
One Star

Re: job recursive calls

Thank you tal00000 !

It is helpful, I use an iteration and it works.

tLoop--->iterate--->myChildJob

I retrieve the value returned by myChildJob and check it in the tLoop condition (while).

Regards,