Ilansu
24th November 2002, 10:55
Hi.

I'm trying to use AFS with the Maintain outbound data.
I have a problem with the Release outbound report.

I have source codes .

I made some changes to the tdilc4202 script, so if the api.mode is true it should ignore the open/close of the reports.

This is my AFS code:

Get.orno.pono.to.update()

stpapi.put.field("tdilc4101m000","runnumber",run.number)
stpapi.put.field("tdilc4101m000","k.o.order","7")
stpapi.put.field("tdilc4101m000","ordernr",str$( orno))
stpapi.handle.subproc("tdilc4101m000","tdilc4102s000","add")
stpapi.continue.process( "tdilc4101m000", e.mess )
stpapi.put.field("tdilc4102s000","tdilc401.koor","7")
stpapi.put.field("tdilc4102s000","tdilc401.orno",str$(orno))
stpapi.put.field("tdilc4102s000","tdilc401.pono",str$(pono))
stpapi.put.field("tdilc4102s000","tdilc401.qstr",str$(quan))
stpapi.insert( "tdilc4102s000", 1, e.mess )
stpapi.handle.subproc("tdilc4101m000","tdilc4102s000","kill")
stpapi.end.session("tdilc4102s000")

stpapi.handle.subproc("tdilc4101m000","tdilc4202s000","add")
stpapi.zoom.option( "tdilc4101m000", 1, "tdilc4202s000", e.mess )

if isspace(e.mess) then
stpapi.put.field("tdilc4202s000","runnumber.f",run.number)
stpapi.put.field("tdilc4202s000","runnumber.t",run.number)
stpapi.put.field("tdilc4202s000","koor.f","7")
stpapi.put.field("tdilc4202s000","koor.t","7")
stpapi.put.field("tdilc4202s0000","orno.f",str$(orno))
stpapi.put.field("tdilc4202s000","orno.t",str$(orno))
stpapi.put.field("tdilc4202s000","prdf.f",str$(date.num()))
stpapi.put.field("tdilc4202s000","ddta.f",str.ddta.f)
stpapi.put.field("tdilc4202s000","ddta.t",str.ddta.t)

stpapi.continue.process( "tdilc4202s000", e.mess )
endif

stpapi.handle.subproc("tdilc4101m000","tdilc4202s000","kill")
stpapi.end.session("tdilc4202s000")
stpapi.end.session("tdilc4101m000")

if isspace(e.mess) then
field.update
db.update(table,db.retry)
commit.transaction()
endif


The problem is at the last continue.process.
The outbound is released but e.mess="Process in gone" and my field.update is canceled.

The changes i made to tdilc4202 are like this:

|if not open.report(1,"",1,language$,1) then
if not api.mode and not open.report(1,"",1,language$,1) then
if a_close.report and not api.mode then
if not COUNTER and not BACKFLUSH then
close.reports(2)
else
close.reports(0)
endif
endif
after.choice:
if (background or job.process) and a_end.prog then
execute(end.program)
endif

choice.end.program:
before.choice:
itfglddll4010.invoke.background.after.session()

The error message comes from:
itfglddll4010.invoke.background.after.session()

Thanks
Ilan S

mark_h
24th November 2002, 23:16
I have had function server problems when programs executed the end.program event. Is everything in the itfglddll4010.invoke.background.after.session() subroutine getting executed correctly? If so then why not do this?


if isspace(e.mess) or strip$(e.mess)="Process is gone" then
field.update
db.update(table,db.retry)
commit.transaction()
endif


I have this in a couple of my function servers. In some I also check for Command Cancelled - if I recall correctly. In both cases I checked to make sure everything worked okay. So as long as everything worked okay then I see do not see a reason to skip your update statements.

Hope this helps.

Mark

Ilansu
25th November 2002, 09:48
Mark Hi.

Surely I could ignore this specific message but I was looking for the reason to the problem.

The command cancelled comes from the " choice.again() " function.

Thanks
Ilan S

mark_h
25th November 2002, 14:15
Since I do not own code I have never been able to trace it down to a specific section. I did notice that I got it from the sessions that did an execute(end.program) command. The only thing I can figure is that when the program ends and returns control to the function server the the program that you called is already gone. And since you are returning to the stpapi command you get the error. And in some cases a stpapi.end.session will hang becuase the program is already gone. Is this making sense? I really think it is just the fact that the stpapi commands expect the session to still be there in the background and the end.program section stops this.

Mark

Ilansu
25th November 2002, 15:19
Thanks :D :D :D

Ilan S