Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Command Index > R

RETURN (Short Name: RET)

Scroll Prev Top Next More

Use the RETURN command in a program to return control to a program or to the R> Prompt.

 

RETURN

 

Options

 

.varname

Used ONLY within a stored procedure to return a value. The returned value will be stored in the STP_RETURN system variable. This option will return an error when used outside of a stored procedure. The default is text 8 characters, but if you want more, set it to a larger value.

 

PUT Command Example (sets the limit for the return value at 30 characters):

 

PUT test.prc AS TEXT test p1 integer RETURN TEXT (30)

 

About the RETURN Command

 

When you use RETURN to return to a command file or a block in a procedure file, the next command executed is the command following RUN in the command file or procedure file.

 

If you used the RUN commands to run a command file or a block in a procedure file from the R> Prompt, control returns to the R> Prompt when RETURN is executed.

 

Examples

 

Assume you have two command files named CMDFIL1.RMD and CMDFIL2.RMD with the commands shown below.

--CMDFIL1.RMD

PAUSE 2 USING 'This command file (cmdfil1.rmd) calls cmdfil2.rmd.'

RUN cmdfil2.rmd

CLS

PAUSE 2 USING 'Cmdfil1.rmd is in control.'

 

--CMDFIL2.RMD

LABEL top

DIALOG 'Press Q to quit:' vend vkey 1

IF vend = 'Q' THEN

  RETURN

ELSE

  GOTO top

ENDIF

 

When you run CMDFIL1.RMD by entering RUN CMDFIL1.RMD, the following messages appear on the screen:

 

This command file (cmdfil1.rmd) calls cmdfil2.rmd.

 

Press Q to quit:

 

If you press [Q] at the DIALOG command prompt, control returns to CMDFIL1.RMD. The following message appears on screen, processing stops, and you are returned to the R> Prompt:

 

Cmdfil1.rmd is in control.