Kbase P15127: How to use CREATE ALIAS to re-use code for 2 databases
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  30/10/2003 |
|
Status: Verified
FACT(s) (Environment):
Progress 8.x
FACT(s) (Environment):
Progress 9.x
FIX:
Example using CREATE ALIAS to re-use code for 2 databases
Following is an example of using CREATE ALIAS to use the same code for two identical databases that are connected at the same time.
Step 1: Create 2 copies of the sports database with different
physical names, for example testdb1 and testdb2.
Step 2: Connect a session to one of them, using the logical
name x:
pro testdb1 -ld x
Step 3: Create the following program and save it as up.p.
/* up.p */
FIND FIRST x.customer.
UPDATE x.customer.name.
Step 4: Compile and save up.p as follows:
COMPILE up.p SAVE.
Step 5. Exit the Progress editor, and start again, connecting
the 2 databases, the first with logical name aaa, and the
second with logical name bbb.
pro testdb1 -ld aaa testdb2 -ld bbb
Step 6. You can now access both databases with the up.p code as
follows:
CREATE ALIAS x FOR DATABASE aaa.
RUN up.p.
DELETE ALIAS x.
CREATE ALIAS x FOR DATABASE bbb.
RUN up.p.