thor_open.pl

{
/* __________________________________________________________________________
                                         Copyright (C) DataAspects, Inc. 1998
  thor_open.pl
  Objective: To create a list of databases that are currently 
             open by Thor and available for searching.
  Actions:
    1. Client thor_open.pl connects to server chemcop.pl 
       running on ThorServer & passes it two parameters:
        parm.0  db_exec -executes a SQL statement (see trim.h).
        parm.1  'thor_open', a flag instructing chemcop.pl 
                to call the listthor UNIX script.
    2. Chemcop.pl executes listthor, the unix script.  
       listthor takes one parameter as input, the name of the file 
       to write the text output.
    3. listthor generates a list of all databases currently open 
       by Thor and available for searching and writes them to 
       the ascii file.
    5. Chemcop opens the ascii file into a list and returns it to the client.

  Notes: 
         1. listthor can be run from the command line:

            etchem% listthor
              aquire94
              asinex97
              asinex98
              asinex_cd
              asinex_unique
              bioscr98np
              bioscr98sc
              cis
              cis_public
              cis_salts_only
              maybridge97
              medchem95
              medchem97
              medchem98demo
              nci95
              nci96
              salts
              transfer
              tsca93
            ...Pat McGreevy, 18 Feb 99
___________________________________________________________________________ */

char thorserver[15];
list temp_list;

thorserver= "xxx.xxx.xx.xx";
printf("Wait...Connecting to Chemcop on ThorServer");
if (trap({
   connect(0,"net:chemcop@"^^thorserver^^"!vtxhost.trm");
   printf("  Connected to Chemcop");
   })){
       bell();
       printf("  Failed to connect to Chemcop");
       connect(0);
       break;
       }

if (!exec_sql("thor_open")){                          /* RPC Call               */
    temp_list= list_open("select results",100);      /* RPC Call               */
    printf("list_rows(temp_list) = "^^list_rows(temp_list) );
    if (list_rows(temp_list))                        /* display open Thor DBs  */
      list_view3(temp_list,-2,-2,-1,key_f3,opt_highlight,0);
    }
}