Using Regina Rexx in ZOC
Автор: Markus Schmidt
Скачать книгу в формате PDF.
Скачать архив с примерами к книге.
This document is based on The Regina REXX Interpreter by Anders Christensen and Mark
Hessling. In accordance with the document's license I am the author of this document, but in reality
I have done little to earn this title. I am seeing myself merely as an editor.
In fact the text of this book is mostly identical with the original version, although some parts have
been moved or removed in order to make it more consistent with the intended use. This intention is
to provide an introduction to Rexx for users of our terminal product ZOC.
This product uses the Regina REXX interpreter as a scripting solution and it's users will have a
different background and will approach REXX differently than the intended audience of the original
The full Regina Rexx interpreter is a very powerful tool, intended to serve the same basic purpose
as other shell scripting languages like Perl, Python, etc. Some parts of this text will still reflect this.
However, I would like to ask the readers to bear with possible inconsistencies and shortcomings.
Writing text is not a strength of mine and English is not my native language, but I hope that overall
this book it will still be of good value as an introduction, overview and reference about the Rexx
Last but not least I would like to thank the original authors for their excellent work and for providing
the book under this license.
2 Introduction to ZOC's Regina Rexx
This chapter provides an introduction to Regina, an Open Source Rexx Interpreter distributed
under the GNU General Library License.
2.1 Purpose of this document
The purpose of this document is to provide a fairly complete reference of the Regina REXX
language as used with the ZOC terminal product.
For starters, a quick and easy introduction to REXX has been provided in the ZOC help file, which
you should read first. Also there is a wealth of REXX tutorials available on the internet..
This book is intended as a reference manual to provide all the details which the intro in the ZOC
help file sacrificed for simplicity and to fill the gaps.
2.2 ZOC REXX Extensions
In addition to the original Regina REXX language elements described here, ZOC extends the
language with commands to perform tasks related to terminal emulation. From the perspective or
REXX those are a 3rd party library and they are not covered here (The documentation for the ZOC
specific commands can be found in the help menu of the ZOC program under ZOC Rexx
The Regina Rexx Interpreter is implemented as a library suitable for linking into third-party
applications. Access to Regina from third-party applications is via the Regina API, which is
consistent with the IBM's REXX SAA API. This API is implemented on most other Rexx
The library containing Regina is added to ZOC as a dynamically loadable library, which ZOC
loads at runtime. This library consists all the regular features from Regina, although many do not
apply in the context of using Rexx from within ZOC. Description of features which do not apply to
using Rexx in ZOC has been removed from this book.
2.4 Executing Rexx programs with ZOC
Rexx programs are generally executed by Regina from the ZOC menu or through the ZOC
command line or associated with Host directory entries.
The Rexx programs are usually stored in files with the .ZRX extensions are loaded into memory
and passed to the Rexx interpreter for execution.
2.4.1 External Rexx programs
A Rexx program can execute other Rexx programs through the CALL command.
Regina searches for Rexx programs, using a combination of the REGINA_MACROS
environment variable, the PATH environment variable, the REGINA_SUFFIXES environment
variable and the addition of filename extensions. This rule applies to both external function calls
within a Rexx program and the program specified on the command line.
First of all we process the environment variable REGINA_MACROS. If no file is found we
proceed with the current directory and then with the environment variable PATH. The semantics of
the use of REGINA_MACROS and PATH are the same, and the search in the current directory is
omitted for the superuser on Unix systems for security reasons. The current directory must be
specified explicitly by the superuser.
When processing an environment variable, the content is split into the different paths and each path
is processed separately. Note that the search algorithm to this point is ignored if the program name
contains a file path specification. eg. if "CALL .\MYPROG" is called, then no searching of
REGINA_MACROS or PATH is done; only the concatenation of suffixes is carried out.
For each file name and path element, a concatenated file name is created. If a known file extension
is part of the file name only this file is searched, otherwise the file name is extended by the
extensions "" (empty string), ".rexx", ".rex", ".cmd", and ".rx" in this order. The file name case is
ignored on systems that ignore the character case for normal file operations like DOS, Windows,
The first matching file terminates the whole algorithm and the found file is returned.
The environment variable REGINA_SUFFIXES extends the list of known suffixes as specified
above, and is inserted after the empty extension in the process. REGINA_SUFFIXES has to
contain a space or comma separated list of extensions, a dot in front of each entry is allowed,
e.g. ".macro,.mac,.regina" or "macro mac regina"
Note that it is planned to extend the list of known suffixes by ".rxc" in version 3.4 to allow for
seamless integration of pre-compiled macros.