Progress
Language Reference
RETURN Statement
Leaves the local or remote procedure block and returns to the calling procedure. If there is no calling procedure, RETURN returns to the Procedure Editor or other ADE tool that invoked the procedure.
For more information on remote procedures, see the Building Distributed Applications Using the Progress AppServer manual.
SYNTAX
ERROR
Causes an ERROR condition in the calling block. This causes the ERROR condition to be raised for the RUN statement in the calling procedure. You can use the ERROR option only in a procedure or a database trigger block. Any values that are set for OUTPUT or INPUT-OUTPUT parameters before the RETURN ERROR executes are not returned to the calling procedure.
NO-APPLY
Suppresses the default behavior for the current user-interface event. For example, the default behavior for a character code key press in a fill-in field is to echo the character in the field. If you execute RETURN NO-APPLY in a trigger, this behavior is not performed. You can use the NO-APPLY option in a user-interface trigger block or within an internal procedure.
return-value
The value that RETURN returns to the calling procedure. RETURN appearing in a user-defined function returns an expression whose type matches the return type of the function. RETURN not appearing in a user-defined function returns a CHARACTER expression. To access return-value from the calling procedure, use the RETURN-VALUE function.
EXAMPLESThe
r-fact.p
procedure is called recursively because (n factorial) is n * ((n - 1) factorial). Ther-fact.p
procedure first checks that the input value is valid. If the value is invalid, it returns a message to the caller. Note thatr-return.p
checks the RETURN-VALUE immediately after runningr-fact.p
. If a message is returned,r-return.p
displays that message.The procedure
r-return.p
accepts an integer as input and then runsr-fact.p
to calculate the factorial of that integer. The factorial of a number is the result of multiplying together all of the integers less than or equal to that number (for example: 3 factorial is 3 * 2 * 1 = 6). Ther-fact.p
procedure is called recursively because n factorial is n * (n -1) factorial.
Note that this is not the most efficient way to calculate factorials, but in other applications, such as bill of material explosions, recursive procedures are very effective.
NOTES
- The RETURN-VALUE function provides the value returned by the most recently executed RETURN statement of a local or remote procedure.
- If the procedure executing the RETURN statement is called asynchronously, the client can access the return value and ERROR condition in the associated event procedure. For more information on event procedures, see the Building Distributed Applications Using the Progress AppServer manual.
SEE ALSO
CREATE SERVER Statement, FUNCTION Statement, ON ENDKEY Phrase, ON ERROR Phrase, ON QUIT Phrase, ON STOP Phrase, RETURN-VALUE Function
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |