views:

370

answers:

2

Hello y'all

I'm developing a system that needs to execute Intersystems Cache Terminal Scripts.

When I run a routine inside the regular Caché terminal or a telnet terminal, Cache executes the routine until the end with no problems. But when I try to run the same routine, but this time calling the routine within a Caché terminal Script, Caché disconnects the session after a while. There is no mention at all in the documentation of a "timeout" setting or anything realted to the "" messages i'm getting.

The script is run just like this:

Cterm.exe /console=cn_iptcp:192.168.2.13[23] c:\test.s

1) Does anybody know what may be causing Interystems Caché to disconnected the session in the middle of the run (the session isn't idle either. It regularly outputs status messages to the console)?

2) Any ideas of how to solve it?

Thanks,

Luís Fernando

+1  A: 

Is there a chance it's not a timeout, but some other problem? Possibly a runtime error that's not being trapped/logged?

The main difference between running from the interactive console and as a script is that when you run interactively you're in Programmer Mode, but in the script you're in User Mode. I can't think of any reason off-hand why that would matter, but possibly your code is sensitive to that.

Here's something to try: Write a very simple script that does nothing except write out a character every now and then. Maybe something like this:

F I=1:1:360 H 10 W "." ;Write a dot every 10 seconds for 1 hour

If that gets the timeout too then you know it's the terminal, not your code.

Clayton
+1  A: 

After a while I finally discovered why the session was being terminated. You must wait for something at the end or the script just terminates. But you must be sure that the string you are waiting for is not something that will be printed until the code finishes.

So, I've just changed the program to print "Operation finished" only at the end, and then put the line:

 waitfor "Operation finished"
terminate

Now the program doesn't get interrupted.

Cheers,

Luís

Luis Soeiro