Progress
Programming
Handbook


Using Shared Record Buffers with Aliases

Be careful when using shared buffers with aliases. If you reference a shared buffer after changing the alias that initially was used in defining it, a run-time error results:

main2.p
CREATE ALIAS myalias FOR DATABASE sports1. 
RUN makebuf.p. 

makebuf.p
DEFINE NEW SHARED BUFFER mybuf FOR myalias.customer. 
CREATE ALIAS myalias FOR DATABASE sports2. 
RUN disp.p  

disp.p
DEFINE SHARED BUFFER mybuf FOR myalias.customer. 
FOR EACH mybuf: 
  DISPLAY mybuf. 
END. 

In this example, procedure main2.p calls makebuf.p, which in turn calls disp.p. The alias myalias is created in main.p, with reference to database sports1. In makebuf.p, the shared buffer mybuf is defined for the table 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 disp.p, a run-time error occurs, with the message “disp.p unable to find shared buffer for mybuf.”


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095