RETURN

RETURN

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

RETURN

Ends execution of an application program and returns to the “previous” command level.

Syntax

RETURN [TO procedure]

Parameters

procedureThe name of a procedure. Must be an ancestor (i.e., the “parent”, “grandparent”, “great-grandparent”, etc.) of the current procedure.

Comments

The RETURN command stops execution of the current procedure.

If a TO clause is omitted, execution control returns to the calling procedure (the “parent”) at the command immediately following the call that started execution of the current procedure.

If a TO clause is used, execution control returns to the specified procedure, provided that it is found along the chain of procedures that are “ancestors” of the current procedure. Execution resumes at the command immediately following the call that started execution of the offspring procedure in the current chain. If the specified procedure is not found along the chain of ancestors, execution control returns to the main prompt level.

If the RETURN command is entered at the main prompt level, the application session is ended (just as if a BYE command had been issued).

Example

To return control from the current procedure to the calling procedure when a FIND command returns an empty result set, enter

find all Employees where Salary > 10000

if $setcount = 0

 return

endif

To return to a grandparent procedure if a FIND command returns an empty result set, enter

01 procedure Grandparent ( )

02  Parent ( )        % goes to line 20

   … more commands …

18 endprocedure

19 %————————————————-

20 procedure Parent ( )

21  Child ( )        % goes to line 35

   … more commands …

33 endprocedure

34 %————————————————-

35 procedure Child ( )

36  find all Employees where Salary > 10000

37  if $setcount = 0

38    return to Grandparent  % goes to line 03

39  endif

   … more commands …

50 endprocedure

 

See Also

BYE

SET FLOW

STOP

TRANSACTION

TRANSFORM

Was this article helpful?
4.5 out of 5 stars

1 rating

5 Stars 0%
4 Stars 100%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_CAEnglish