Run a REXX program under a specific environment

[Autolink] Menu

Use the return code of the function ADDRESS to force a REXX program to run under a specific environment:

 
/* ------------------------------------------------------------------ */
/* sample prolog to force a REXX program to run under a specific      */
/* environment.                                                       */
/*                                                                    */
/* In this example we force the program to run under PMREXX           */
/*                                                                    */
/* (see also Force a REXX program to run minimized and the warning    */
/* in the section PMREXX)!                                            */
/*                                                                    */

                        /* name of the needed environment (return     */
                        /* code of the function ADDRESS)             */
  neededEnvironment = "PMREXX"

                        /* program to call to setup the correct       */
                        /* environment                                */
  executor = "PMREXX.EXE"

                        /* check the address environment              */
  if address() <> neededEnvironment then
  do
                        /* THIS part is only executed if NOT running  */
                        /* under the needed environment               */

                        /* get the name of this program               */
    parse source . . thisProg

                        /* now call the program again using the       */
                        /* defined program to setup the environment   */
    "start " executor  thisProg arg(1)

    exit rc
  end /* if adress() <> neededEnvironment then */

                        /* THIS part is only executed if we are       */
                        /* running under the needed envrionment!      */
  call RxMessageBox "This program was forced to run under PMREXX",,
                    "This is a test message"

exit 0


[Back: Force a REXX program to run in a special way]
[Next: Force a REXX program to run minimized]