Start a REXX program in PM mode

[Autolink] Menu

To start a REXX program in a PM environment there are at least three methods available (note that a REXX program must run in a PM environment to use the function RxMessageBox()):

1. Method
Start the program from within a PM program (like EPM) or use the program PMREXX to start the REXX program. (see also Run a REXX program under a specific environment)

You can also use one of the visual REXX development tools for the REXX program (like VX-REXX, VisPro/REXX or GpfREXX; see also the REXX development tools & extensions listed in the section PM Tools). These environments normally provide better PM controls than RxMessageBox().

2. Method
Start the REXX program with the following command:

 
 start /pm cmd /c {programPath}programName

Note that this is not possible in 4OS2 sessions!

3. Method
Create an object with PROGTYPE set to PM for the REXX program and use the function SysOpenObject or SysSetObjectData to start the program:

 
/* REXX code to create a WPS object to start the REXX program         */
/*   C:\TESTPM.CMD                                                    */
/* in a PM environment (assuming OS/2 is installed on drive C:)       */

                    /* load the necessary REXXUTIL functions          */
  call rxFuncAdd "SysLoadFuncs", "REXXUTIL", "SysLoadFuncs"
  call SysLoadFuncs

                    /* create the object                              */
  if SysCreateObject( ,
      "WPProgram"                               ,, /* object class    */
      "REXX program in a PM environment"        ,, /* object title    */
      "<WP_DESKTOP>"                            ,, /* object location */
      "EXENAME=C:\OS2\CMD.EXE;"            || ,    /* object setup    */
      "PROGTYPE=PM;"                       || ,    /*  string         */
      "PARAMETERS=/C C:\TESTPM.CMD;"       || ,
      "OBJECTID=<MyObject>;"                    ,, /* replace flag    */
      "U" ) = 1 then
  do
                    /* execute the program (all OS/2 version, you can */
                    /* also use SysOpenObject in OS/2 WARP)           */
    call SysSetObjectData  "<MyObject>", "OPEN=DEFAULT";

  end /* if SysCreateObject( ... */


[Back: Force a REXX program to run minimized]
[Next: Starting other programs in REXX programs]