Re: can i reference the :system variable from inside a package or common lib function?

From: Charles Jardine <cj10_at_cam.ac.uk>
Date: Fri, 12 Mar 1999 10:03:21 +0000
Message-ID: <36E8E669.C9D478FE_at_cam.ac.uk>


Brandon Lee wrote:
>
> hi anyone,
> i am using dev2k to develop application. is it true that i cannot
> reference any :system variable from inside a package; since i get error
> compiling it? if so, why? is there any way to go round it? what about
> using built-in such as go_block, first_record, next_record?

You _can_ reference :system... etc in a package provided the package is in the form. What you can _not_ do is reference any bind variable (i.e. anything beginning with a ':') from code in a procedure library. This is because procedure libraries are seperately compiled.

You _can_ use built-ins from a procedure library.

You can get round this restriction by using the name_in and copy built ins. Replace

       x := :a.b; :c.d := y;

with

      x := name_in('a.b'); copy(y, 'c.d');

This way the bind variables are bound at run-time. This has two disadvantages. First, there is a small performance hit. Second, if you mistype the name of the variable, you won't find out until run-time.

-- 
Charles Jardine - Computing Service, University of Cambridge
cj10_at_cam.ac.uk    Tel: +44 1223 334506, Fax: +44 1223 334679
Received on Fri Mar 12 1999 - 11:03:21 CET

Original text of this message