Kbase 15673: Procedure: UNIQUE-ID Attribute is Unique Value for Session
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/16/2008 |
|
Status: Unverified
GOAL:
Explanation of the UNIQUE-ID attribute of the Procedure handle.
GOAL:
The attribute UNIQUE-ID provides programmers a means of identifying unique instances of a procedure.
FACT(s) (Environment):
Progress 8.x
Progress 9.x
Progress ADM2
FIX:
Procedure handles can conceivably be re-used in the MS-Windows version of Progress. The UNIQUE-ID attribute value, however, is unique within the Progress session (only for a single Progress session, not for an entire MS-Windows session).
If two Progress sessions simultaneously are ran, a procedure in one session could conceivably have the same UNIQUE-ID as a procedure in another. This scenario might arise during some design sessions, since some programmers like to use two UIB sessions at the same time.
If an application that saves Procedure handles and does not automatically destroy the links when the procedure is destroyed, both the procedure-handle and the Unique-ID should be saved.
An example of how to use the attribute:
When initially run a persistent procedure, something like the following might be used:
DEFINE VARIABLE saved-h AS HANDLE NO-UNDO.
DEFINE VARIABLE saved-id AS INTEGER NO-UNDO.
/* Create the linked object and save the handle. */
RUN xyz.p PERSISTENT SET saved-h.
ASSIGN saved-id = saved-h:UNIQUE-ID.
Elsewhere in the code, when there is a need to run something in the xyz.p procedure, the saved-ID would be checked first. That is:
IF VALID-HANDLE(saved-h) AND saved-h:TYPE = "PROCEDURE" AND saved-h:UNIQUE-ID = saved-id THEN
RUN doit IN saved-h.
ELSE
MESSAGE "XYZ procedure is no longer active." VIEW-AS ALERT-BOX.
END.