s-news
[Top] [All Lists]

Re: S-Plus process does not terminate

To: "David Homiak" <dhomiak@xcaliber.com>, <s-news@lists.biostat.wustl.edu>
Subject: Re: S-Plus process does not terminate
From: "Patrick Agin" <agin.patrick@sympatico.ca>
Date: Sun, 18 Nov 2001 17:37:36 -0500
References: <1BDB01B13696D411BD6200D0B7C854EA021070FE@chi-prd-mail1.xcaliber.com>
Thank you for your answer David, unfortunately your solution doesn't apply
to my problem. I don't use import.data(). Actually, what I'm trying to do is
very simple:

in Access:
********
'launch S-Plus:
    ShellWait "D:\Program Files\splus45\cmd\SPLUS.EXE"

where ShellWait is:

Public Sub ShellWait(Pathname As String, Optional WindowStyle As Long)
    'Initialize the STARTUPINFO structure:
        ...
    ' Start the shelled application:
    ret& = CreateProcessA(0&, Pathname, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS,
0&, 0&, start, proc)
    ' Wait for the shelled application to finish:
    ret& = WaitForSingleObject(proc.hProcess, INFINITE)
    ret& = CloseHandle(proc.hProcess)

The S-Plus process is started at soon as the CreateProcessA API is called.
The statement (WaitForSingleObject API) is the next executed and waits for
S-Plus to terminate. In the S-Plus window, I can do some calculations and
type q() when I'm finished. At that point, I expect Access to run the next
statement (CloseHandle API) but it never happens, probably because S-Plus
never terminates. In effect, the S-Plus application disappears from the
'Applications' tab of the Task Manager but not the process SPLUS.EXE itself
from the 'Processes' tab of the Task Manager. That's why it freezes there,
until I end the SPLUS process manually. Notice that it has nothing to do
with the type of calculations I do in S-Plus before quitting: even if I quit
at the very beginning of the session, it freezes. Maybe does it exist a
switch that I must add to the commandline call to S-Plus, I looked for
something like this in the documentation but found nothing. I'm puzzled.

I'm using S-Plus 4.5 under Windows NT (doesn't work neither under Windows
2000)

Thank you again,
Patrick



----- Original Message -----
From: "David Homiak" <dhomiak@xcaliber.com>
To: "'Patrick Agin'" <agin.patrick@sympatico.ca>
Sent: Friday, November 16, 2001 10:04 AM
Subject: RE: [S] S-Plus process does not terminate


> If you are using import.data() within S-Plus, then use the (undocumented)
> argument
> Display = F, in the import.data() command
>
> e.g.
>
> import.data(FileName = "MS Access 97 Database",
> FileType = "ODBC",
> ColNames = "",
> Format = "",
> TargetStartCol = "1",
> DataFrame = "Categories",
> Display = F,
> NameRow = "",
> StartCol = "1",
> EndCol = "END",
> StartRow = "1",
> EndRow = "END",
> Delimiters = ", \\t",
> SeparateDelimiters = F,
> PageNumber = "1",
> RowNameCol = "",
> StringsAsFactors = "Auto",
> VLabelAsNumber = F,
> DatesAsDoubles = F,
> Filter = "",
> OdbcConnection = "DSN=MS Access 97 Database;DBQ=C:\\Program
> Files\\Microsoft Visual Studio\\VB98\\NWIND.MDB;DefaultDir=C:\\Program
> Files\\Microsoft Visual Studio\\VB98;DriverId=281;FIL=MS
> Access;MaxBufferSize=2048;PageTimeout=5;",
> OdbcSqlQuery = "Select * from Categories")
>
> The import.data() command shows the imported data
> in a GUI grid window - it is the handle to this window
> that prevents the operating system from shutting S-PLUS
> down.  Using the "Display = F" argument to import.data
> prevents this GUI grid window from being displayed.
>
> This tip above from Steve McKinney at Insightful solved our problem of
> S-Plus not terminating.
>
> Dave Homiak
>
>
> > -----Original Message-----
> > From: Patrick Agin [SMTP:agin.patrick@sympatico.ca]
> > Sent: Thursday, November 15, 2001 5:45 PM
> > To: s-news@lists.biostat.wustl.edu
> > Subject: [S] S-Plus process does not terminate
> >
> > Hi,
> >
> > I shell out from Access a S-Plus process and wait until it terminates
> > before executing the next statement. I use for that purpose the code
found
> > in the Microsoft Knowledge Base Articles (Q129796); you can also find
> > similar code at <http://www.mvps.org/access/api/api0004.htm> . I tested
> > the code with an Excel process and it works well (my next statement in
> > Access is executed only when I close Excel). When I try with S-Plus, it
> > doesn't work: S-Plus opens, the Task Manager shows under the
> > 'Applications' tab that the S-Plus application is running and Access
> > application is not responding - waiting for S-Plus to terminate, now I
> > close S-Plus, the Task Manager does not show anymore the S-Plus
> > application but Access is still not responding, so it freezes at that
> > point. The Task Manager shows under the 'Processes' tab a process called
> > SPLUS.EXE that is still there. Why? Only when I end this process
manually
> > does Access respond and execute my next statement.
> >
> > Anyone has an explanation?
> >
> > Thank you very much,
> > Patrick


<Prev in Thread] Current Thread [Next in Thread>