PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
This program, while mainly designed for HTML processing, could be used for most languages. It has specific support built in for the preprocessing of REXX code.
REXX code is, by default, packed. This makes the resultant ".CMD" file much smaller than the original code and in many cases this would be enough of a reason to use it (although the packing is irrelevant if you then compile the ".CMD" into a ".EXE" using my REXX compiler). Also note that the packing will not speed up the execution of your code although it may slightly speed up the initial tokenization.
If you examine the small example, you will notice that I used "#ifdef" commands to determine which parts of the header file I wished to include. You could easily extend this concept to allow debug code to be added only when you wish to debug or have variations on error handling (log the message, ignore it, etc.). I don't normally define my subroutines as procedures because in my opinion the disadvantages of the way REXX does it outweigh the advantages. My example header file has been written so that the user of the subroutines can determine not only whether they should be procedures but what variables they should expose if they are!
|MORE ON PACKING|
The preprocessor packs well written code (by my definition!) and can fail to correctly pack code where strings are appended without the use of the "||" operator (as the excess spaces will be removed). For example the following statement will not create the string you expect when packed:
BothPartsCombined = 'Value:' TheValue;
The following statement is a version of the above that will work:
BothPartsCombined = 'Value: ' || TheValue;
You can get very good results by packing but if you have got legacy code or you don't wish to change (your evil ways!) you should use the "/Pack:N" command line switch. This turns off most packing (rexx comment and trailing ';' removal still occurs).
If you have trouble with some parts of your code but the bulk packs well then you may wish to consider leaving packing on and using the AllowPack option to indicate parts of your rexx code that should not be packed.
This has not been tested on object rexx so I don't know if it will work or not (I assume it will).