REXX Tips & Tricks, Version 2.80


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


Creating "compiled" programs for Classic REXX and Object REXX


To use a "compiled" program in Classic REXX and in Object REXX you must 
create a "compiled" version for Classic REXX (created for example with 
REXXCC) and a "compiled" version for Object REXX (created with REXXC.EXE 
from Object REXX). 
Then, to call your "compiled" REXX program you should use a "wrapper" 
program written in REXX (Do not "compile" the wrapper program!). 
The wrapper program might look as follows: 

 
/* ------------------------------------------------------------------ */
/* sample wrapper to call a "compiled" REXX program depending on the  */
/* version of the current REXX interpreter (Classic REXX or           */
/* Object REXX)                                                       */
/*                                                                    */
/* Note:                                                              */
/*                                                                    */
/* This program assumes                                               */
/*                                                                    */
/* - the REXX program "compiled" for Classic REXX is called           */
/*   <name_of_this_prog>C.CMD                                         */
/*                                                                    */
/* - the REXX program "compiled" for Object REXX is called            */
/*   <name_of_this_prog>O.CMD                                         */
/*                                                                    */
/* - both programs are in the same directory as this program          */
/*                                                                    */

                    /* init the return code                           */
  rc = 255

                    /* get the parameter                              */
  parse arg thisParameters

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

  progBaseName = substr( thisFile,1 lastPos( ".", thisFile )-1 )

                    /* check the version of the current REXX          */
                    /* interpreter                                    */
  parse upper version thisVersion thisVersionNo
  if thisVersion = "OBJREXX" | thisVersionNo > 4.00 then
  do
                    /* current REXX interpreter is Object REXX        */
    "@cmd /c " progBaseName || "O.CMD" thisParameters
  end /* if thisVersion = "OBJREXX" | thisVersionNo > 4.00 then */
  else
  do
                    /* current REXX interpreter is Classic REXX       */
    "@cmd /c " progBaseName || "C.CMD" thisParameters
  end /* else */

return rc

  

Inf-HTML End Run - Successful