Passing parameters to Rexx Dialog programs

[Autolink] Menu

Use the following technique to pass parameters to Rexx Dialog programs:

 
/* ------------------------------------------------------------------ */
/* sample prolog for Rexx Dialog programs to access parameters from   */
/* the command line.                                                  */
/*                                                                    */
/* Note that you must call this CMD without the prefix RX to make     */
/* this work!                                                         */
/*                                                                    */
/* Use PMREXX to create a WPS object for this program that does not   */
/* open an OS/2 window when running this program.                     */
/*                                                                    */
/* Note further that you cannot use the default REXX queue to pass    */
/* the parameters to the Rexx Dialog program.                         */
/*                                                                    */

                        /* name of the environment variable to pass   */
                        /* the parameters                             */
  envVarName = "ThisParms"

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

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

                        /* check for parameters and save them in an   */
                        /* envionment variable if any exist           */
    parse arg thisParms
    call value envVarName, thisParms, "OS2ENVIRONMENT"

                        /* now call the program again using RX.EXE    */
    "@RX " thisProg

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

                        /* THIS part is only executed if we are       */
                        /* running under RXDLG!                       */

                        /* get the parameters                         */
  thisParms = value( envVarName, , "OS2ENVIRONMENT" )

  rxSay "Parameters for this program are: " thisParms
exit 0


[Back: Workaround for the // limitation]
[Next: Special environment variables for REXX programs]