Progress
Programming
Handbook


Shared and Local Context

Internal procedures are part of the context of the containing external procedure. An internal procedure can access anything in the containing procedure’s context, including shared objects and run-time parameters passed to the containing procedure. Also, like external procedures, the local context of an internal procedure is generally invisible to the procedure that calls it. In other words, while the containing procedure’s context is visible to the internal procedure’s context, the local context of the internal procedure is invisible to the containing procedure.

While an internal procedure can access shared objects defined in the containing procedure, you cannot introduce any shared object definitions in the internal procedure itself. For example, the statement DEFINE NEW SHARED FRAME results in a compiler error.

In addition, you cannot define local or shared streams, temporary tables, or work tables in an internal procedure. However, you can define local variables, queries, user-interface widgets, and buffers within an internal procedure.

Progress scopes buffers defined in an internal procedure to that procedure. When the procedure ends, you can no longer access those buffers. An internal procedure can also reference buffers from a containing procedure.

Progress follows these steps to resolve buffer references:

  1. Progress searches for a defined buffer that satisfies the reference, looking first in the local procedure. If it does not find the defined buffer, it searches for it in the containing procedure.
  2. If Progress cannot find an explicitly defined buffer, it looks for other references to the same implicit buffer. Progress looks first in the local procedure. If it does not find an implicit reference, it searches for an implicit reference in the containing procedure.
  3. If Progress cannot find an existing implicit reference to the same buffer, it tries to create a new implicit buffer. Progress scopes the new buffer to the procedure block of the containing procedure file.

An internal procedure has its own frame list and can reference by name any frame already named in the containing procedure. Progress resolves references to named frames by first looking in the internal procedure, then looking through the frames named in the containing procedure. If it finds none, the internal procedure gets a new local frame. A frame scoped to the containing procedure and used in the internal procedure is a borrowed frame. The internal procedure can add fields to a borrowed frame but cannot use a local program variable in any of the frame’s expressions. This is because Progress might evaluate a borrowed frame’s expressions outside the scope of the internal procedure.


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