rohan_rege
20th October 2002, 01:16
I am facing a weird problem ...


The following code in AFS is causing me some problems

f1110s000.handle.sub.process( "tfacp1130s000" , "add" )
f1110s000.continue( error.mess )


|to handle subsession tfacp1131s000 from tfacp1130s000

f1130s000.handle.sub.process( "tfacp1131s000" , "add" )
f1130s000.continue( error.mess )


whenever i run my program for some reason the program script for tfacp1130 (which is in debug mode) gets instantiated twice..
thus hanging the program

when i check the start shell...using ps.....i see the two process instances of the same process..ie tfacp1130s000

I dont understand why its forking two processes for tfacp1130 and thus hanging my program

i even tried putting ret=shell("sleep 3" ,SHELL_NO_OUTPUT)
before the statements
f1130s000.handle.sub.process( "tfacp1131s000" , "add" )
f1130s000.continue( error.mess )

but it wudnt work...

when i run in debug mode...stepping thru the above statemnts..it works fine ...but runnning in compile mode ..it hangs as two tfacp1130 are forked one after the another



Rgds
Rohan

mark_h
20th October 2002, 03:06
Hi Rohan!

Not in the office today, but stopped by the board before I logoff for the weekend. I wish I could help you on this one, but I have never seen an error like this. I have seen the FS code work in debug mode and not when compiled normally. In these cases I usually did what you did, and it worked. I do not have a clue on what could be starting the second tfacp1130s000 session. I would call Baan, especially since it works in debug mode. Sorry, but I just do not know.

Mark

rohan_rege
21st October 2002, 18:43
hi mark,

i tried placing the sleep just before the foll code and it worked :
looks like tfacp1130s000 was getting called before the continue from tfacp1110s000

before this i was putting the sleep in after the continue on tfacp1110s000


f1110s000.handle.sub.process( "tfacp1130s000" , "add" )
f1110s000.continue( error.mess )


|to handle subsession tfacp1131s000 from tfacp1130s000

f1130s000.handle.sub.process( "tfacp1131s000" , "add" )
f1130s000.continue( error.mess )


rgds
Rohan

NPRao
21st October 2002, 21:13
I wonder why are you calling the system sleep function when you have that function in the BaaN Tools...

http://www.baanboard.com/programmers_manual_baanerp_help_functions_processes_sleep

-OR-


pno = act.and.sleep( session.code)
reactivate(pno)
suspend(2000)

mark_h
21st October 2002, 21:35
Hi NPR!

The help on act.and.sleep says that it will activate the session and put it in the sleep state. When dealing with api code I do not think this will work, since the sub-session will be controlled by your API session. It is not what you want, you want your sub-session controlled by the main session you call in your api code. Plus when you activate it, it will pop up in your session asking for input and again that is what you do not want. You want everything in the back ground controlled by the Baan sessions to where you only pass data.

I am not sure the sleep command on one of the processes would work. I am also sure you could get the process number to try it on, but that is more work that just using the UNIX sleep command.

I certainly do not like using the UNIX sleep command, but that appears to be the only way to keep things in sync at times. And since my company does not own source I do not have much choice on what I try at times.

Mark