You are here: Commands > Return

Return

The Return command allows you to exit from a currently executing procedure immediately, without having to complete the remaining commands. This command can only be issued in command mode. For more information, see Using Commands.

Note: When a procedure is called via a Do While command, the Return command will cause the procedure to act as if the While condition had failed, ending the repeated execution of the procedure.

This command could be used in situations such as conditionally refreshing a data file. Consider a sample refresh procedure called REFRESH_BATCH.pro:

If FILEDATE(“source”) <= FILEDATE(“datafile”) RETURN

COMM if the source file is newer than the data file

COMM then the following commands will refresh the data file

. . .

Parameters

The Return command has the following command parameters:

All

ALL will cause a return from all currently executing procedures (i.e. finish processing).

Expression

The optional expression value will be assigned to a command variable named “Return” and may be of any field type (character, numeric, logical or date). The return value can be used to return the result of a procedure calculation or can be used to determine the circumstances of the return (success or failure).

Command Mode Syntax

RETURN <ALL> <expression>

Examples

RETURN

Returns to the calling procedure

RETURN ALL

Exits from all open procedures

RETURN “ABC”

Returns to the calling procedure, assigns the command variable Return=”ABC”

RETURN ALL F

Exits all procedures, assigns the command variable Return=F (the logical FALSE).