Mulitiple DB's

whwar9739

Member
Hey all,

I am trying to write a program that can work in two different possible environments. One has 2 databases available db1 and db2 for example. The other environment only has db1 available. Below is some code to try to explain what I would ideally like to happen:

Code:
DEF VAR l-var1 AS INT NO-UNDO.
DEF VAR l-var2 AS LOG NO-UNDO.
 
IF NOT CONNECTED(db2) THEN:
   FORM
      "ENTER INFO    " l-var1 SKIP
      "ENTER INFO2  " l-var2 SKIP
   WITH FRAME framea.
 
   UPDATE
      l-var1
      l-var2
   WITH FRAME framea.
END.
ELSE:
   FIND db2.table1 NO-LOCK NO-ERROR.
      /* There is only ever 1 record in table1 */
   ASSIGN
      l-var1 = table1.field1
      l-var2 = table1.field2
   .
END.


Thanks in advance for any help.
 
I have just found myself a workable solution.

When I have both of the db's the program will be run from another program with the following lines:

Code:
FIND db2.table1 NO-LOCK NO-ERROR.
INPUT THROUGH echo VALUE(table1.field1) VALUE(table1.field2).
RUN program.p.

So far this appears to work in either case now.

Thanks to those that have looked.
 
Back
Top