jhargett
3rd February 2006, 00:29
Has anybody successfully used AFS to automate the session tfgld1210m000 Global Selection of Batches for Finalization? I have been working on it for a while and can't figure it out.
mark_h
3rd February 2006, 00:50
What is exactly the problem? Maybe if you post your code someone will see the problem. I am not familiar with that sesssion and so far our users want to finalize batches themselves.
jhargett
3rd February 2006, 16:51
OK, here is some code...
main_session = "tfgld1210m000"
stpapi.put.field( main_session, "year.f", str$(year) )
stpapi.put.field( main_session, "btno.f", str$(btno.f) )
stpapi.put.field( main_session, "btno.t", str$(btno.t) )
stpapi.put.field( "tfgld1211s000", "spool.fileout", "/home/jhargett/report.txt" )
stpapi.set.report("tfgld1211s000","rtfgld121111000","ASCIF", last_error)
stpapi.continue.process(main_session, last_error)
if not isspace(last_error) then
output("ERROR: " & last_error)
endif
stpapi.end.session(main_session)
Note: output is a function that writes messages to a log file.
The problem is, the session hangs on the continue process. I am sure it is because I am not handling sub sessions, but I'm not sure what to handle. It looks like this session does not open the report directly, but opens sub-session tfgld1211s000 which contains the report. I'm not actually sending any calls to that session, so do I need to handle it? Also, I think that sub-session then can open tfgld1410s000 for another report. Is it impossible to handle two different sessions that both have reports?
mark_h
3rd February 2006, 20:38
If the first thing the continue on tfgld1210m000 does is start tfgld1211s000 then I would expect to see stpapi.handle.subproc, but not always. You might try this:
spool.device = "ascif"
spool.fileout ="/home/jhargett/report.txt"
main_session = "tfgld1210m000"
stpapi.put.field( main_session, "year.f", str$(year) )
stpapi.put.field( main_session, "btno.f", str$(btno.f) )
stpapi.put.field( main_session, "btno.t", str$(btno.t) )
stpapi.continue.process(main_session, last_error)
I am not sure this will work, but something to try. You probably should have it in debug mode - do you have tfgld1211s000 source code or maybe Qkey(or any source extender program)? Watch what happens with your shell. Hopefully you will see tfgld1211m000 spawn tfgld1211s000. I doubt if this will work, but you never know.
jhargett
4th February 2006, 00:28
I've tried several different variations of this. Handling sub sessions, not handling them and setting the spool.filename and device variables. It still hangs. Debugging this is complicated by the fact that the AFS script is being called from the unix command line using the bshell6.1 program and not from within Baan. Therefore, I can't use the debugger. However, I did try to write a little sample in a Baan session that I could execute in Baan but when I opened it I got an error that said :
Error 506 (Table does not exist) on SELECT
Can not continue in tfgld1210m000 (before.program)
However, when I run this session manually, everything works correctly.
I do have the source to these session, but I still can't figure it out :o
mark_h
4th February 2006, 00:38
If you have the source for tfgld1210m000 you can compile in debug mode. Then create a program in baan to run your function server. By stepping through you Baan developed session you watch tfgld1210m000 run and what it does. You can do the same with tfgld1211s000 - doing this may help figure out what needs to be set. Once that is done then you can fix what is used by the bshell6.1 command - never done that.
jhargett
4th February 2006, 00:48
It has compilation errors. It says it can't find file itfgld0049
It refers to this line: #include "itfgld0049"
mark_h
4th February 2006, 23:42
Sounds like you do not have all the include files. Not sure what to tell you at this point. You might get lucky if you contact Baan - either they might give you code to work with api or maybe provide all the include files.
jhargett
6th February 2006, 16:48
Thanks for looking at this anyway.
ssabaan
6th March 2006, 13:34
If while compiling it is giving that error, it means that itfgld0049 function doesn't exist. IF funtion physically doesn't exist, then u need to arrange it else u will not able to compile it
kmcinc
14th June 2010, 20:06
The problem is that tfgld1211s000 is a 3GL session and therefore cannot be controlled by AFS. More importantly, it's the subsession which calls for the device, not tfgld1210m000. Consequently, you will not be able to set the report device using stpapi.set.report which is preventing us from using the Finalization process in AFS.
kmcinc
14th June 2010, 20:42
The only way I see this working is by adding tfgld1210m000 to a job and activating the job from your AFS session. If you don't want to run it wide open you will have to update the paramters in ttaad503 programmatically.