HTTP: Rexx Language
Newsgroups: comp.lang.rexx
WebRexx is fully integrated into PowerWeb, allowing Rexx code to be embedded within your HTML and executed before the document is sent to the client's browser.
You can also write independent Rexx modules as ".CMD" files and have them called by way of a URL or from within HTML by means of the #exec WebMacro.
PowerWeb also allows you to extend its internal engine by defining API Hooks which selectively override aspects of its behaviour, such as user authentication and access control. You can write these hooks in Rexx and take advantage of PowerWeb's caching of the tokenised Rexx module for speed.
Windows NT Users:
You should obtain and install the Object Rexx for Windows NT available from IBM's Rexx site before attempting to use WebRexx.
You MUST set your system PATH (not just your local user PATH) to include the ObjRexx directory if you are running PowerWeb as an NT Service. You do this through the Windows Control Panel, System settings.
You must also obtain the 30 December 1996 or later release of Object Rexx, otherwise you will not be able to run WebRexx when PowerWeb is installed as an NT service. In addition, you must leave the "Interact with Desktop" setting enabled in the PowerWeb Service startup settings (this is enabled by default upon installation).
The process to follow is:
<!--#script ScriptName --> /* Your Rexx Code */ <!--#endscript --> <html> Your HTML text. <!--#call rexx=ScriptName --> Your further HTML text. </html>
/* My Rexx Script */
You access this "parcel" within Rexx by using the following code at the top of your script:
parse arg parcel
Your Rexx script is expected to return a result indicating the success or failure of your script, according to the following table: For example, you would use this Rexx code to indicate success:
return "0"
PowerWeb Rexx Scripts can be stored in any directory, but the guidelines below will help you manage all your modules. The PowerWeb Server++ is initially configured during installation to support extensions in the following suggested directory.
Suggested Location for Rexx Modules: Assuming your server root is "\powerweb", put your module in the directory "\powerweb\rexx-bin", so that you can load it with the URL "/rexx-bin/module.cmd" where "module.cmd" is the name of your Rexx module.
Example URL: "/rexx-bin/svrpush.cmd"
PowerWeb automatically associates files within the rexx-bin directory as Rexx scripts. This is set up through the URL Alias Editor. If you create sub-directories under this directory, they will also be recognised as Rexx script directories.
You can create further directories in other locations by simply defining an alias to that directory and giving it an object type of "Rexx Script".
TimeZone Display Example: Under "\powerweb\system\tour", there is a document "rexxtime.htm" which demonstrates how Rexx can be embedded within HTML to display tables with dynamic content. Try it! Guided Tour Sample Code: The Guided Tour has a complete Rexx example of an API hook for dynamic translation of a database into an HTML document. It has equivalent functionality to the C example code, so you can compare the two language implementations. Server Push Sample: Under "\powerweb\system\rexx-bin", there is a file "svrpush.cmd" which demonstrates server-push for those browsers capable of handling this feature which allows for periodic updating of the client's page or image. Semaphore Example: Under "\powerweb\system\rexx-bin", there is a file "semaphor.cmd" which shows how to use semaphores to achieve safe multi-tasking even when the external library you are using is single-threaded (such as the IBM Rexx to DB/2 interface). Directory Listing Example: Under "\powerweb\system\rexx-bin", there is a file "dirlist.cmd" which demonstrates how Rexx can be used to process HTML forms and dynamically generate Web Macro code. Tree Display Example: Under "\powerweb\system\rexx-bin", there is a file "tree.cmd" which is equivalent to the C-code Guided Tour example which displays your server configuration settings in a tree format.
Guided Tour Sample Code: The Guided Tour has a complete Rexx example of an API hook for dynamic translation of a database into an HTML document. It has equivalent functionality to the C example code, so you can compare the two language implementations.
Server Push Sample: Under "\powerweb\system\rexx-bin", there is a file "svrpush.cmd" which demonstrates server-push for those browsers capable of handling this feature which allows for periodic updating of the client's page or image.
Semaphore Example: Under "\powerweb\system\rexx-bin", there is a file "semaphor.cmd" which shows how to use semaphores to achieve safe multi-tasking even when the external library you are using is single-threaded (such as the IBM Rexx to DB/2 interface).
Directory Listing Example: Under "\powerweb\system\rexx-bin", there is a file "dirlist.cmd" which demonstrates how Rexx can be used to process HTML forms and dynamically generate Web Macro code.
Tree Display Example: Under "\powerweb\system\rexx-bin", there is a file "tree.cmd" which is equivalent to the C-code Guided Tour example which displays your server configuration settings in a tree format.
You will need to read the API Function Reference, before writing code which calls these functions.
The PowerWeb Server++ Rexx Interface Function Definitions Are:
ReturnValueFunctionNameInputParameters handle ServerGetConfig parcel handle ServerGetServer parcel handle ServerGetConnect parcel handle ServerGetRequest parcel handle ServerGetParameters parcel handle ServerGetArguments parcel handle ServerFind parent, name type ServerKind handle size ServerSize handle name ServerName handle - ServerFlush handle value ServerReadText parent, name value ServerReadBinary parent, name - ServerWriteText parent, name, value - ServerWriteBinary parent, name, value - ServerAppendText parent, name, value - ServerAppendBinary parent, name, value - ServerNewInteger parent, name, value - ServerNewFloat parent, name, value - ServerNewText parent, name, value - ServerNewBinary parent, name, value - ServerNewList parent, name - ServerNewSemaphore parent, name - ServerDelete handle handle ServerParent handle handle ServerChild handle handle ServerSibling handle - ServerInterpret parcel, code