Learning REXX

Скачать вариант книги с упором

на работу в терминальной программе ZOC в формате PDF.

Скачать вариант книги с упором

на работу в Windows (без файлов с примерами) в формате HLP.

The lessons in this course were designed for the original WinREXX product and is (C) by
Enterprise Alternatives, Inc. It been licensed by EmTec Innovative Software for use as a
REXX interpreter in the ZOC product.
This script covers the basic REXX language elements like variables, loops, decisions, etc and
is compatible with almost all REXX implementations in the market.
However, please be aware that does not cover the ZOC specific language extensions. ZOC
adds communication related extensions to the REXX language (e.g. the ZocSend command
to send data or the ZocWait command to wait for a reply from the remote host). These are
extensions to REXX and implemented as built in subroutines which you can call at any point
of your REXX program.
The ZOC commands are listed and explained in the ZOC help file (see the ZOC-REXX
Commands topic in ZOC’s help menu) and in the ZOC REXX Reference, which is available in
your ZOC Files folder or via download from our website (download link).
If you are entirely new to REXX and ZOC you may consider starting the the REXX Script
Introduction at the bottom of the Script menu in the ZOC main window, which is a bit easier
for a start.

Why Learn REXX?

REXX's standard features as defined in The REXX Language are very flexible and powerful,
making REXX useful for a host of applications: personal programming, batch or shell
programming, program macros, and prototype development.
This introduction to REXX emphasizes the standard features of the language. Toward the
end of this tutorial we will introduce some of the implementation-specific aspects of Enterprise
REXX. These added features are not necessary for writing many useful REXX programs, but
they will allow you to get the most out of REXX in the Windows environment. When we
discuss Enterprise REXX's features, we will make clear the distinction between them and
standard REXX.

First Principles

The primary design goal for the REXX language was ease of use by both professional
programmers and every-day computer users. To help reach this goal, a set of principles were
adopted. You may find it easier to learn REXX if you keep in mind the principles that shaped
its design:
Readability - REXX supports modern structured programming concepts and gives
programmers great flexibility in the way they format programs.
Natural data typing - REXX assigns meaning to data according to its use and does
not require programmers to understand the underlying representation of data.
Symbolic manipulation - REXX's rich set of character manipulation operators and
functions make it well suited to processing the textual information that people use.
System independence - All of the features of REXX behave the same, regardless of
the hardware or software environment. But because REXX lets you issue
environment-specific commands, REXX can act in very close concert with both the
environment it is in and with other programs running alongside it.
Small size - Aside from its many built-in functions, REXX is a very compact
language. This makes REXX easier to learn and master.
For more about the design and history of REXX, see Part 1 "Background" in The REXX
Language.

Contents

LEARNING REXX.
LEARNING REXX - INDEX BY EXAMPLE PROGRAM.
LEARNING REXX - INDEX BY REXX INSTRUCTION.
Learning REXX - Purpose.
About REXX.
Learning REXX - Getting Started.
LEARNING REXX - LEARN01.REX.
Learning REXX - Structure and Syntax.
LEARNING REXX - TOKENS.
Learning REXX - Simple Variables.
LEARNING REXX - SAY INSTRUCTION.
LEARNING REXX - PULL INSTRUCTION.
LEARNING REXX - INITIAL VARIABLE VALUES.
Learning REXX - Expressions, Operators, and Assignments.
LEARNING REXX - VARIABLE CONCATENATION.
LEARNING REXX - ASSIGNMENT.
LEARNING REXX - ARITHMETIC OPERATORS.
Learning REXX - PARSE.
LEARNING REXX _ PARSE WITH TEMPLATE.
Learning REXX - Compound Variables.
LEARNING REXX - LEARN08.REX.
LEARNING REXX - STEM ASSIGNMENT
LEARNING REXX - LEARN09.REX.
Learning More Operators.
LEARNING REXX - COMPARISON.
LEARNING REXX - LOGICAL OPERATORS.
CONTROL STRUCTURES AND DO GROUPS.
CONDITIONAL INSTRUCTIONS.
LEARN11.REX.
LEARN12.REX.
SELECT INSTRUCTION.
LEARN13.REX.
DO Loops.
SIMPLE LOOPS.
LEARN14.REX.
LEARN15.REX - CONTROLLED LOOPS.
LEARN15.REX - NESTED CONTROLLED LOOPS.
CONDITIONAL LOOPS.
LEARN17.REX - DO WHILE LOOP.
EXITING LOOPS.
LEARN18.REX - ITERATE AND LEAVE.
More about PARSE.
LEARN19.REX - PARSING A VARIABLE.
LEARN20.REX - PARSING WITH BLANK-DELIMITED WORDS.
LEARN21.REX - PARSING WITH LITERAL PATTERNS.
LEARN22.REX - PARSING WITH COLUMN NUMBERS.
PARSING AN EXPRESSION.
Using Built-in Functions.
INVOKING FUNCTIONS.
STRING FUNCTIONS.
LEARN23.REX - REXX STRING FUNCTIONS.
CONVERSION FUNCTIONS.
LEARN24.REX - REXX CONVERSION FUNCTIONS.
INFORMATION FUNCTIONS.
LEARN25.REX - DATE() AND TIME().
User-defined Subroutines and Functions.
LEARN26.REX - USER-DEFINED SUBROUTINES AND FUNCTIONS.
INVOKING SUBROUTINES AND FUNCTIONS.
DEFINING SUBROUTINES AND FUNCTIONS.
SUBROUTINES VERSUS FUNCTIONS.
EXIT INSTRUCTION.
ARGUMENTS.
LEARN28.REX - REXX ARGUMENT PASSING.
VARIABLE SCOPE.
LEARN29.REX - VARIABLE SCOPE.
Commands to External Environments.
ISSUING COMMANDS.
LEARN31.REX - COMMANDS TO THE DOS ENVIRONMENT.
Advanced Features of REXX.
NUMERICS AND MATH.
NUMERIC INSTRUCTION.
DEBUGGING WITH THE TRACE INSTRUCTION.
LEARN33.REX - USE TRACE TO FIND BUG.
INTERPRET INSTRUCTION.
LEARN34.REX - INTERPRET.
File Input and Output.
DEFAULT I/O STREAMS.
I/O ROUTINES.
LEARN35.REX - WRITE NOTE TO DISK FILE.
LINE I/O ROUTINES.
OPENING AND CLOSING FILES.
LEARN36.REX - COPY ASCII FILE.
FILE NAMES.
LEARN37.REX - LIST OCCURRENCES OF STRING IN FILE.
CHARACTER I/O ROUTINES.
REXX Utility Functions.
HARDWARE INFORMATION FUNCTIONS.
HARDWARE ACCESS FUNCTIONS.
LEARN39.REX - DRAW BORDER, WAIT FOR USER TO HIT KEY.
MISCELLANEOUS FUNCTIONS.
DOS FUNCTIONS.
LEARN41.REX - CREATE MENU OF EXECUTABLES.
Learning REXX - What Next?.

Learning REXX - Index by Example Program

Learn01.REX »Page Hello World
Learn02.REX »Page REXX Structures
Learn03.REX »Page Simple REXX Variables
Learn04.REX »Page Concatenation
Learn05.REX »Page Arithmetic
Learn06.REX »Page REXX PARSE
Learn07.REX »Page PARSE with Template
Learn08.REX »Page Compound Variables
Learn09.REX »Page Compound Variables with non numeric subscripts
Learn10.REX »Page Comparisons
Learn11.REX »Page : If Instruction
Learn12.REX »Page IF/THEN/ELSE
Learn13.REX »Page SELECT Instruction
Learn14.REX »Page simple DO loop
Learn15.REX »Page Controlled Loop
Learn16.REX »Page Nested Controlled Loop
Learn17.REX »Page DO WHILE loop
Learn18.REX »Page ITERATE and LEAVE
Learn19.REX »Page Parsing a Variable
Learn20.REX »Page Parsing with Blank-delimited Words
Learn21.REX »Page Parsing with Literal Patterns
Learn22.REX »Page Parsing with Column Numbers
Learn23.REX »Page REXX String Functions
Learn24.REX »Page REXX Conversion Functions
Learn25.REX »Page DATE() and TIME() Information Functions
Learn26.REX »Page User-defined Subroutines and Functions
Learn27.REX »Page Subroutines Versus Functions
Learn28.REX »Page REXX argument passing
Learn29.REX »Page Variable Scope
Learn30.REX »Page Issuing Commands
Learn31.REX »Page Commands to the DOS environment
Learn32.REX »Page NUMERIC Instruction
Learn33.REX »Page Use TRACE to find bug
Learn34.REX »Page INTERPRET
Learn35.REX »Page Write note to disk file
Learn36.REX »Page Copy ASCII File
Learn37.REX »Page List occurrences of string in file
Learn38.REX »Page Hardware Information Functions
Learn39.REX »Page Draw border, wait for user to hit key
Learn40.REX »Page Miscellaneous Functions
Learn41.REX »Page Create menu of executables and run one