Progress
Language Reference


THIS-PROCEDURE System Handle

Interfaces
OS
SpeedScript
All
All
Yes

A handle to the current procedure object. This object allows you to read and modify the context of the current procedure.

SYNTAX

THIS-PROCEDURE [ :attribute | :method ] 

attribute

An attribute of a procedure handle. This table lists the supported attributes.

Attribute
Type
Description
CHARACTER
Contains an arbitrary string value associated with a persistent procedure. The ADM-DATA attribute is for use by the Progress ADM only.
INTEGER
Returns the number of currently outstanding asynchronous requests for this procedure. Can be non-zero only if the PROXY and PERSISTENT attributes are both set to TRUE.
WIDGET-HANDLE
Specifies and allows you to reset the current window used to parent alert box, dialog box, or frame widgets for this procedure. The default value is the unknown value (?).
CHARACTER
Returns a comma-separated list of the logical databases that are referenced in the specified procedure.
CHARACTER
Specifies the pathname of the procedure file that contains the current procedure.
CHARACTER
Contains a comma-separated list of the names of all internal procedures declared in this procedure.
HANDLE
If the current procedure is persistent, specifies the next persistent procedure instance in the session.
LOGICAL
If TRUE, the current procedure is persistent.
HANDLE
If the current procedure is persistent, specifies the previous persistent procedure instance in the session.
CHARACTER
Provides space to store application information on the procedure.
LOGICAL
TRUE if the procedure handle is a proxy handle for a persistent procedure running remotely in the context of a Progress AppServer. Always FALSE on the THIS-PROCEDURE handle by definition.
CHARACTER
A comma-separated list of Progress named events published by a particular procedure.
LOGICAL
TRUE if the current procedure is running at the top level in the context of a Progress AppServer (as the result of a remote procedure call by a client application). Always FALSE if PROXY is TRUE.
HANDLE
Provides the server handle to the Progress AppServer on which the specified remote persistent procedure runs. Valid only if the PROXY and PERSISTENT attributes are both TRUE. Always invalid on the THIS-PROCEDURE handle by definition.
CHARACTER
A list of the super procedure handles associated with a procedure file.
HANDLE
Provides a handle to the current transaction object.
CHARACTER
Specifies the type of widget or object: always "PROCEDURE".

method

Specifies a method of a procedure handle. This table lists the supported methods.

Method
Return Type
Description
LOGICAL
Associates a super procedure file with a procedure file.
GET-SIGNATURE( ) Method (internal-procedure)
CHARACTER
Returns the return type and parameter types of a specified internal procedure or user-defined function of this procedure.
LOGICAL
Dissociates a super procedure file from a procedure file.

EXAMPLES

The following procedure is designed to run both persistently and non-persistently. It sets up a query on the customer table of the sports database that is selectable by name or balance.

r-thispr.p
DEFINE QUERY custq FOR customer.
DEFINE BROWSE custb QUERY custq
    DISPLAY name balance phone WITH 10 DOWN.
DEFINE BUTTON bName LABEL "Query on Name".
DEFINE BUTTON bBalance LABEL "Query on Balance".
DEFINE BUTTON bCancel LABEL "Cancel".

DEFINE FRAME CustFrame custb SKIP
    bName bBalance bCancel.
    
DEFINE VARIABLE custwin AS WIDGET-HANDLE.

ON CHOOSE OF bName IN FRAME CustFrame DO:
    custwin:TITLE = "Customers by Name".
    OPEN QUERY custq FOR EACH customer BY name.
END.        

ON CHOOSE OF bBalance IN FRAME CustFrame DO:
    custwin:TITLE = "Customers by Balance".
    OPEN QUERY custq FOR EACH customer BY balance DESCENDING.
END. 
IF THIS-PROCEDURE:PERSISTENT THEN DO:
    THIS-PROCEDURE:PRIVATE-DATA = "Customer Browse".
    CREATE WIDGET-POOL.
END.

CREATE WINDOW custwin
    ASSIGN
        TITLE = "Customer Browser"
        SCROLL-BARS = FALSE
        MAX-HEIGHT-CHARS = FRAME CustFrame:HEIGHT-CHARS
        MAX-WIDTH-CHARS = FRAME CustFrame:WIDTH-CHARS.
        
THIS-PROCEDURE:CURRENT-WINDOW = custwin.

ENABLE ALL WITH FRAME CustFrame.

IF THIS-PROCEDURE:PERSISTENT THEN DO:
    ON CHOOSE OF bCancel IN FRAME CustFrame DO:
        RUN destroy-query.
    END.
END.
ELSE DO: 
    WAIT-FOR CHOOSE OF bCancel IN FRAME CustFrame.
END.

PROCEDURE destroy-query:
    DELETE PROCEDURE THIS-PROCEDURE.
    DELETE WIDGET-POOL.
END. 

The procedure uses the THIS-PROCEDURE handle to distinguish between persistent and non-persistent instances of execution. When r-thispr.p is persistent (THIS-PROCEDURE:PERSISTENT = TRUE), it:

When r-thispr.p is non-persistent (THIS-PROCEDURE:PERSISTENT = FALSE), it invokes a WAIT-FOR statement rather than defining a trigger to terminate the procedure. It does not need to create a widget pool or maintain any other persistent context.

Note that because both persistent and non-persistent instances of this procedure use a dynamic window separate from the default window, r-thispr.p assigns the window’s handle to the procedure’s CURRENT-WINDOW attribute. This makes the dynamic window current whether or not the procedure is persistent. However, when the procedure is persistent, the CURRENT-WINDOW attribute keeps the dynamic window current while other procedures execute using different windows. Because the persistent procedure has its own current window, its triggers and internal procedures do not have to reset the current window every time they execute.

NOTES

SEE ALSO

RUN Statement, SESSION System Handle, VALID-HANDLE Function


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