─ENDLOCAL()─────────────
ENDLOCAL restores the drive directory and environment variables in effect before the last SETLOCAL function was executed. If ENDLOCAL is not included in a procedure, then the initial environment saved by SETLOCAL will be restored upon exiting the procedure.
ENDLOCAL returns a value of 1 if the initial environment is successfully restored, and a value of 0 if no SETLOCAL has been issued or if the actions is otherwise unsuccessful.
┴╓: Unlike their counterparts in the OS/2 Batch language (the Setlocal and Endlocal statements), the REXX SETLOCAL and ENDLOCAL functions can be nested.
Here is an example:
n = SETLOCAL() /* saves the current environment */ /* The program can now change environment */ /* variables (with the VALUE function) and */ /* then work in that changed envirnonment. */ n = ENDLOCAL() /* restores the initial environment */
For additional examples, view the SETLOCAL function.