Re: Accessing different databases using Informix SE 4.10
Posted in 1996
Nick Colthorpe <nickc@nickcol.demon.co.uk> wrote: :I am using Informix SE 4.10 on SCO UNIX. :I am writing code which will be used on different databases. :All necessary tables are present in both databases. :There are 10 programs which have been written as separate executables- :e.g. :program 1 :main : call <initialisation function> : call <main function> :end main :function <main function> :define like <tablename.colname> :program code :end function :The initialisation function is a separate module which detects which :database is present by doing- : : whenever error continue : database x : if status<0 then : database y : end if :I have several problems :1. The main program won't compile using this code as the define like :does not find the table in the database. :2. Putting database x before the main will compile the main program, but :when you switch databases and run, comes with error- :No system permission or database not found :Implying that the it can't find the directory for database x. This has been answered very reasently in this group. Search on www.dejanews.com if you didn't see it. It's also in the faq at www.iiug.org (i assume, it's some time since I read it). Basically you put the function <main function> in a separate module that starts with a database statement (or more comonly a globals statement spesifying a globals.4gl file that contains a database statement) at the beginning of the module (before any function). This database statement is then used by the compiler to enable you to use the define like <tablename.colname> syntax. Nils.Myklebust@ccmail.telemax.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company