merlin_open.pl

{
/* ____________________________________________________________________________
                                           Copyright (C) DataAspects, Inc. 1998
  merlin_open.pl
  Objective: To create a list of databases that are currently 
             open by Merlin and available for searching.
  Actions:
    1. Client merlin_open.pl connects to chemcop.pl running on the 
       Daylight Server and passes it two parameters:
        parm.0  db_exec - orders chemcop to run a command procedure.
        parm.1  'merlin_open' - name of chemcop procedure that executes
                listmerlin, a UNIX script on the Daylight Server.
    2. Chemcop.pl executes listmerlin passing it the name of the ASCII file 
       to write the list of open Merlin pools.
    3. Listmerlin generates a list of all databases currently open 
       by Merlin and writes them to the ASCII file.
    4. Chemcop opens the ascii file into a list and returns it to the client.

  Notes:  listmerlin can be run from the command line:
              input:  listmerlin outlist.txt
              output: asinex97
                      cis
                      medchem95
                      medchem97
                      nci96
                      tsca93
...Pat McGreevy, 18 Feb 99
______________________________________________________________________________ */
char merlinserver[15];
list temp_list;
/* ___________________________________________________________________________ */
/*                   Connect to TRIMrpc Program, chemcop.pl                    */
/* ___________________________________________________________________________ */
merlinserver= "xxx.xxx.xx.xx";
printf("Wait...Connecting to ChemCop on MerlinServer");
if (trap({
   connect(0,"net:chemcop@"^^merlinserver^^"!vtxhost.trm");
   printf("  Connected to Chemcop");
   })){
       bell();
       printf("  Failed to connect to Chemcop");
       break;
       }
/* ____________________________________________________________________________ */
/*  Call ChemCop to run 'merlin_open' block which executes 'listmerlin' script  */
/* ____________________________________________________________________________ */
if (!exec_sql("merlin_open")){                 /* TRIMrpc-remote procedure call */
          /* Call ChemCop to run 'select f2000' block to open merlin list       */
  temp_list= list_open("select results",100);  /* TRIMrpc-remote procedure 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);
    }
}