PillarSoft

http://www.pillarsoft.net/os-2-software/rexx/execution-environment-detection-in-visprorexx-inte.shtml

Execution Environment Detection in VisProRexx (Intermediate level)

Contributed by: Doug Rickman, Global Hydrology and Climate Center, MSFC, NASA

This is aimed at intermediate REXX users.

When an exe (built by VisProRexx) is run by the user and the programmer tests the program using the "Run Project" menu item, the environments are probably different. These two code fragments detect which is being run and executes another program accordingly.


 


/*****************************************************************************/
/***************  For use in VisProRexx                        ***************/
/* These handle the fact the user and the programmer see different           */
/* environments.                                                             */
/* Running a program from inside the VisProRexx program.                     */
/*    if running inside of VisPro get the desired file in the local directory*/
/*    otherwise search the path, starting with the current directory.   If   */
/*    the exe is not found warn the user and return a 0.   If found, run it. */

fragment 1
/* get the current executable's drive, path and name.  */
parse value parsefn(dosprocinfo('n')) with drive  path exe extension
if path= "\VISPRORX\" & exe="RUNIT" then 'decode_atlas.exe 'in ' > 'login
else do
   /* get the location of decode_atlas.exe */
   exeLocation=doscommandfind('decode_atlas.exe')
   if exeLocation='' then do
      message='The program "decode_atlas.exe" could not be found in the program ',
            ||'directory or along the path.'
      response=VpMessageBox(window,"Cann't you follow directions?",message)
      return 0
      end

   'decode_atlas.exe' in ' > 'login
   end /* else do */


fragment 2
/* Getting a help file from a menu item.                                     */
parse value parsefn(dosprocinfo('n')) with drive  path exe extension
if path= "\VISPRORX\" & exe="RUNIT" then 'view' AtlasGeoAnalysis.hlp
else 'view ' drive':'path||AtlasGeoAnalysis.hlp