CREATE ALIAS alias-string value ( expression )FOR DATABASE logical-name-string value ( expression )NO-ERRORalias-string value ( expression )
CREATE ALIAS myalias FOR DATABASE mydb NO-ERROR
The first database connected that has an _menu file automatically receives the alias FTDB. You can reassign the FTDB alias to any other FAST TRACK database.
If there is already a database connected with logical name equal to alias, CREATE ALIAS fails.
If there is an existing alias equal to alias, the existing alias is replaced by the new alias.
If you want to use an expression for an alias name or logical name, you must use CREATE ALIAS VALUE (expression) FOR DATABASE VALUE (expression).
Changes made to an alias do not take effect within the current procedure. In the following example, alias1.p fails to compile when it reaches the FOR EACH statement, because alias myalias has been created during the compilation:
/* alias1.p *//* NOTE: this code does NOT work */CREATE ALIAS myalias FOR DATABASE sports2000.FOR EACH myalias.Customer NO-LOCK:DISPLAY Customer.Name.END.To solve this problem, split r-alias1.p into two procedures. For example:
FOR EACH myalias.Customer NO-LOCK:DISPLAY Customer.Name.END.
CREATE ALIAS myalias FOR DATABASE sports2000.RUN r-dispnm.p.Once procedure r-main.p is run, it calls r-makebf.p, which calls r-disp6.p. The alias myalias is created in r-main.p, with reference to database sports2000. In r-makebf.p, the shared buffer mybuf is defined for myalias.customer. Then, in the next line, myalias is changed, so that it now refers to database sports2. When an attempt is made to reference shared buffer mybuf in procedure r-disp6.p, a run‑time error occurs, with the message: “r-disp6.p Unable to find shared buffer for mybuf.”
CREATE ALIAS myalias FOR DATABASE sports2000.RUN r-makebf.p.
DEFINE NEW SHARED BUFFER mybuf FOR myalias.Customer.CREATE ALIAS myalias FOR DATABASE sports2.RUN r-disp6.p
DEFINE SHARED BUFFER mybuf FOR myalias.Customer.FOR EACH mybuf NO-LOCK:DISPLAY mybuf.END.ALIAS function, CONNECT statement, CONNECTED function, CREATE CALL statement, DATASERVERS function, DBCODEPAGE function, DBCOLLATION function, DBRESTRICTIONS function, DBTYPE function, DBVERSION function, DELETE ALIAS statement, DISCONNECT statement, DYNAMIC-CURRENT-VALUE function, DYNAMIC-NEXT-VALUE function, ERROR-STATUS system handle, FRAME-DB function, LDBNAME function, NUM-DBS function, PDBNAME function, SDBNAME function
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |