dbinderbr
27th September 2002, 17:48
Hello friends,

Yes.. I am still testing AFS funcions, now in a more complex situation (but not so complex).

I had a problem with the usage of stpapi.continue.process and stpapi.zoom.option.

When I used just the zoom.option the process was executed fine and the record was inserted in the main session and another in the subsession. So, I remembered that this subsession was being called by the continue (cont.process) by the use of zoom.to and also there were another lines before the zoom. Because of this, I have to activate the cont.process too, when I used just the zoom.option these lines were not executed.. then my problem began... the code is listed bellow:


function long add.record.to.tudcb000(domain tcmcs.str8 p.esqu,
domain tcmcs.str50 p.desc,
domain tcmcs.str50 p.dcri,
domain tcmcs.str50 p.derr,
domain tuxch.dfor p.dfor,
domain tcmcs.str1 p.sepa,
domain tgyenox p.auto,
domain tudcb.tipo.o p.tipo,
ref string o.mess())
{
stpapi.put.field("tudcbo101m000", "tudcb000.esqu.o", p.esqu)
stpapi.put.field("tudcbo101m000", "tudcb000.desc.o", p.desc)
stpapi.put.field("tudcbo101m000", "tudcb000.dcri.o", p.dcri)
stpapi.put.field("tudcbo101m000", "tudcb000.derr.o", p.derr)
stpapi.put.field("tudcbo101m000", "tudcb000.dfor.o", str$(etol(p.dfor)))
stpapi.put.field("tudcbo101m000", "tudcb000.sepa.o", p.sepa)
stpapi.put.field("tudcbo101m000", "tudcb000.auto.o", str$(etol(p.auto)))
stpapi.put.field("tudcbo101m000", "tudcb000.tipo.o", str$(etol(p.tipo)))
stpapi.enum.answer("tudcbo101m000", "tudcb00001.o", tcyesno.yes)

ret = stpapi.insert("tudcbo101m000", true, o.mess)

if not ret then
ret = stpapi.recover("tudcbo101m000", error.msg)
else
o.mess = "Record Inserted Sucessfully in tudcb000."

execute.tudcbo102s000() |# cont.process
endif

stpapi.end.session("tudcbo101m000")

return(isspace(o.mess))
}

function execute.tudcbo102s000()
{
stpapi.handle.subproc("tudcbo101m000", "tudcbo102s000", "add")
stpapi.zoom.option("tudcbo101m000", 1, "tudcbo102s000", error.msg)
stpapi.continue.process("tudcbo101m000", error.msg)

stpapi.put.field("tudcbo102s000", "tudcb001.cpac.o", "ti")
stpapi.put.field("tudcbo102s000", "tudcb001.cmod.o", "itm")
stpapi.put.field("tudcbo102s000", "tudcb001.flno.o", "001")

ret = stpapi.insert("tudcbo102s000", true, o.mess)

if not ret then
ret = stpapi.recover("tudcbo102s000", error.msg)
else
o.mess = "Record Inserted Sucessfully in tudcb001."
endif

stpapi.end.session("tudcbo102s000")
}


As you can see in bold, if I remove the continue.process the program runs well but anything into the cont.process is not executed, when I run with the stpapi.continue.process the zoom.to$ is executed and the session gets frozen.

Any suggestion?

:confused: Thanks in advance. :confused:

mark_h
27th September 2002, 18:01
Let see if I understand you can zoom to this sub-session or you can click on continue and also get to this sub-session - correct? When you execute the zoom you are turning control over to the sub-session. Try removing the zoom and use the continue since this should also start the sub-session and execute your continue code.

The question I have is why is the zoom code and the continue code different? I am not sure I understand why this sub-session is available for zooming.

Mark

dbinderbr
27th September 2002, 19:57
Hi Mark..

To resume the problem I had..
I have a cont.process section and into this section I have some instructions, after these instructions I have the zoom.to$. When the script reach the zoom.to my program got frozen. But I had to execute the instructions into the cont.process section and also had to control the subsession where I would insert a new record.

I could solve this problem doing the following:
In the main session I have:

cont.process:
|#.... various instructions...
zoom.to$("tudcbo102s000", Z.SESSION, "tudcbo101", "", 0)


In the session with stpapi functions:

|#Firstly I execute the cont.process but I kill the subsession
|#at the time it's called by the zoom.to$
stpapi.handle.subproc("tudcbo101m000", "tudcbo102s000", "kill")
stpapi.continue.process("tudcbo101m000", error.msg)
|#Now I run the subsession with total control of it
stpapi.handle.subproc("tudcbo101m000", "tudcbo102s000", "add")
stpapi.zoom.option("tudcbo101m000", 1, "tudcbo102s000", error.msg)
|#...another instructions...


It worked fine ! Before this change the program used to get frozen when the zoom.to$ was executed.

Thanks once again for your help !