0 - SLAC National Accelerator Laboratory

advertisement
SLAC-368
CONF-9006245
UC-405
(M)
PROCEEDINGS OF THE REXX SYMPOSIUM
FOR DEVELOPERS AND USERS
June 11,1990
STANFORD
LINEARACCELERATOR
CENTER
94.309
STANFORD
UNIVERSITY,
STANFORD,
CALIFORNIA
Cathie Dager
Symposium Organizer
Nancy Larson
Symposium AdministrativeAssistant
Prepared for the Department of Energy
under contract number DE-AC03-76SF00515
Printed in the United States of America. Available from the National Technical
Information Service, US. Department of Commerce, 5285 Port Royal Road,
Springfield, Virginia 221 61. Price: Printed Copy A1 1, Microfiche AOI.
PROCEEDINGS OF THE REXX SYMPOSIUM
FOR DEVELOPERS AND USERS
TABLE OF CONTENTS
A. Summary
II
B. Presentations
REXX 4.0
Bill Hawes
Marvin Weinstein:
Multitasking with Amiga REXX
(no paper)
Walter Pachl:
IBM REXX Compiler
33
Kevin Kearney
Charles Daney:
The Astonishment Factor
59
Keith Watts:
Environment
andI/O
Challenges
Brian Marks:
Oriented
Object
Rick McGuire:
IBM
Neil Milsted:
Bob O'Hara:
Why
C.
1
Mike Cowlishaw:
65
REXX
SAA REXX for OS/2
REXX for UNlX
75
101
112
REXX Died (A Retrospective)
124
Tony Johnson:
SLAC Use of REXX on VM and VMS
132
Larry Oppenheim:
Developing Fullscreen REXX Applications
152
Bebo White:
CMS Pipelines
157
Mason Kelsey:
REXX in Three Different Environments:
VM/MVS/OS/2
172
of Attendees
23 1
D. Announcement of REXX Symposium for 1991
1
235
SUMMARY
The first REXX Symposium for Developers and Users was held at t,he
Stanford Linear Accelerator Center on June 11,1990. Mike Cowlishaw, author of the REXX Language, was the keynote speaker and the developers
of all current implementations of REXX made presentations. The 118 participants represented five countries and allof the REXX user communities.
This broad participation demonstrates the growing interest in REXX as a
multi-platform computer language.
The Symposium was planned as a gathering where REXX users and
developers couldmeet each other, exchange ideas and information about the
language and discuss future plans. In light of these plans, the morning and
early afternoon of the Symposium were devoted to plenary presentations
by the developers of various REXX implementations:
IBM SAA REXX;
Mansfield Software Group Personal REXX for DOS and OS/2;
Portable REXX for DOS and TREXX for Tandem by Keith Watts;
Amiga AR.EXX by Bill Hawes; and
the Workstation Group UniREXX for Unix.
Following the individual talks t'he developers
sat on a panel and participated
with the audience in a lively question and answer period. Late afternoon
speakers talked about how they use REXX. This volume containscopies of
the talks and transparencies.
The Symposium was a success and many ideas were exchanged. Discussions included multi-platform considerations, requests for language extensions and st'andards and plans for continuing the work at another Symposium next year. (Refer to Announcement of REXX Symposium for 1991.)
0
0
0
..
I1
ti
In this paper for the REXX Symposiunl. for DewEopers and Users the history of the
REXX language is reviewed and the new features in RE= level 4.00 are introduced.
REXX level 4.00 is described in detail in the author’s new book, the Second Edition of
The R E Z Language (Prentice-Hall, 1990, ISBN 0-13-780651-5j; this is the language
irnp’lemented in the IBM OW2 Extended Editiejn operating system: Release 1.2.
The REXX language (originally called “REX”) has developed in two distinct phases: the
first being the rapid evolution of the language i n a n essentially experimental environment, and the second being a more cautious series of enhancements following the
commercial availability of implementations of the language.
The first phase took place as a personal project of about four thousand hours during the
years 1979 through 1982, at the IBM UK Laboratories near Winchester (England) and
at the IBM T. J. Watson Research Center in New York (USA). With this background
RE= has an internat.ionaI flavour, with roots in both the European and North American programming cultures. Its
first presentation outside IBM was to SHARE 56, in
Houston, in 1981.
In 1983, my own Systed370
implementation
became part of the
Virtual
Machine/Syst,em Product, as the System Product Interpreter
for the Conversational
Monitor System (CMS). This implementation of the language is described in the Reference Manual for that product.’ In 1985 the first edition of The REXX Language (describing language level 3.50) wa.s published, and mon after that the pioneer non-IBM
implementation of REXX was announced by t . 1 Nmsfield
~
Software Gr0u.p: this runs
under the MS-DOS and PC-DOS operating systems for Personal Computers. A number
of other implementations have followed from a variety of suppliers: one which perhaps
best demonstrates the suitability of REXX for chfferent environments is a version for
the Commodore Amiga computer.
The next milestone for REXX was its choice by IBM as the Procedures Language for
the Systems Application Architecture (SA4).2This 1987 announcement implies a common REXX language across all the SAA operating systems: VM, M V S , OS/400, and
OS/2.3The language interpreter development for all these environments is coordinated
at the IBM Endicott Programming Laboratory, New York.
All the first implementations of REXX were interpreters: notable, then, was the announcement in 1989 ofIBM’s CMS REXX Compiler,developed at the IBM Vienna
Software Development Laboratory in Austria with helpfrom the IBM Scientific Centre
at Haifa in Israel.
Inevitably the commercial exploitation of the language has required a stable language
definition - the radical changes in the language that were characteristic
of its first
years are no longer possible. Fortunately, those early years of heavy use and rapid
evolution probably mean that such radical changes are no longer necessary: rather one
would expec,t to see incremental changes and adjustments consistent with the philosophy of keeping the language small and approachable. This, indeed,
is the philosophy
that hasbeen followed during the developmentof REXX level 4.00 over the past several
years.
REXX 4.00
- Philosophy
New features have been added to the REXX definition following a process of slow refinement, essentially based on user feedback. In general the intention has been to
“Keep the language small”, so the enhancements that have been made have been chosen for their high power-to-complexity ratio.
Some of the enhancements have been made for pragmatic reasons,assuch
for improved
input and output flexibility(recognising the diversity of operatingsystems),error
handling, etc. Others have been made in order to “tidy up” the language; these include
improved arithmetic, defined character sets, and so on.
. . .. ..
. .~
. . . ....
.
The Procedures Language for SAA comprises the REXX language, Double Byte Character Set support,
and a series of common interfaces to the language.
More formally: CMS in the W S y s t e m Product or VMExtended Architecture, TSO/E in the Enterprise
Systems Architecture/370, Operating Systeml400 for the Application Systeml400 (AS/400), and Operating Systeml2 Extended Edition.
2
.
DATE('%'') Base Date function has been added (this returns the number of days since
1 January 0001, calculated by extendmg today's calendar backwards). 11
June 1990 is day 726628.
DAT%("c") Century Date removed because it is superseded by DATE("b"), and its use
is likely to lead to problems in a few years4
Trace Scan Removed because it is very expensive to implement in certain cases.
f $ @ $4 @
Removed from symbols (names) due to difficulties in cross-system transfer
and portability.
nhancements
*
Mathematicalfunctions are consistentlydefined to normalizeinputs before use
(most did before, though MIN and MAX &d not and could therefore produce surprising answers).
*
The definition of basic operators has been clarified (the previous description did not
fully define addition and subtraction, for example).
*
The Power operator has been slightly redefined for improved accuracy:
should equal
FRED
*
FhUED
*
FRED
The algorithm is now defined as using precision D + L + 1 for its intermehate calculations, where D is the NUMERIC DIGITS setting, and L is the length of the
exponent part of the number.
a
Integer Divide and Remainder are in error if the result or partial result,
tively, is not a REXX whole number. For example:
respec-
123+30//7
was
(instead of 5 ) and is now a n error. This avoids misleading results.
Removing an item from the language does not imply that it would be removed from existing implementations.
3
Parsing
A new, explicit, “Absolute” column notation has been added:
parse arg =5 rest
is the same as
5 rest
parsearg
This adds no new function to the language, but allows the following extension:
*
Indwect column number (absolute or relative), where the value
of a variable can
be used for column specification by enclosing its name in parentheses andpreceding
it with “+”,
or “=,’. For example:
K-”,
start=7
length=5
parsearg
.
.
.
., ... . .,
..
.
.
..
= ( s t a r t ) a +(length)
is the same as
parsearg
=7 a +5
Binary String Support
Newbinary-definedstringnotation:
‘1100 0001‘b
=
’Cl‘x
New hexadecimal to binary conversionfunction:
x2b ( ’ BE’ ) -->
’ 1011111O‘
New binary to hexadecimal conversion function:
b2x ( ’ 10111110‘ ) --> ‘BE‘
Input/Output Enhancements
New STREAM built-infunction, for:
1. Formal state of a stream (Error, Ready, Not Ready, or Unknown)
2. Descriptive state of a stream (adhtional information)
3. System-dependentstreamcommands.
4
. .... .
.
,
. ,
...
..
.
.
*
New NOTREADY condition for improved error handling. For example:
signal on notready
which might be raised when end-of-file is reached on a stream.
Improved Error
*
The CALL ON condition instruction lets a subroutine be called for the ERROR,
FAILURE, HALT, or NOTREADY conditions.
The new NAME option for CALL OX or SIGXAL ON allows the specification of a
label which w
ill be the targetof the CALL or SIGNAL when the conditionis raised.
or
signal on error name baddie
*
The new CONDITION built-in function can be asked to return:
1. The name of current trapped condition
2. A descriptive string associated with the condition(for example,thederived
name of the variable whose attempted reference caused NOVALUE)
3. The instruction used to trap the condition (that is, CALL or SIGNAL)
4. Formal state of the conchtion (ON, OFF, or DELAY). DELAY is used when a
condition has been raised but bas not yet been processed.
Enhanced variable handling
Indwect lists may be used on PROCEDURE EXPOSE; variables whose names
are
enclosed in parentheses are themselves exposed and then their value is used as a
list of variables to expose. For example:
vars=' fred mark st-.
'
call mysub
mysub :
procedure expose (vars) 20s.
return
e
Indirect lists are similarly permitted
on the DROP instruction.
The VALUE function c a n now set variables:
ansther=3
€red=‘ANOTBEEl‘
say value (fred, 51
sets ANOTHER to 5, and displays 3 (the the previous value of ANOTHER).
0
The VALUE functioncannowrefertoexternalcollections
defined). For example:
of variables (system-
say value ( ’ LIB‘ , , ‘ OS2ENVIRONKENT‘ )
in the OS/2 implementation provides access to the OW2 environment variables.
This example might display
“C:\OS2”. If a second argument is given then the
variable will be set, as before.
6
,
.
...
.
7
32
a,
cb
Q,
3
cr,
c
T
0
0
cyj
X
X
u
CT
I
0
0
P
W
X
X
U
8
. .
. .
....
. ... . . . ...
. . _ ..
....
X
X
u
a
r'
>
w
a,
CT
v,
.c.r
L
i
i
0
0
l-
-.
3
k
3
k
h
h
9
+--r
C
3
0
0
X
..'
. . . , .
.. .. ... . ...
.
. . . . .
,. . . .. . . . . ..
...........
.. .. .. .. .. .
.
eL4
. . -
>
a
ud
10
.
.
.
.
, .
.. . . ... ..
.. .. ... .. .. .
.. .
11
4
L
Q )
cbg
Q
P
12
. .
. .. .
.
.........
0
.4-J
gz
-K
"., 0
m
+
n
O J
-W
s-
13
u
.. .. . . .
.
. . .
. .. ..-. .. .
. . . .
. .. . .
.
...
.......
VB
a-
+
s-
a
-c-r
X
w
+
- 0
14
L
I
I
cb
b
~~
."........................I1~.,,...., ...............
..c
......
...~...
a,
rn
0
C
3
t cd
.-rn
cn
a
cb
a-
s
15
. . . .. ...
.. .... .. ..~
..
.. . . . .
. . . . _.
n
I
0
0
6
X
X
W
CT
...
-
cn .a x
L a
QG=
ci
16
b
a,
0
+--r
a
ki
r.
h
0
>
U
a,
0
2i.
E
... .
Q
3
cn
.-S
O
Y-
I
a,
12
3
E
S
7
0
0
0
u-
U
U
w"
I-
a
n
17
..
.
- - . ,.
..
.
. .\.
c
I
-
N
a,
.
I
M
JC
JC
a
18
n
a
2
G-r
sc
13
2
G-r
cn
a,
cn
3
. .
b
0
hc-
a,
a
cn
a
9J
03
jc
*
Q
2
3
b-4 0
Iz
v,
19
.
.
.........
.
. ...
.. .
.,
20
L
0
a,
+.-r
E
3
S
cn
m
I-i
d
a,
c,
b
P II
II rG
c,
k
rd
c,
21
.
.
. . . ..
.
x
4
ri
u
4
II
II
a
4
d
0
0
0
0
0
d
d
1
.
22
El
4
p7
4
I
A
I
.
.
..
..
..
W
W
E
b
cno
23
-c-r
a .s
eu'
23
c
U
.
,.
..
.F Q,
Em
24
L
0
+
U
a,
25
c,
x
-4
a,
c
a,
c,
JZ
..
k
k
a,
k
0
k
k
a,
c
0
c)
0
L
E
a,
rd
r=
k
0
k
k
a,
G
0
26
cn
27
U
.
ul
k
rd
3
v
28
*
.
.
..
.
. .. .
. ....
....
.
0
w
o c .
u-.ru
29
30
E
a-a,
cn
w d 4 J
0 -
X k a ,
c4tr
3
I
.
.
.
. ..
.,. ..
. .
.
.......
. -. ..
....
.........
. - ._
,
. . . .
.
...
..
PC:
0
H
3
z
w
[/I
cu
0
\
\
Q
.-cn
73
0
E
E
31
.
.
.
.
.. . .
...... . ..
..
.. . ... .
32
m
Walter Pachl
IBM
Vienna Software Development Lab
Austria
,.
June 1990
33
....
.
. .
.
werview
REXX Positioning
Supported Environments
REXX Compiler Product Components
REXX Compiler Benefits
erformance Improvements
Compiler Output
Compiler Usage Scenarios
Compiier tnvscation
Differences to the CMS Re1 6 Interpreter
C
~
a to ~Compile
~ eREXX
~
CWlS R E X X Cornpiier
Walter Pachl
IBM
34
~
~
__..
.
... .
.. .
6/90
.
REXX Positioning
r-COMMAND
r-I
PROCESSOR
System Commands
JrogramLogic
yr
ProgramLogic
R
E
X
X
-
h o g r a m Logic
.. ... ..
.
....
. .. . . .
. .
f
System Command:
A p p l i c a t i o n Command:
ProgramLogic
'CASUAL' APPLICATION
+
TEXT EDITOR
APPLICATION PROTOTYPING
AND PROGRAMMTNG
aS
REXX has
been
implemented
interpreters
Excellent debugging features
.. ... .
. . .. ...
..
Very short and appealin! editlrun cycle
+
-
-
Interpreters by nature are slow !
CMS REXX Compiler
Walter Pachl
-
IBM
35
6/90
.
.
....
.
.. .. . ..
.
..
. .. . ..
. ..
..
.
,
Interpreter
~
I
Running REXX Program
Everything needs to be done at run-time
. .." .. . .
.....
.
.
.
-.
CMS REXX Compiler
Walter Pachl
IBM
36
6190
.
...
.
.
..
How does the REXX Compiler work
Two step approach
+
i
Compile
..
.. .. - -.
.. . ..
...
c
Object
----,
Program
Source
Program
----
Compiler
Program
o ProgramAnalysis
o AddressResolution
Code G e n e r a t i o n /
Doeumentation
----
Optimization
Compiler's
Run-time
Support
..
.. . . . . .
I
I
Running REXX Program
IBM
CMS REXX Compiler
Walter Pachl
37
-.
.
6/90
Supported Environments
d
CMS Re1 5
on VM/SP Re1 5 (5664-167)
and VM/SP Rei 5 HPO (5664-173)
. .
.
.. .
.
.
and follow-on releases
d
CMS Re1 5.5 (XAsupport)
on VM/XA SPI (5664-308)
and follow-on releases
+
"REXX Compiler SPE" to upgrade the operatingsystemfor
support of compiled REXX
VMlSP
VM/XA SP
Re1 5
Re1 6
Re1 I
APAR VM36990
APAR VM37841
APAR VM36991
___.-...
IBM
CMS R E X X Compiler
Walter Pachl
38
.
. .._
. -.. . .
. _..
.
.
6/90
.
REXX Compiler Product Components
+
Compile-time Part
Set of compiler phases performing ail compilation tasks
Written in C and compiled with SAA C1370 Compiler
Prerequisite
when
compiling:
IBM (3370 Library (5668-039)
+
Run-time
Support
Common routines which are invoked from compiled REXX
program
String Arithmetic, Conversions, Comparisons, Built-in
Functions, Compound Variable Access, _..
0
Extremely time critical
Can be loadedintoa
IBM
CMS REXX Compiler
Waiter Pachl
-->
written in Assembler
..
DCSS
6/90
39
.. . .
.. - . - -
+
Compiled WEXX significantlyfaster than interpreted
. . .
. ..
...
. .. . ..
..
. .. ,
+
"Pletg-Compatibility"with interpreted REXX programs
+
LanguageEquivalencewith
+
"Unreadable" REXX programs
+
Comprehensive
Program
Documentation
REXX Interpreter (SPI)
____.-.--
C M S REXX Compiler
Walter Pachl
IBM
40
6/90
7
REXX Compiler Benefits
Comprehensive REXX program documentation
Source and Cross-Reference Listings
Syntax check of whole program
More accurate messages
0
Increase
developer
productivity
Improve
program
quality
"Unreadable" compiled REXX code
Provides for REXX programintegrity
Providesforimproved
maintainai.d!t)
Protects REXX coded assets
CMS REXX Compiler
IBM
Walter Pachl
41
6/90
I
7
REXX Compiler Benefits
+
LanguageEquivalencewiththe
...
REXX Interpreter
... . ..... .. .. . .. ...
~.
.. . .
NO compiler-specific language features !
0
Minimize
migration
effort
Almost all REXX programsrununchanged
- except those with INTERPRET instructions
+
Support of SAA ProceduresLanguage
Flagging of non-SAA items (optional)
Eases reuselmigration intoother SA A environments
CMS REXX Compiler
Walter Pachl
IBM
42
-
-.
-
6/90
REXX Compiler Benefits
+
"Plug-Compatibility"withthe
...
REXX Interpreter
..
Identical external interfaces
Compiled REXX programs"transparently"replace
interpreted ones
No restriction on theirmutualinvocation
+
Compiler,Run-time,compiledprograms"exploit"
Run and usestorage also above the
Make roomforothersbelowthe
CMS REXX Compiler
Walter Pachl
IBM
43
XA
Wry:ltbyte line
line
.-
6/90
.
Significant Run-Time Performance improvements
-_
Performance gains depend heavily on the program contents
..
.
,
,
..
.
..
,....
., ....
.~.
.._
.
Programs with
a lot o f
...
TINES
faster than
Interpreter
Performance
Category
Arithmetic operations
with default precision
6
-
10+
VERY HIGH
Arithmetic operations
w i t h other precision
4
-
25
VERY HIGH
Assignments
6
-
10
VERY HIGH
C h a n g e s to variables' values
4-
6
HIGH
Constants and simple variables
4-
6
HIGH
Reuse of compoundvariables
2 -
4
W-CTUM
Host c o m m a n d s
1 -
2
Lold
-.-
-- - .
C M S R E X X Compiler
IBM
Walter Pachl
44
.
-
. . . . . ...
6/90
Significant Run-Time Performance Improvements
...
Assumptions
..
An interpreted REXX program
....
..
-
uses 12 secondsvirtual CPU
runs 60 times a day
for 30 days a month
Performance
Category
Hours/month
RUN
3
- 1.5
3
- 4.5
HIGH
1.5
- 1.2
4.5
- 4.8
VERY H I G H
1.2
-
4.8
-
MEDIUM
+
+
SAVED
6
Interpreted
+
Hourdmonth
0.6
F.6
With a performanceimprovement
CPU usage will reducefrom
to
just
IBM
CMS REXX Compiler
Walter Pachl
45
2
6
3
--
-
10
h/month
0.6 h/month
6/90
.
.
..
-
..
..
-......
. ....
Compiler Output
4
Program
documentation
e
*
4
Source
listing
Messages
Cross-reference
listing
.
.
Compiled REXX Program
Compiled
Code
Executable /370 instructions
Merspersed with invocations of run-time routines
Reentrant and relocatable
Run-time
control
blocks
Symbol tree of all program items
4
Behaves EXACTLY likeinterpreted REXX
4
"immediately"
executable
4
EXECLOADable
0
Can be loaded into an lnstallationDCSS
CMS R E X X Compiler
Walter Pachl
-
IBM
46
.
. .
. .. .
..
_.. - .
__
6/90
*"
1
.
Source Listing example
SAMPLE
DO SEL
G1
TIME: 11:35:02
CliS REXX C O M P I L E R 1 . 1 . 0
IF
EXEC
DATE: 30 Hay 1989
LINE C -+-1-+-2-+-3-+-4-+-5-1
2
3
4
5
/*
SAMPLE i n c o r r e c t REXX p r o g r a m
X/
P a r s e A r gT m p
= TRANSLATECtmp)
line.2 = LEFT(val.,2,'40')
V a l .
I
+ + + E A G G A 0 0 7 7 1 S I n v a l i d o r missing argumentcs) on built-in function
6
7
8
9
10
11
$ = EXTFUNC(line.2)
C a l lI N T F U N C 2
Exit
INTFUNK: P r o c e d u r e E x p o s e x. i
S i g n a lo nN O V A L U E
NAME my-value
I
+.++EAGGA00072SL a b e l n o tf o u n d
12
Do x . i
I
f x.i//2
/= 0 t h e n
1
13
s a y "Odd: " x . i
1
1
14
End
1
15
16
Return
17
18
my-valu: Say "NOVALUE r a i s e d at I
19
Return
20
/W
e n d o f p r o g r a m SAMPLE
I
+++EAGGA00654S Unmatched
"
sigl
"/%"
CMS REXX Compiler
Walter Pachl
IBM
47
-__
.
-
6/90
Cross Reference List example
ITEM
--
ATTRIBUTE L I N E REFERENCES
LABELS,
-
BUILT-IN FUNCTIONS, EXTERNAL
RTNS
EXTFUNC
INTFUNC
INTFUNK
LEFT
MY-VALU
MY-VALUE
TRANSLATE
EX1 RTN
EX1 RTN
LABEL
BUILT-IN
LABEL
LABEL+++
BUILT-IN
6
7
L I T STR
L I T STR
NUMBER
CONST
SYM
NUMBER
L I T STR
18
14
13
5 6
5 7 13
SIMP
SIMP
SIMP
SIMP
6(s)
lO(d)
5
18(d)
ll(u)
4
-CONSTANTS 'NOVALUE r a i s e d at: '
'
'Odd:
0
L
2
'40'
SIMPLE VARIABLES
$
I
SIGL
TMP
-STEMSANDCOMPOUND
VARIABLES
VAR
VAR
VAR
VAR
-
COMP VAR
STEM
COMP VAR
LINE. 2
VAL.
x.1
CMS R E X X Compiler
Walter Pachl
-
-
IBM
5
10 12 13 14
18
3(s) 4
5 ( ~ L)
4(s) 5
10 12 13 14
-
6/90
REXX Compiler Usage Scenarios
+
Scenario I: Existing REXX programs
0
Compile
-- >
. .
CorrectIMigrate
L
Compile and Run
0
Scenario 2:
0
*
0
Q
Newly
developed
Code
Syntax
Check
Debug
Compile
Run
REXX programs
-
with REXX Compiler
- with REXX Interpreter
with REXX Compiler
Run-time
Support
with
-
REXX Compiler and Interpreter
COMPLEMENT each other in program development
CMS REXX Compiler
Walter Pachl
IBM
49
-__.
.
..__
6/90
.
-
...~ .
Compiled REXX Programs will
+
...
Significantlysave CPU time & reduce system load
Improve program quality & increase developer productivity
6
Provideforprotection
of REXX codedassets
+
Allow is keep applications in REXX
+
Saveexpensive rewrites toother HLL’s
+
Attracttowrite
even moreapplicationsin
IBM
CMS REXX Compiler
Walter Pachl
50
REXX
-~
.-
6/90
How is a Compiled REXX program invoked
Execute:
(EXEC) SAMPLE
CMS
EXEC
h a n d l e rr e c o g n i z e st y p e
of EXEC and
i n v o k e st h e
REXX I n t e r p r e t e r
--b f o r a REXX program,
Compile:
l-7
SAMPLE
EXEC
IA
ICEXEC]
SAMPLE
A
Compiler
REXX Source
I
I
C o m p i l e d REXX
FLIP-FLOP (rename)
REXX
Compiled
Source
SAMPLE P
REXX
I
A
1-71
--+
(EXEC) SAMPLE
CMS EXEC h a n d l e rr e c o g n i z e s
SAMPLE
EXEC
as"Compiled
-+ invokes REXX Compiler'sRun-timeSupport
IBM
CMS REXX Compiler
Walter Pachl
51
---.
REXX"
..
6/90
Compiler Invocation
CMS REXX Compiler
P r o p e r t y o f IBM
L i c e n s e dM a t e r i a l s
5664-390 ( C lC o p y r i g h t
XBM Corp.1989
A l l r i g h t sr e s e r v e d .
-
S p e c i f y a program.
Then select a n a c t i o n .
Program
....
SAIIPLE-EXEC
2
S w i t c h( r e n a m e 1s o u r c ea n dc o m p i l e de x e c
3
Run a c t i vt se o u r c pe lr o g r a m
4
7
E d i st o u r c ep r o g r a m
I n s p e c ct o m p i l e lr i s t i n g
P r i n st o u r c ep r o g r a m
P r i n t c o m p i l e rl i s t i n g
8
S p e c i f yc o m p i l e ra p t i o n s
5
6
0
___________
Argument s t r i n g :
Command
Enter
ialog - REXXR
===)
F1-Help
CMS R E X X Compiler
Walter Pachl
F t z F i l e l iFs Jt = E x i t
rlt=Cancel
-
______.____.
IBM
52
6/90
Compiler Invocation Dialog - REXXD
...
CMS REXX Compiler Options Specifications
Specify which output files you
want, and their File-IDS
SAHPLE
name
Program
V Compiler listing IY/N/P)
Y Compiled1Y/N
EXEC
I
lY/Nl
N TEXT file
Fileidentifiers
EXEC
=
LISTING=
Cr
=
TEXT--
G1
===-
Specify compiler messagesto be issued
I FLAG
Minimum severity of messages to be shown II/W/EfS/T/Nl
Display messages at the terminal (Y/NI
N TERM
NSAA
SAA-compliance checking(Y/N)
specify contents of compiler listing
Y SOURCE Include source listing IY/NI
N XREF
Include cross-reference listing (Y/NI
55 LC
Number of lines per page 110-99 or, for no page headings, 0 or N )
Additional options
N SL
SupportSOURCELINE built-in function rY/Nl
Support HI immediatecommand[Y/NI
N TH
S NOC
Error level to suppress compilation Ir/W/E/S)
Special compiler diagnostics
NDUHP Produce diagnostic output (0-2047.
Command
Enter
===>
Y.
or N I
- -.
__
Fl=HelpFZ=FilelistFJ=ExitF4=SaveFSmRefrnshFh-Reset
-_
C M S REXX Compiler
IBM
Walter Pachl
53
-
...
.
6/90
. . .
Differences to the CMS Ref 6 REXX Interpreter
+
INTERPRET Instructionnotsupported
0
Rarely
used
Difficult
to implement
Diagnostic
message
issued
Compilerdoesnot
generate code
So, try to avoid it
- Interpret target'= 'expr
Call SETVAR target,expr
-- >
For a SETVAR sampleAssemblerprogram
User's Guide
see!
Reference SH19-8120
Restructure
the program
- isolateinterpretative part,
- make it aseparate program, a w !
- lettheinterpreterhandleit
IBM
CMS R E X X Compiler
Walter Pachl
54
.
._.
6/90
Differences to the CMS Re1 6 REXX Interpreter
+
...
TRACEInstruction and Built-inFunction
, .
.,
,
of performance !
Not supported in the interest
Does not change the semantics of a
REXX program
No need to change REXX program
-
TRACE
instruction
TRACEbuilt-infunction
Interpreter
default
Diagnosedwith
+
NOP instruction
"0"
"N"
an informationalmessage
PARSE
VERSION
version
REXXC370 3.46 30 Jun 1989
----. __
C M S REXX Compiler
IBM
Walter Pachl
55
..
.. ..
6/90
..
..
...... .
. ..
.
hy is REXX hard to compile
6
.
PROCEDURE is an executableinstruction
Not a syntactic boundary
Variables' life-time is dynamic
dependsoncallingsequence
- "exposure"amongprocedures
-
e
No denotation of the END of a procedure
Logical end is an executed RETURN
e
0
Control can be transferred to e v ~ t - v v ~ ~ w ~ e
even into "procedure" and loop bodies
Computed GOTO: SIGNAL VALUE
CMS REXX Compiler
Walter Pachl
IBM
56
-.
6/90
.
.. -
Why is REXX hard to compile
4
...
No data types
0
All data is "character string"
Sometimes contents mustbe "numeric",
"whole number", or "Boolean"
4
No declarations
.
Variables come and go (DROP)
Can be shared withexternalprograms (EXECCOMM)
Names of variables canbecomputed
tails of compound variables
-
Value of variables only limited by 4cmge
Storage for values must be allocated dynamically
.. .
Arithmeticprecisioncanbe
NUMERIC DIGITS
CMS REXX Compiler
Walter Pachl
IBM
set dynamically
~-
_-
6/90
Storage Requirements
4
MediumILarge
Compiles
REXX program of
4500 lines with
2500 instructions
- typically in a 4Mb virtual machine
(1Mb for (2370 Lib 4- REXX Compiler)
Storageon disk
- about 50% more thansource
Run-timestorage
- about as much as Merpreted
(2 to 4 times as large for small
and little commented programs)
+ 180 Kb for Run-time Support
CMS R E X X Compiler
Walter Pachl
IBM
.-
.._-
6190
The Astonishment Factor
Kevin Kearney
Mansfield Software Group, Inc.
Charles Daney
Quercus Systems
June 11, 1990
59
“If a feature, acci entally misused,
rently unpredictable results,
a high astonishment factor
and is therefore rnndesira
e says that
re§SiQIl];
LINEOUT’ ,[expression];
LINEOUT
LINEBUT(,)
A = LIINEQUT
A = LINEOUT(,)
CALL LINEOUT
PNEOUT
*
A = F(B)
CALL F(B)
A = F(B,C)
CALL F(B,C)
* LINEQUT(FILE,STRING)
*
Literals vs. Variables
Strengths of
* good human factors for reading
* character string orientation
* stem variables
* dynamicdata typing
* automaticstoragemanagement
* few artificial limitations
& writing
.
,. .
,.
.
.:.:....~
.
. .
Problems with the REXX Language
* scope of variables within program
* access to variables in external routines
* passing stems to subroutines
* returning stems from subroutines
* iterating over values of
a stem variable
* array subscripting
* signaYexception handling
Characteristics of the Presentation Manager
* object-oriented architecture
* rich collection of user interface elements
* message-driven design
* multi-window, multi-tasking
* single, serialized user input 'queue
62
Challenges facing REXX
* object-orientation
* multi-tasking
* event-driven programming
* modeless application design
* interprocess communication & messaging
Object orientation may be found in:
* user interface
* operating system architecture
* applications & data files as objects
* programming languages
63
What is QOP?
* data abstraction
* encapsulation
* hierarchical classes & inheritance
* polymorphism
Benefits of QQP
* closer modeling of the real world
* easier code reuse
& maintenance
* natural for user-interface programming
* more efficient (eliminate switches)
64
.. .
..
.
.
. .
Keith Watts
.
65
.
..
.
.
..
.....
. ....
. ....
..
.
In parallel with the bloom of language offerings, the specification of REXX has not stood still. IBM's SAA
procedures language specification {$6)has been revised, and specifications for other new features have
arisen unexpectedly eisewhere. Michael Cowlishaw has revised Version 3.50 capabilities specified in his
book called "The REXX Language" ($21, with Version 4.00 capabilities {93}.The MVS implementation {57}
includes features which remah to be documented in the SAA standard. Presently there are numerous
differences in the SAA and Cowlishaw definitions, and VM and MVS implementations. Furthermore, nonIBM vendor offerings have many additional refinements.
The following summarizes enhancementswhich remain to be commonly accepted:
Feature
Variable pool interface [VPII
Double-byte character set [DBCSI
Multiple segmented stacks
Function packages
Callable condition handlers
Stream I/O model
Permanent symbol pools
Dropped special characters
Bit string literals
Source
SAA
sAA
MVS
MVS
SAA, Cowlishaw 4.00
Cowlishaw 3.50, 4.00
Cowlishaw 4.00
Cowlishaw 4.00
Cowlishaw 4.00
Perhaps IBM plans to revise the SAA specification, including all of those features, and to incorporate
these consistently within its product offerings. Those of us outside l8M have no idea how many
independent language specification sources are authentic.
VM origins
IBM's VM system environment was the breeding ground for the REXX language &21. This environment
has several unique features which make the
VM REXX implementation {§8}significantly different.
The foremost difference is how I/Q is accomplished. Files are organized into fixed size records: there are
no special I/O characters such as carriage return and newline.A simple file naming conventionis used. I/O
is canducted using the stack and the EXECI'J command, rather than ianguage statements. The only
language statements which can performQ!I are the SAY statement, and the stack accessing PULL, PUSH,
and QUEUE statements. The Cowlisha:%' stream l / f 3 modei is lacking.
REXX language 1/0and environment challenges
66
.
. .. .
..
..
. ..
... ..
. .. ..
.~
..
. .
There are ether significant differences. REX)( is embedded within the VM command interpreter, which is
called CMS. As a consequence, it is already resident when a procedure request arrives. The stack is
implicitly the source of input for any commands initiated by REXX. Thus, a REXX procedure can easily
supervise the progress of commands it initiates. Furthermore, other command processors in the VM
environment are modally accessible by name, making them eligible for connectivity with the AEDRESS
statement. Console output can also be spooled to a file.
These featuresmay not be easily mimickedby REXX implementations in other system environments. This,
in combination with Cowlishaw I/O model usage, causes VM REXX users to go through a painful transition
period when they encounter other REXX implementations. Procedures which perform I/Q may require
considerable and confusing revision until these work properly in the new environment.
The Cowlishaw model for stream I/O is highly portable to a diversity of system environments. It can be
readily implemented using
standard ANSI C library services. Theprimary benefit of this model, is that all fiie
accesses can be performed using RE% procedure statements. It provides a base for productivity in file
manipulations from a human perspective, even though it may be taxing of machine resources.
Unfortunately, the Cowlishaw f/O model has not been accepted by IBM,and is noticeably absent in the
SAA language specification and all IBM implementations. These use the aforementioned SAY and stack
access statements for simple I/O. All other I/O is performed in programs developed using other language
processors.
Cowlishaw's I/O model is simple, and well defined. Still, severalaspects require special attention.
Sequential files are either organized in fixed formats, or as an unorganized character sequence with
records delimited by special end of line characters. Fixed formats predominate in IBM mainframe
environments, whereas unstructured streams prevail in small and medium scale environments. Different
methods are used to indicate the end of unstructured records. In [email protected] environments a carriagereturn, line-feed combination is usually used, but some developers consider either of these sufficient.
unix8 uniformly treats a single line-feed character as
a record divider.
Fixed length records are easily accessed, but are wasteful of space. As blanks consume a significant
amount of file space, many methods of reducing these have been devised. Leading blanks are often
replaced with tab characters. Whereas, trailing blanks are truncated during storage, and altered to pad
characters during retrieval. Further space reduction can be achieved by run-length encoding, and data
compression schemes.
All of these reduction techniques can significantly impact the portability of REXX procedures which
perform l/O using Cowlishaw's model. For example,one system the author works with decided to replace
tab characters with 10 spaces, by default.A low level override was required to disable this unsatisfactory
behavior.
I/O involving binary data values Is also troublesome. System designersmay have preemptedany binary fila
access intentions a REXX procedure developer harbors, with automatic actions performed whenever
special values arrive, andno circumventions at hand. As a general rule, the character-at-a-time functions
might be capable of binary I/O, but the line-at-a-time functions will rarely tolerate binaryvalues and are
highly unportable when used for this purpose.
REXX language i/B and environment challenges
67
.
.. .
.
. . .. . . -...
Cowlishaw's I/O model must be restricted when relative I/O is performed with console devices. Though
this can be used to effectively access a specific screen character position, users wilt not appreciate
procedures which reference position 99,999.
Input from consoles is also a nuisance. The methods for acquiring console input in VM, MVS, PC, and
unixB environments are highly unportable.
[email protected],, andother environinents enable files to be redirected as stzndard program input and output.
Thess rsdiracted files can be bsneficiaiiy linked with the default input and output streams of Cowlishaw's
I!O model. This leads to significant productivity gains, as a singie procedure can be reused for multiple
purposes simply Sy varying external input and outplrt destinations.
New probfems are introduced when default streams are eligible for redirection. Binary character values
often have special rneanings whichcannot be altered. For example, in [email protected] " 1 A " x [Ctrl-21 is an
immediate end of file character, which causes all input and output on redirected streams to cease. Also,
when defauit streams are redirected, the SAY and PULL statements may be unable to communicate
directly with the terminal user; communicatingwith file destinations instead. This requires the introduction
of console immediate stream destinations,
so procedures can explicitly communicate with the user.
ary inter-pa
Communicating between processes using a simple stream model would be beneficial, but there are
aifficulties when binary data is interchanged with other processes. How is the end of a byte sequence
indicated? IC an empty string is sent using LINEOUT, should any line ending characters be sent? When
characters arrive, shocrld special character values be translated? Other problems arise when these inter~ K X X S S cornnrunicatians proceed asynchronously, with optional exchanges of acknowledgements. Even
worse, a HEY& procedure can s a k e when a synchronous response is expected from a partner which
erroneousiy fails to respond, or if bath sides simultaneously enter receive waits.
The main problem for performing non-stream 1/O in REXX is specifications; there are none. It's 1990 and
the REXX language is as capable at I/O as rnost 3rd generation languages achievedin the 1960's, and that
presumes Cowlishaw's 1/0 model is defined. Whereas the SAA language specification and the VM and
MVS implementations consider I/O barely necessary. Apparently these groups consider I/O the privileged
domain of assembler and PU1, or perhaps that 1/8 accessing will be superceded entirely by single level
storage.
The structuring of files for direct retrieval by keyedvalues is hardly a novelty. There are more intricacies
than those involved in sequential I/O to be sure, particularly if alternate keys are permitted. Yet it is not
much to ask for the definition of k e y i n ( 1 and keyout ( ) built-in functions in Cowlishaw's next I/O model.
It would be 8 real win if keys could have variable offset and extent within records, and if non-unique keys
were permittedas well.
Cowlishaw's introduction of permanent symbol pools in Version 4.00 is an initial foray into keyed file
access. This provides an elegant disguisefor keyed accessing of structured information, without entering
the woods of access specifics. However, these permanent symbol pools can not be easily mapped to
existing keyed files.
REXX lat-igilage i/O and environment challenges
68
.
..
-
.
.
. ....
"
I .
RMational databases
SBL access ofrelational data is also well established. The conjunction of
REXX with SQLis a small leap of
the imagination. Compiled REXX and static SQL can appeal to those with high volume OLTP problems to
solve. For those with more ad hoc difficulties, the amplification of SQL semantics with REXX symbolic
transformation capabilities is clearly a breakthrough. Query clauses could be dynamically composed.
Parameterized database procedures could be considered external REXX procedures. Perhaps REXX
procedures and built-in functions could even be usedwithin selection clauses as well. Consider,
createview eurusers
as s e l e c t firstname, lastname, phoneno, country( phoneno )
from users
where assess( phoneno = "European"
..
This uses hypothetical REXX procedures called countryand assess in situ. The country procedure
transforms a phone number to a returned country name. The assess procedure analyzes values in the
phoneno column to determine if these are European. It may take awhile for the Ansi and I S 0 SQL
committeesto sanction this level of capability.
I1 screen interactions
The majority of present application interfaces are full-screen, fill-in-the-blank menus in conjunction with
function key actions. Current generation terminals are optimized for "field" modifications, which interact
with host systems using block-at-a-time transfers, instead of byte streams. REXX, as defined by SAA and
p-...
-.v.rl,sha;iJ,
:*
is unsuitable for preparing competitive full-screen interactions. TheSAY and PULL statements
permit conversational, line-at-a-time user interactions only. The Cowlishaw I/O functions permit relative
screen operations, but these are conversational requests. Neither REXX definition provides fordisplay
field accesses andblock mode transfers.
Within SAA, full-screen interactions are the domain of the dialog manager, based on IBM's proprietary
ISPF/PDF product offerings. Application portability was probably of lesser concern when this decision was
reached.
The REXX language can be easily enhanced to enable the development of full screen applications using
REXX procedures exclusively. Readers interested in studying this concept further can obtain separate
literature from the author.
Of course, individuals in the northwestern US contend that full-screen interactions are a historical artifact,
for the graphical user interface [GUI] age has arrived. SAA has an independent presentation manager
component which addresses this issue. It is the author's conjecture that window-oriented applications
could be developed in REXX exclusively, with the full range of capabilities, such as: windows, popups,
pulldowns, scroll bars.
ixels
The manipulation of graphical objects raises special challenges for REXX. A state-of-the-art graphical
display can have 1024 x 1024 pixels, with each pixel having 232 possible colorations. This is a large
hexadecimal literal string [4M bytes]. The alteration of bits can not be effectively accomplished with
b i tand, b i t o r , and bi t x o r . The modifying bit vector also has 4M bytes, and the bit-wise operation
produces a 4M byte result. Instead, an array language object should be introduced. It should also be
REXX language I/O and environment challenges
69
.
... ..
.
*
possible to indirectly establish the array's origin , so that pixel vaiues can be revised as direct memory
accesses [DMA]. The need for array accesses are required
by other problemdomains as well.
Asynchronous I/O
High performance applications require I/O operations to be overlapped with procedure execution.
Cowlishaw's i/O functions are synchronous by design2. In Version 4.00the open-ended stream() built-in
function was introduced. This rnightaccomodate asynchronous I/O. For example,
signal
on
notready
call lineout journal,"rememberthis,
please"
:*
< - - an asynchronous write request * /
do
whatever
end
if strean( journal, c, complete ) <> "READY
then
say
exit
/ * < - - assert write has completed * /
'Whoa, journal record was not written"
notready:
say Whoa, an I/O error occurred, description:"description( 'D)
A language implemente; could enable the above lineout operation t o proceed asynchronously, and
assert that the operation completed successfully in the stream function call. If an error occurred during
the i/O operation the notready condition can be signalled.
However, this is a significant departure from Cowlishaw's definitions.Procedures based on thiscapability
would be highly unportable. For the "stread journal, c, complete 1" expression is an implementationdependent extension, eventhough permitted by Cowlishaw's Version 4.00 specification.
ENVIRONMENT CHALLENGES
The REXX language is specified with no environmental dependencies. Automagically procedure source
statements are located, run-time arguments become accessible, and execution proceeds on machines
with unexhaustible memory resources. Language implementers portably translate commands and I/O
requests to native system services. R E M procedures can bedeveloped in one system, and executed on
another without source changes, or re-compilation. R E M procedure developers can be blithely unaware
of underlying system ideosyncracies.
Operating system proliferation
Every year computer corporations announce new hardware families, new operating systems, and major
advancements of existing operating environments. Presently versions of REXX are available, or
announced, for VM, MVS, OS/400, [email protected], OS2, [email protected]),Tandem, and the Amiga. Pick any two, they
are as similaras condors and kangaroos.
IThis should be done symbolically, without
introducing address manipulation capabilities..
*Some implementations may be able to implicitly perform these synchronous requests asynchronously.
For example, sequentialfile I/O in MVS is buffered externally by systemI/O services.
REXX language I/O and environment challenges
70
Naming conventions
The easiest way for system architects to establish a new nicheis toinvent a new naming convention. The
following area few illustrativeexamples:
filename filetype fiiemode
highqual.midqualf.midqual2.lowqcral.ext
C:\root\dirl\dirZ!\filename.ext
$A$DUA1::~usrgroup.usrdept,userlfilename.ext;3
\node.$disk.subvol.fiiename
These names are used to locate external REYX procedures, and to identify paths for I/O operations. Not
only must RE>O( users overcome the shock of learning a new convention when they begin to use a new
environment, but they must also locate documents describing how partially qualified filenames are
resolved. Often within several daysthey quickly retreat to their prior environment.
Environment symbol access
Most system environments have a proprietary technique of externally parameterizing run-time logical
symbols. There arethree ways that these affect REXX procedures. First,if these symbols are to influence
procedure behavior, there must be
a way to acquire the external symbol’s value [getenv]. Second, REXX
procedures are often expected to alter the value of these symbols for reference by subsequent system
commands Iputenv]. Third, REXX procedures can also be expected to permanently revise or deactivate
these symbols for upper level contexts [export, unexportl. None of these operations are identifiedin
existing language specifications.
Other language interfacing
Present language specifications enable REXX procedures to interact with programs written in other
languages as follows:
1. Commands defined to the underlying system command interpreter
2. External procedurecalls
3.Environments accessible with the ADDRESS statement
4. Symbol values and queued lines
(SAA variable pool interface fvPlI)
5. External symbol pools (Cowlishaw Version4.00p
6. Inter-process communicationsperformed via Cowlishaw I/O capabilities [ l i n e o u t / l i n e i n ]
7. Function packages (MVS)
Other capabilities should be defined.Programs initiated from REXX should be able to invoke internal and
external REXX procedures, as well as built-in functions, as though these were subroutines within the
external module. Formalinter-process communication IIPCI and remote procedure call [RPCI mechafiisms
should be specified.
Furthermore, the variable pool interface and function package definitions need to be improved so that
these mechanismscan be used with languages other
than Assembler.
BreakJinterrupt h a n d i n g
[HALT]
A HALT signal causes an abnormal changein the flow of control, at best. The implementation of HALT
handling is exposed to host mechanisms. WhenREXX relinquishes control to a system command, it may
be necessary to disable the REXX break handler until the command completes. There are smali time
~~
%ariables in external pools can be shared with parallel external procedures.
REXX language l/O and environment challenges
71
. .. . .
.. . .
. .
-.
. ,. .,
windows beforeand after the command executes where the us8r
can hit the BREAK key, and no handleris
active. This causes abrupt termination of the REXX environment, without the procedure’s HALT handler
receiving control; and REXX cleanup routines may be side-stepped. If the REXX abnormal termination
cleanup routine is performed, a new condition should be introduced called EXIT. Unlike the H A L T
condition handler, which can resume procedure execution, the EXIT handler should perform cleanup
operations only. It should not be possible to reactivate the EXIT condition after it has been raised. The
EXIT handler could also be used for normal procedure exits.
ory exhaustion
REXX procedures can sometimes exhaustavailable memory capacity. It should be possible for execution
to proceed after this event occurs. Phis could be piggy-backed onto the HALT signal handler, or a new
MEMORY signal could be introduced. The MEMORY condition handler should drop or carefully restore the
values of exposed symbols, and invokevarious other cleanup services. Afterwards,the MEMORY condition
handier should E X I T the external procedure level which encountered the event. It should not be possible
to reactivate the MEMORY condition after it has been raised; for the external procedure level which
encountered the condition.
As was mentioned earlier, the VM environment has a console spooling feature. This feature is generally
lacking, and sorely missed, in other environments. Implementers can accomodate this deficiency by
providing special journalling of REXX console activity, during procedure execution. However, there are
numerous additional upper level environment features which require emulation. These require consistent
resolution by an overallREXX system architecture.
REXX language I/O and environment challenges
72
.
..
.
EP4TFPBI LEVEL SYSTEM ARCHITECTURE
lBM’s SAA architecture was a historic milestone in the history of computing.
It provides multiple
interrelated specifications for all components of customer application systems. REXX was granted
preferred status as the procedures language within this architecture. This has turned out to be a
dadble-edged sword for the REXX language overall. Within environments which have
the fullcomplement
of SAA components, REXX benefits from its interplay with these other components. However,
in
environments lacking these componentsREXX language capabilities are noticeably deficient, as has
been described earlierin this paper.
What we as a REXX user community require is a minimal, entry-level REXX systems architecture. This
architecture should specify components exterior
to REXX facilities proper, andexplicitly identify the intercomponent exchange interfaces.The following diagramis a preliminary sketch of the componentswithin
this architecture. The formalization of this architecture would enable REXX system implementers to
significantly advance the portability of REXX procedures. Procedure developers andusers wouldbe able
to use an integrated setof components, rather than spending hours and weeks learning how to use
proprietary environment components.
Support Tools
Utilities
Interactive Help
Command
Interpreter
REXX
I
I
1
Funct iona
1
Packages
Procedure
Ca 1 1s [async h]
Commands
REXX language I/O and environment challenges
73
1
. ..
. ..
TRY LEVEL SYSTEM ARCHITECTURE
LBM’s SA4 architecture was a historic milestone in the history of computing.
It provides multiple
interrelated specifications for all components of customer application systems. REXX was granted
preferred status as the procedures language within this architecture. This has turned out to be a
double-edged sword for the REXX language overall. Within environmentswhich have the full complement
of SAA components, REXX benefits from its interplay with these other components. However, in
environments lacking these components REXX language capabilities are noticeably deficient, as has
been described earlier inthis paper.
What we as a REXX user community require is a minimal, entry-level REXX systems architecture. This
architecture should specify components exterior to REXX facilities proper, and explicitly identify the intercomponent exchangeinterfaces. The following diagram is apreliminary sketch of the components within
this architecture. The formalization of this architecture would enable REXX system implementers to
significantly advance the portability of REXX procedures. Procedure developers and users would be able
to use an integrated set of components, rather than spending hours and weeks learning how to use
proprietary environment components.
r
1
t
J
L
Command
Interpreter
L
I
Support Tools
Utilities
Interactive Help
I
k
I
REXX
I
I Functional
-l
I
1-
Packages
I Stream
1
Remote
Procedure
Ca 11s Casynchl
Spawned
Commands
REXX language I/O and environmentchallenges
73
I/O
I
CONCLUSION
The advancement of the REXX language faces numerous I/O and environment challenges. It will be best
for the REXX community at large if a single standard comes forth with robust specifications for the range of
issues addressedwithin this paper. If this standard does not materialize, then language implementers are
forced to develop independent solutions. This causes REXX users to lose countless hours revising
procedures as they port them from one environment to another. Let us be optimistic and hope that a
single, robust language standard emerges.
BIBLIOGRAPHY
[ l ] Announcement of SANPL, Announcement Letter 287-088, IBM Corporation.
[2] Cowlishaw, M.F., "The design of the REXX Language", IBM Svstems Journal, 23,N0.4, p.326. IBM
Corporation (1984).
[31 Cowlishaw, Michael F., The REXX Lanauaae: A Practical Amroach to Proaramminq, Prentice-Hall,
Englewood Cliffs, NJ (1985).
[41 Cowlishaw, Michael F., The REXX Lanauaae: A Practical Approach to Proarammina. SECOND
EDITION, Prentice-Hall, Englewood Cliffs, NJ (1990).
[51 Hoernes, G.E., "REXX on TSO/E", IBM Svstems Journal, 28, No.2, p.274,
[61 SvstemsAr>plicationArchitecture:CommonProarammins
Reference, IBM Corporation, Publication SC26-4358.
IBM Corporation (1989).
InterfaceProceduresLanauaae
171 TSO Extensions Version 2, REXX Reference, IBM Corporation, Publication SC28-1883.
[81 VM/SP System Product Intermeter Reference, IBM Corporation, Publication SC24-5329.
REXX language I/O and environment challenges
74
Presenter, not Originator
Dr. Brian Marks
Chairman, SAA Procedures Language ARB
IBM UK Laboratories Ltd
Systems Technology
Sheridan House
Winchester
11th June 1990
75
Object-Ori nted REXX
Simon C. Nash
IBM UK Laboratories Ltd
Systems Technology
Sheridan House
Winchester
8th March I990
76
This section consists of foils originally presented
SHARE
at74
in Anaheim. They describe an experimental language integrating
object oriented principles with REXX. There is currently no plan
for an IBM product in this area. Permission is hereby granted to
SLAC to reproduce these foils in the Rexx Symposium Proceedings.
77
Background
* Research project
Systems Technology (Hursley Laboratory)
Language description
* Running prototype
SCN
78
Motivation
Bring the power of OOP to REXX
Bring the usability of REXX to OOP
Extend REXX usage
- windowing,multi-media, etc.
Build on existing REXX base
-
fully upward compatible
REXX Summary
* Designed for usability
Natural typing (everything a string)
st
-cr
Comprehensive string handling and
numerics
* Procedural logic: IF, DO, SELECT, variables,
assignment
~r
Program structure: functions, subroutines
* External interfaces: functions, subroutines,
commands
* Dynamic semantics (e.g., scope, type)
_____
~
___-
__
SCN
-
-
8 Mar 90
80
OOP Summary
-k
de and data as unit
*
ta encapsulation, message passing
-34
lymorphism
sses, inheritance
-A-
C0d.e reuse
na bles concurrency
OOP Languages
Simula
rt
Smalltalk
*
c++
Objective C
~r
Object Pascal
Eiffel
*
CLOS
* etc.
_____
8 Mar 90
SCN
82
Design Goals
* REXX compatibility
Everything an object
* Integrateconcurrency
* Maintainusability
Primitive (e.g., string, number) or
programmed
A
Contain encapsulated data
+- Respond to messages by executing
methods
Automatically reclaimed
8 Mar 90
SCN
84
Messages
All REXX operators
A
New syntax:
receiver-message(arguments)
Receiver defaults to environment if omitted
* Can appear as term or clause
* Sender waits for reply
SCN
8 Mar 90
85
Methods
A
Define an object’s behaviour
-k
Contain the code of an object
~t
Established at creation or defined
dyna mica Ily
* Activated when a message received
* May produce a result object
______
___
-
8 Mar 90
SCN
86
I
Variables
*
Object variables persist for object’s lifetime
* Method variables exist during a method
activation
Object variables exposed on METHOD
instruction
Example:
method expose a b. c
8 Mar 90
SCN
87
ing Exam
new-r e c t = myrectangl e-rotate(ang1 e)
/* send " r o t a t e " message ( w i t h "angle"argument)
t o 'lmyrectangIe" * /
J/ * "new-r e c t " i s a s s i g n e d t h e r e s u l t o b j e c t
*/
myfi 1 e-open ( I read ' )
/* 9'resu1t1ti s assignedtheresultobject
or dropped i f no r e s u l t * /
ose
/* t h i s messagehas
m y f i 1 e-cl
no arguments * /
l e f t -s i d e = myrectangle-origin-x
/* send a s e r i e s of messages * /
rect-do-setleft(0)-setright(90)-setbottom(Z5)-settop(75)
/* send a s e r i e s o f messages t o " r e c t " * /
SCN
8 Mar 90
88
A REXX Example
jack
3
/* c r e a t e a number objectwiththevalue
3 */
/* ''jack" i s assignedthis 113" object */
=
jack + 4
/* c r e a t e a number object w i t h thevalue 4 */
/* send
message ( w i t h "4" argument) t o lljack" */
/* the "3" o b j e c tr e t u r n st h e sum " 7 " * /
/'* I 1 j i 1 1 I1 isassignedthe
117" object */
jill
=
It+''
say j i l l
/* send "1 ineout" message ( w i t h " j i 1 1 argument)
argument t o d e f a u l t o u t p u t streamobject */
/* " s t r i n g " message i s sent t o I l j i l 1 */
/* " 7 " returns i t ss t r i n gr e p r e s e n t a t i o n */
/* thecharacter 7 i s displayed */
If
If
~~
SCN
~
8 Mar 90
89
Classes
Many objects with the same behaviour
(methods)
Define shared behaviour in a class object
The class object creates new instances
8 Mar 90
SCN
90
Inheritance
Bank account
Savings
Current
l-----l
Repayment
Endowment
Immediate
access
90 d a y s
notice
Class hierarchy
Subclass acquires behaviour of superclass
and modifies it
* Avoids duplication
* Programming
of code
by differences
.A
Subclass sends an “inherit” message to
morethan one uperclass
ethod conflicts resolved by search order
-~h
A
Methods of the subclass can address any
method of any immediate superclass
No conflict of same-named object variables
because of scope rules
SCN
8 Mar 90
92
Object-Based Concurrency
+ Objects are the units of concurrency
*
All objects can execute concurrently
* Most objects awaiting message or reply
REPLY instruction
*
START message
93
Concurrency Usage (1)
__._____
-
* Sequential:
Sender
*
Receiver
Early reply (implicit concurrency):
Sender
Receiver
(some work)
REPLY
(wai t i ng)
0
(morework)
RETURN
(continue)
8 Mar 90
SCN
94
-.
Concurrency Usage (2)
* Start (explicit concurrency):
Sender
<----
Proxy
Receiver
reply - - - - -
SCN
8 Mar 90
95
k
Simple: objects execute concurrent
each object is sequential
: concurrency within an object,
with guarded methods
A
Mixture of simple and advanced objects
Simple objects are easier to write
Advanced objects enable more function,
better efficiency
SCN
8 Mar 90
96
Example Stack
w
/* i n i t : i n i t i a l i z e s t a c k t o empty */
method expose s . s i z e
size = 0
LO
- n i l /* i n case an empty stack popped
b-
push: add an item t o the t o p o f thestack
i
method expose s . si ze
parse a r g item
s1.7e =: s i z e + 1
s , s i z e = item
*/
*/
-.
J'" pop: returnthe t o p stackitem and remove i t */
method expose s . s i z e
rep'2y s .s i ze
i f s i z e > 0 then do /* i fs t a c k non-empty */
drop s. size
s i z e = size - 1
Ci-jd
8 Mar 90
97
-
Example Stack Usage
/* Define the stack class.
The objects init-code,
push-code, pop-code and s i z e-code containt h e
methods shown on the previousfoil. */
stack = -class-new( 'Stack')
stack-define('INIT',init-code)
stack-define( ' P U S H ' ,push- code)
stack-define( 'FOP',pop-code)
stack"define( 'SIZE',size-code)
/* Create a stack object and use it. When an
object i s created, its "init" method (if it
has one) i s run automatical 'ly. */
mystack = stack-new
mystack-'push('John Smith')
mystack"push('Bil1 Brown')
say mystack-pop /* displays "Bill Brown" */
SCN
8 Mar 90
98
t
a
i n i t: method expose balance overdraft -1 imi t
balance = 0
overdraft -1 imi t
=
0
overdraft: method expose overdraft -l i m i t
parse arg overdraft -l i m i t
d e b i t : method expose balance overdraft -1 i m i t
parse arg payee, amount
i f balance-amount >= -overdraft -l i m i t then d o
payee-credi t (amount)
balance = bal ance-amount
end
else
payee-inform('1nsufficient f u n d s ' )
returnbalance
c r e d i t : method exposebalance
parse a r g amount
balance = bal ance+amount
r e t u r n bal ance
8 Mar 90
SCN
99
/* Define the account c l a s s , * /
account = -cl ass-new( ' B a n k account )
account-define('init',init -code)
account-def ine ( ' overdraft ' ,overdraft-code)
account-define( 'debit' ,deb;t-code)
account-define('credit',credit -code)
I
/* Create some account objects and use them. * /
a
account-new
b = account-new
c = account-new
a-credit(1000.00)
a-debit(by400.00)
b-overdraft(500.00)
b-debit(~~700.00)
=
/*
/*
/*
/*
/*
/*
/*
create
new
account
* I/
create
account
new
*I
create
new
account
*/
a has 1000.00
*I
a has 600.00, b h a s 400.00 * /
b can overdraw up to 500.00 * /
b has -300.00, c has 700.00 */
SCN
8 Mar 90
100
IBM SAA REXX FOR OS/2
Rick McGuire
101
NOTES:
NOTES:
THE REXX PROCEDURES
LANGUAGE
WORKSHOP
AGENDA
e INVOKINGREXX
CREATING
SUBCOMMAND
HANDLERS
USING
REXX
EXITS
CREATING
REXX
FUNCTIONS
CREATING
MACROSPACE
A
MANIPULATING REXX
VARIABLES
NOTES:
6 return,
8 relstr) :
program MACRO.CMD
arg input
REXX
PROGRAM
return a
102
*
\
NOTES:
RXSTRiNGS
RXSTRINGS
ARE
USED
IN
REXX
A P k TO
PASS
ARBITRARY
LENGTH,
CONTENT
INSENSITIVE
CHARACTER
STRINGS
I
typedel
struct
{
ULONG slrlength: I * iength Of string * /
/ e far pointer !Q strlno
PCH
strptr;
} RXSTRING:
I
/
I
I
I
RXSTRING MACROS
SOME
HANDY
MACROS
FOR
WORKING
WITH
RXSTRlNGs
an
RXSTRIWG e11slc
7
RXNULLSTRING
Tesl II
RXZEROLENSTRING
Tell I1 an RXSTRING IC 01 zcto lcnglh
RXVALlDSTRlNC
Test II an RXSTRING hac I nan- zero lenplh
RXSTRLEN
Refurn or set the lenglh
RXSTRPTR
Retufn
MIKERXSTRING
Set (he Dointer ane lenulh 01 an RXSTRING
01
an AXSTRING
or set I h t polntrr of an RXSTRING
USING IN- STORAGE PROGRAMS
REXX
PROGRAMS
MAY
FROM STORAGE
I
rc =
ALSO
R E X X S A A ( argc,argv.
" MACRO. CMO" ,
Instore. NULL.
BE EXECUTED
DIRECTLY
I
.!
c
PROGRAM
103
NOTES:
7-.
!
NOTES:
THE REXX PROCEDURES
LANGUAGE
WORKSHOP AGENDA
c
INVOKING
REXX
CREATING
SUBCOMMAND
HANDLERS
USING
REXX
EXlTS
CREATING
REXX
FUNCTIONS
CREATING A MAGROSPACE
MANIPULATING
REXX
VARIABLES
I
I
CREATING
SUBCOMMAND
HANDLERS
rc =
'
1
REXXSAA ( argc.
argv,
" SPLIT. ED" ,
NULL, NULL,
RXCOltiMAND, NULL,
& return, & retstr) ;
NOTES:
APPLICATION
',I
LOCATt \sltinq\'
REXX hlACAO
return a
Operatng Sysfernb'
--_______
CREATING A SUBCOMMAND
HANDLER
SUBCOMMANO
HANDLERS
ARE
DECLARED
WITH
THE
RxSUECOMREGlSTER
FUNCTION
v
handler.
scbname
=
MyEdilor" ;
handler. scbdll-name =
') ;
handler.
scbdll-proc
= '' ''
handler.scbaddr
= ( PFN) 'MyEditorhandler;
I'
.
rc =
L
., . .
. ..
RxSubcomRegister( & handler) ;
NOTES:
-
CREATING SUBCOMMAND
HANDLERS
THE
CALL
TO REXXSAA
SPECIFIES
THE NAME OF
THE
ENVIRONMENT
TO BE USE0 FOR COMMANDS
SPLIT. ED' , NULL,
" MyEditor' ,
RXCOMMAND, NULL,
6 relurn, 6 retstr) ;
NOTES:
CREATING
SUBCOMMAND
HANDLERS
COMMANDS ISSUE0 FROM THE
REXX
MACRO
ARE PASSED
AS
RXSTRlNGs TO
THE
SUBCOMMAND
HANDLER
' LOCATE \string\'
I
return a
NOTES:
CREATING
SUBCOMMAND
HANDLERS
THE SUBCOMMAND HANDLER
PROCESSES
THE
SUBCOMMAND
SHORT
APIENTRY
MyEditorhandler
( PRXSTRING cmd, PUSHORT errorflag.
PRXSTRING ReturnCode) ;
t
/
/
handleeditorrubcommands
II ( command=
.__
=
LOCATE)
-
{
Operattng Systernn-
10.5
1
r
NOTES:
CREATING
SUBCOMMAND
HANDLERS
THEN
PASSES
BACK
RETURN
A
COOE
AND
ERROR INDICATOR
/
Set the return code and error flag
/
rnemcpy ( RXSTRPTR ( ReturnCode) ,
" 1" , s!rlen ( " 1" ) ) ;
RXSTRLEN ( ReturnCode) = strlen ( " 1' ) ;
errorflag = RXSUBCOM-ERROR;
return 0;
NOTES:
NOTES:
THE
REXX
PROCEDURES
LANGUAGE
WORKSHOP
AGENDA
INVOKING
REXX
CREATING
SUBCOMMAND
HANDLERS
USING REXX
EXITS
CREATING
REXX
FUNCTIONS
CREATING
MACROSPACE
A
MANIPULATING
REXX
VARIABLES
106
NOTES:
USING REXX
EXITS
REXX PROVIDES A NUMBER OF EXITS TO ALLOW AN
APPLICATION TO
SERVE
AS
A * HOST’
i
1
r
RXFHC
Process external functions
RXTCTRC
RXiHl
RXTER
Test external trace
I
~
~~
InlaiiraUon pmcesrlnp
Terminalion processinn
1
NOTES:
USING REXX
EXITS
EXIT HANDLERS ARE SPECIFIED WHEN REXXSAA IS
INVOKED
exits[Oj. sysexil-name =
SIOHANDLER’ ;
exiIa[O]. rysexit-code = RXSIO;
exils[l]. mysexit-code = RXENDLST;
f
L
re =
REXXSAA [ argc, argv,
* MACRO. CMD” , NULL, NULL,
RXCOMMAND, exits.
6 return, & retstr) ;
I
NOTES:
USING REXX
EXITS
..
EXiT HANDLERS MUST ALSO
BE
REGISTERED
BEFORE
handier. tcbname = ’ SIOHANDLER’ ;
handler.
rcbdll-name
=
;
handier. rcbdll-proc =
handler. rcbaddr = ( PFN)’SIDHandler;
-
rc =
RxExltReplsIer ( 6 handler) ;
USE
--
NOTES:
USING
REXX
EXITS
AN EXIT IS INVOKED
WHENEVER
THE
PROGRAM
REOUIRES
THAT
SPECIFIC
SERVICE
___~
EXIT HANDLER
nhln 0;
NOperatmg SystemQ'
.
.
NOTES:
THE
REXX
PROCEDURES
LANGUAGE
WORKSHOP AGENDA
INVOKING
REXX
CREATING
SUBCOMMAND
HANDLERS
USING
REXX
EXITS
1CREATINGREXXFUNCTIONS
CREATING
MACROSPACE
A
MANIPULATING
REXX
VARIABLES
r
CREATING
REXX
FUNCTIONS
REXX
EXTERNAL
FUNCTIONS
MUST
BEFORE
USE
From C
From REXX
IC
=
NOTES:
BE REGISTERED
( ' CHANGE ,
*
._____
CHNGOLL"
RxFuncAdd ( * CHANGE", ,
" CHNGOLL" , " CHANGE' ) ;
108
,
NOTES:
CREATING
REXX
FUNCTIONS
WHEN
FUNCTION
A
IS INVOKED,
THE
ARGUMENTS
PASSED AS AN
ARRAY
OF RXSTRINGS
I
ARE
I
Opratrng SystemR-
CREATING REXX FUNCTIONS
THE
FUNCTION
RESULT IS RETURNED
AS
NOTES:
AN RXSTRING
NOTES:
THE
REXX
PROCEDURES
LANGUAGE
WORKSHOP AGENDA
INVOKING
REXX
CREATING
SUBCOMMAND
HANDLERS
USING REXX
EXITS
CREATING
REXX
FUNCTIONS
CREATING
MACROSPACE
A
MAN~PULATING
REXX
VARIABLES
J
109
NOTES:
CREATING
MACRO
SPACES
FREQUENTLY
USE0
REXX
FUNCTIONS
MAY
BE LOADED
FOR QUICKER
EXECUTION
INTO
MACRO
A
SPACE
1
I
CHANGE" , " CHANGE.MAC" ,
RXMACRO-SEARCH-BEFORE) ;
RxMacroChange ( " SPLIT" , " SPLIT.MAC" ,
RXMACRO-SEARCH-BEFORE) ;
RxMacroChange (
I'
RxMacroSave ( 2, FunctionLisl,
" EOITMACS. S A V ) ;
CREATING
MACRO
SPACES
MACRO
SPACE
PROGRAMS
CAN BE INVOKE0 AS
SUBROUTINES AND FUNCTIONS
REXX
PROGRAM
MACRO
SPACE
THE REXXPROCEDURESLANGUAGE
WORKSHOP AGENDA
r
INVOKING
REXX
CREATING
SUBCOMMAND
HANDLERS
USING
REXX
EXITS
CREATING
REXX
FUNCTIONS
CREATING
MACROSPACE
A
MANIPULATINGREXXVARIABLES
110
.
..
NOTES:
NOTES:
MANIPULATING
REXX
VARIABLES
PROGRAMS
INVOKE0
FROM REXX
MAY
MANIPULATE
THE
VARIABLES
OF THE
CALLING
PROGRAM
1
C PROGRAM
NOTES:
MANIPULATING
REXX
VARIABLES
FUNCTIONS
AVAILABLE
VIA
RXVAR
Felch
.
privale'
variables
Scan Ihe entire variable
pool
Operatrng System/Z'
111
REXX FOR UNlX
Neil Milstead
112
U N I -REXX
AN
SAA COMPLIANT IMPLEMENTATION
PLATFORMS.
OVERVIEW
OF
THE
REXX
L A N G U A G E F O R ALL
UNIX
WRITTEN
I N C, O N E S O U R C E V E R S I O N P R O D U C E S M A N Y S E P A R A T E B I N A R Y
EXECUTABLES.
INPUT/OUTPUT CHARACTER
IMPLEMENTED ACCORDING
REXX LANGUAGE".
STREAMS A N D THE EXTERNAL DATA Q U E U E A R E
THE MODEL D E F I N E D B Y COWLISHAW I N "THE
TO
ADDITIONAL F U N C T I O N S
I M P L E M E N T SOME C R I T I C A L U N I X C L I B R A R Y
CALLS, TO ALLOW FULLER EXPLOITATION O F THE UNIX ENVIRONMENT-
A L L O W I M B E D D I N G UNI-REXX I N T O
APPLICATION SYSTEMS AS A MACRO FACILITY-
C
UNI-REXX
FORUMS.
PROGRAMMINGI N T E R F A C E S
HAS ALREADY G E N E R A T E D I N T E R E S T I N
113
U N I X NEWS
LANGAUGE
U N I -REXX PLATFORMS
RELEASE NUMBER
PLATFORM
DOS
COMPLETE
SUN-3
COMPLETE
SUN-4
COMPLETE
SUN 3861
COMPLETE
SCO XENIX 2 . 3
COMPLETE
SCO U N I X 3 . 2
COMPLETE
I S C 3861x
COMPLETE
HP/UX(9000)
COMPLETE
RS/6000
COMPLETE
UN I COS
COMPLETE
ENCORE
COMPLETE
SILICON
GR.
COMPLETE
NEXT
COMPLETE
RT
COMPLETE
APOLLO x500
COMPLETE
A I XI370
I N PROGRESS
APOLLO 10000
I N PROGRESS
ULTRIX(3100 9
I N PROGRESS
CONVEX
I N PROGRESS
INTERGRAF
I N PROGRESS
STARDENT
I N PROGRESS
UTS
IN
114
PROGRESS
UNI-REXX P R O G R A M EXECUTION
LACKING T H E H O O K S F O R E X E C U T I O N THAT A R E B U I L T - I N TO VM/CMSJ
UNI-REXX R E L I E S O N U N I X F A C I L I T I E S TO R U N A UNI-REXX PROGRAM.
THE I N T E R P R E T E R MAY B E R U N E X P L I C I T L Y O R I M P L I C I T L Y D E P E N D I N G
ENVIRONMENT-
ON
EXPLICIT:
RXX
RXC
RXI
PROGRAM-
REX
PROGRAM. REX
PROGRAM
INTERPRET A UNI-REXX P R O G R A M .
COMPILE A UNI-REXX P R O G R A M RUN A C O M P I L E D UNI-REXX P R O G R A M .
IMPLICIT:
FOR BSD-BASED UNIX SYSTEMSJ IMPLICIT EXECUTION IS S U P P O R T E D J
S T A R T I N G A UNI-REXX P R O G R A M W I T H A S P E C I A L D I R E C T I V E .
#!/USR/LOCAL/BIN/RXX
THE P R O G R A M
M U S T B E M A R K E D EXECUTABLE W I T H T H E CHMOD COMMAND:
CHMOD +X PROGRAM. REX
115
BY
UNI-REXX
THERE ARE
FROM WITHIN
AND
THREESEPARATE
MECHANISMS
A UNI-REXX
PROGRAM-
UNIX COMMANDS
F O R ISSUING
UNIX
COMMANDS
IMBEDDING
A COMMAND CLAUSE DIRECTLY
IN THE UNI-REXX
PROGRAM.
CLAUSES WHICH
ARE NOT UNI-REXX
INSTRUCTIONS
ARE
PASSED T O THE DEFAULT COMMAND ENVIRONMENT.
THE OUTPUT
FROM THE COMMAND WILL BEDIRECTED
TO STDOUTA U N I X COMMAND A S THE OPERAND O F THE A~~~~~~
INSTRUCTION.
COMMAND OUTPUT ALSO G O E S T O STBOUT.
SPECIFYING
UNIX
THE P O P E N O FUNCTION,
WTIH
A UNIX COMMAND OPERAND.
COMMAND OUTPUT WHICH
WOULD HAVE GONE T O STDOUT SI
PLACED ON THEEXTERNALDATAQUEUE-
USE
THE
UNI-REXX
ADDITIONAL
BUILT-IN
L I B R A R YF U N C T I O N S -
ADDITIONAL
FUNCTIONS
FUNCTIONS
A R E P A T T E R N E D AFTER STANDARD
UNIX C
.
CHDIR~TRING)
CHANGE
THE C U R R E N T WORKING
CUSERIDO
RETURN
LOGGED ON USERID.
GETCWD()
RETURN
C U R R E N T WORKING
GETENV~TRING)
RETURN
ENVIRONMENT
POPEN (COMMAND)
EXECUTE A U N I X COMMAND, PLACE I T S STANDARD
OUTPUT I N THE
EXTERNAL
DATA
QUEUE-
DIRECTORY.
VARIABLE
(E. G. PATH, TERM)
DIRECTORY
VALUE.
CHANGE THE VALUE OF AN ENVIRONMENT
VARIABLE-
117
-
UNI-REXX
I N P U T AND OUTPUT
THE UNI-REXX I
/
OMODEL
COWLISHAW.
THIS MODEL
SYSTEM,
r /o
U N L I K ET H E
IS BASED ON "THE REXX LANGUAGE"BY
CORRESPONDS CLOSELY T O THE UNIX FILE
RECORD ORIENTED I / o OF VM/CMS.
CHARACTER STREAMS
CHARACTER I
/
OFUNCTIONS
A R B I T R A R YU N I XF I L E S .
S U P P O R T THE
UNIX STDIN, STDOUT
OR
CHARIN FUNCTION
CHAROUT FUNCTION
CHARS FUNCTION
EXTERNAL DATA QUEUE
LACKING
THE "PROGRAM STACK" OF
SIMULATED BY UNI-REXX.
VM/CMS,
PARSE PULL INSTRUCTION
PULL I N S T R U C T I O N
PUSH I N S T R U C T I O N
QUEUE I N S T R U C T I O N
THE
EXTERNAL
DATA
QUEUE
1s
UNI-REXX
vs SHELL PROGRAM EXAMPLE
COMPARE
THE STRUCTURE, SEMANTICS AND READABILITY
P R O G R A M T O THAT OF A UNI-REXX
PROGRAM
OF A
SHELL-AWK
A. Here's a shell wrapper-awk p m g m the1 m a r s end dlspleys enfries trWn the Us1 ol
names and telephone numbers:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
~~
O ( # ) pdir. sh A simple phone directory searcher
# Author: W d t Novinger, January 1989
# set -x
# Unooment for deb-ng
USAGE="Usage: $0 pattern"
PHOK6ZIST=SHOKE/.phonedir
# Phone list database
#
case $# in
,
0) echo $USAGE >&2
# if no arguments, display usege
exit I ;;
#exit
and
*) ;;
eaac
#
ENTRY='grep n$*n SPROKELIST' ' # search for pattern(6)
if [ -z "$ENTRYm 1; then
echo "Sorry, don't know S * ' s number(s)"
exit 2
I1
-
echo "$ENTRYn I
# send content of ENTRY to ark
awk -P" " ' I
# tab character in double quote8
if (length($2) != 0) I
# i f there I s a home number
23
if (length(S3) != 0) # and a work number
24
%e(W)\nm, S1, SI 53
printf n%-20a %(B)
25
# no work number
else
26
. printf m%-20p %s(A)\n", $1, $2
27
28
29
30
I
I
else
. # no home number
printf m%-20s %s(W)\nm, $1, $3
,
UNIXWORLD JUNE ID00
/*
* A simple phone directory searcher
* Author: Ed Spire, June 1990
*
*/
parse arg pattraceopt
If traceopt cthen trace value traceopt/*
phonelist = "phonedir1I
if pat = 11 $1
/*
then say "usage:p pattern traceopt"
else
/*
callpopen llgrepll patphonelist
/*
if queued()=O
then say ##sorry,no match on" pat
/*
else
while
do queued()>O
/*
parse pull name ll09llx work t80911x
hfme
If home <>
thenhome = home*t
(H)
if work <> MII then work = workI1(W )
say
left(name,20)1
/work1]home
end
end
*It1
do
)*Is
119
turn on traceif req.
*/
if no arguement, exit */
if proceed
arguement,
*/
que matching lines */
no matching lines, exit
process
each
match
*/
/*
/*
/*
add phone
number identifiers
and display
line
*/
*/
*/
*/
UNI-REXX
THE PROGRAMMING
UNI-REXX
N
ITO
A
C
RUN
A
UNI-REXX
PROCESSOR.
IRXJCL
PROGRAMMING
INTERFACES
INTERFACES
ARE DESIGNED
TO ALLOW M
I BEDDN
IG
SYSTEM A S A MACRO
LANGUAGE APPLICATION
PROGRAM FROM A
C
PROGRAM.
IRXSUBCM ESTABLISH
A NEW HOST COMMAND ENVIRONMENT
COMMANDS FROM A UNI-REXX
PROGRAM-
IRXSTK
ACCESS THE
EXTERNAL DATA QUEUE FROM A
IRXEXCOM ACCESS UNI-REXX
THESE INTERFACES
VARIABLES
FROM A
C
ARE MODELLED AFTER T H O S E IN
120
TO ACCEPT
C
PROGRAM.
PROGRAM.
MVS-TSO/E REXX.
UNI
THIS
PROGRAM DISPLAYS
/*
-REXX
A
UNIX
TREE PROGRAM EXAMPLE
DIRECTORY
TREE STRUCTURE.
*
TREE displays the directory structure that exists below
the
current directory.
*
Get
*
*/
the
directory
argument
parse arg Directory.
if Directory= ' I n then Directory=
"."
/*
*
Display the directory tree for the directory passed
on the
command line
*/
call RecursiveDirectoryDisplay Directory, 0
exit
/*
* Routine to display the subdirectories for the directory
specified
*/
RecursiveDirectoryDisp1ay:procedure
/*
* Get the directory to scan and the amount
to indent arguments
*/
parse arg Directory, Indent
/*
*
List
the
*/
call popen
/*
* I f there
*/
directory
on the
external
data
queue.
'1s-1' Directory
are any entries, skip
the first non-file entry
if queued() = 0 then return
pull *
/*
* Scan the external data queue
for directory entries. They
begir. with Id'.
If a directory is found, save in the directory table.
*/
DirectoryCount = 0
do while queued() <> 0
parse pull Permissions +1 . . . . . . . Filename
if Permissions= Id' then
do
DirectoryCount = DirectoryCount + 1
DirectoryTable.DirectoryCount = Filename
end
end
.
/*
* Display each directory indented to this level awith
preceeding ' I + - - - - > ' I .
* Then list the directory's contents by calling
RecursiveDirectoryDisplay.
*/
do DirectoryIndex = 1 to DirectoryCount
say copies(' I , Indent)'+---->'DirectoryTable.DirectoryIndex
call RecursiveDirectoryDisplay
Directory'/'DirectoryTable.DirectoryIndex,
Inde nt + 6
end DirectoryIndex
return
121
UNI-REXX
TREE
TREE PROGRAM EXAMPLE OUTPUT
PRODUCED T H I SO U T P U TF R O M
A L I V ES Y S T E M :
+---- >customer.mail
>dis
+---- >apollo
+---- > u n i R E M
+---->uniXEDIT
+---->msdos
+---- >uniREXX
+--..- >uniXEDIT
+--...-
+---- >rs6000
+ - - - - >uniREXX
+----
+---->rt
+---- >uniREXX
+---- >uniXEDIT
+---- >sco
+---->uniREXX
+---- >uniXEDIT
+---->sun3
+---- >uniREXX
+---- >uniXEDIT
>sun386
+---- >uniREXX
+---- >uniXEDIT
+---... > sun4
+---->uniREXX
+---- >uniXEDIT
>samestuff
+-e--
+----
>uniXEDIT
UNI-REXX POSSIBLE EXTENSIONS
A NUMBER OF ENHANCEMENTS AND EXTENSIONS ARE PLANNED
F O R U N I -REXX.
OR
PROPOSED
NUMERIC DIGITS 99
VERSION 4
F E A T U R E S : STREAM, NOTREADYJ CALL O N J
BINARY CONSTANTS.
REXX
REXX SHELL
PROGRAMMING INTERFACES:
FUNCTION PACKAGES
VARIABLE POOL INTERFACE
EXTERNAL FUNCTIONS
OPTION MIXEDCASE
OPTION DBCS
OPTION ANSI
,
... .
(a retros
i
’!,
> i
Robert P. Q’Hxx
Lotus Development corpora tic^^
55 Cambridge Parkwc?..(
Cambridge MA 02142
617-693-527-5
[email protected]
REXX Symposium
124
FC begins work on REXX
VMlSP 3 released
Modern Programming Using REXX published
The REXX Language published
5 Personal REXX for MS-DOS from Mansfield
Software released
87 REXX designated IBM SAA Procedures Language
89 REXX removed from OS/2 Standard Edition
IBM O S 2 1.2 Extended Edition released
June 9,1990
REXX Symposium
125
Robert P.O’Hara
1991 BASIC desianated Microsoft universal macro
U
language
1992 Bill Gates repllaces Dan Quay'le on Republican
ticket
1994 BASIC designated IBM SAA supported language
1995 Instruction in BASIC required in all US schools
June 7,1990
REXX Symposium
126
Robert P. O'Hara
Stage set for explosive
BUT...
June 7,1990
Robert P. O’Hara
IBM doesn’t understand programming languages
Gave up after PUI?
Pigeonhole mentality
(applications/systems/procedures)
No HLL access to OS services
REXX not an application language
Benign neglect would have been OK
BUT...
June 7,1990
REXX Symposium
126
Robert P.O’Hara
Microsoft understands programming languages
*
Pushed BASIC with religious fervor
e
Saw REXX as a direct competitor
Realized there is war among languages
e
e
Developed a strategic plan to win the war
Lobbied application vendors to use BASIC
AND...
June 7,1990
REXX Symposium
129
Robert P. O’Hara
IBM acquiesced
REXX pulled from OS/2 SE
REXX thoroughly hidden in OS/2 EE
No REXX interfaces to most OS/2 services (DDE,
HLLAPI, APC.. .)
Bid not lobby application developers to use REXX
Did not port REXX to non-SAA platforms (DOS,
Windows, AIX)
The problem was not lack of technology
The problem was lack of vision
June 7,1990
REXX Symposium
130
Robert P. O'Hara
Realize you are not alon
Realize you can’t ignore the problem
Lobby ~
Q for
W
what you’ll need in the future
Expand established IBM forums (SHARE, GUIDE)
June 7,1990
REXX Symposium
131
Robert P. O’Hara
SLAC USE OF REXX
ON VM AND VMS
TonyJohnson
132
SLAC's use of REXX on VM
and VMS.
Tony Johnson
1lth June 1990
o What is SLAC?
Why is REXX useful to SLAC.
Interactive Data Analysis with
REXX
0 REXX for VAX/VMS
3 Some
other REXX applications.
133
Mission:
SLAC is dedicated to experimental and theoretical research in elementary particle physics and to the development of new techniques in
particle acceleration and detection.
Site sod Lacstion:
Located on 426 ILcrw of Stanford University property, the iaboratory is three miles west of the main University campus. The main
entrance is on Sand Hill W,just east of Interstate 280.
The Accelerator:
Major Facilities:
Milestans:
Length - Two miles
Beam Energy (electrons) - 5Q GeV
Beam Energy (positrons) - 50 GeV
Three magnetic spectrometers
SPEAR, an &GeV calliding-beam storage ring, 80 meters in diameter
PEP, a 32-GeV colliding-beam storage ring, 800 meters in diameter
SLC, the 100-GeV electron-positron linear coKder
1962
1966
1968
1972
1974
1976
1976
I980
1983
1987
1989
Management:
Contract execution a d start of accelerator construction
Construction completed and research begins
First evidence discovered for quarks
SPEAR operations begin
Discovery of psi particles
Discovery of charm quark and tau lepton
Nobel Prize shared by SLAC's Burton Rjchter for SPEAR research
PEP operations begin
Construction of SLC begins
Construction completed and SLC commissioning begins
SLC operations begin
Director - Burton Richter
Deputy Director - Sidney Drell
Associate Director - John Rees
Associate Director, Technid Division Kaye Lathrop
Associate Director, Research Division - Charles Prescott
Associate Director, Business &wices Division - Eugene Rickansrud
-
St&:
1350
Operatin8 Budget: $113,000,000 (FY1990)
munications: Mailing address: P.0. Box 4349, Stanford, CA 94309
Shipping address: 2575 Sand Hill b a d , Menlo Park, CA 94025
Telephone: 415/926-3300 - FTS 462-3300
Telefacsixnile: 4151323-3626,verification OR 415/926-3344
SLAC is a National Facility Operated by Stanford University
for the US Department of Energy
I
.. ...
SEI
.
i
I
i3b75
-
X
VM imdementation of IDA
User
.-
REXX
-+CMS/CP
Command Interpreter
Control Program
Data
Manager
(JAZELLE)
Physics
Analysis
Programming
Language
(IDAL)
136
Histogram
Package
Detector
Display
Package
Graphics
System
I
'soJ3euI
How is REXX interfaced?
SUBGOM(environment,routine.rc)
-
en-vironment
e
VMREXX(optio~,~ymbol,val~e)
Allows called program to
examine and mo
REXX variables.
KAG~M(file§pe~~~nvi~~me~t,rc~.
Start interpretati
of specified
file with default environment.
A
138
6E I
I
/*
A n I D A exec t o make generating tables easy.
Just type
MAKETAB <bank> <elementl> <element2>
...
Example :
MAKETAB MCHITS TRACKTYP POINTS.VOLNAME POINTS.DOMNAME
or MAKETAB MCHITS TRACKTYP POINTSIVOLNAME DOMNAME}
---. .
T o get t h e f u l l power of J A Z E L L E s t a b u l a t e f a c i l i t y you must use t h e
I D A commands TABLE a n d TABULATE.
Johnson
A uTtohnoyr :
V e r s i o n 2.00
12/12/88
S e c t i o n : Ida
T o nAyd d e d
{}
syntax
*/
Arg B a n k C o l u m n s
Create='/C=ATE'
Prefix=' '
Do w h i l eC o l u m n s / = "
Parse V a r C o l u m n s
Open
Close
-
Column C o l u m n s
= Index ( C o l u m n ,
Index ( C o l u m n ,
' { ')
' 1' )
If Open>O T h e n D o
Parse V a r Column P r e ' { 'Column
Prefix = Prefix' { 'Pre
End
If C l o s e > OT h e n
Parse V a r C o l u m n C o l u m n ' I ' P r e
' TRBLE' C r e a t e B a n k B a n k I I T r a n s l a t e ( P r e f i x ,
If R c / = OT h e nE x i t
Rc
' .' ,' { ' ) '
If C l o s e > OT h e n Do I = L e n g t h ( P r e f i x ) t o 1 by -1
If S u b s t r ( P r e f i x , I, 1)/=' { ' T h e n I t e r a t e
P r e f i x P S u b s t r ( P r e f i x , 1'1-1)
Leave
End
Create='
End
'
'TABULATE' B a n k 'DEFAULT'
If R c / = O T h e n E x i t R c
' TABULATE' B a n' kU S I N GB'a n k
E x i t Rc
Bank
140
'Column
Can REXX beinterfacedto
morecompletely?
VMS
.-
0
Need to be abletoAddress
VMS
Need to be able to tell if VMS
command was successfully
executed.
a VMS commandsneed
to be able
to writeoutput
to stack.
o Rexx needs to get information
about VMS environment.
I
142
!
I
XX3
I
Completion codes from Address VMS
After anycommand is addressed to VMS-_three
variableswillbeassignedreturncodes:
RC
= -3 (DCL-W-IVVERB)
= 0 (Success)
= 16 (Failure)
$STATUS
= complete VMS completion
code
$SEVERITY = VMS Severity code
0 = error
1 = success
2 = warning
3 = information
4 = fatal
Also when terminating REXX exec,
EXIT <status>
144
!
m
L
3
P
146
.
e
n
..
xw;L<-+
€Id=<-+
I
I
I
I
I
I
I
??Id3W<-+
3AIH3W<-+
I
I
I
I
aowm<-+
I
?IW<-+
LISP&<-+
NOI&'tl&NM30a<-+
I
I
I
i
I
I
I
=3113zvr<-+
P?3<-+
I
I
1
I
QaI<-+
(INIJXZ<-+
S&W<-+
I
I
I
I
I
I
I
3KJdLSyJ<-+
1
sMm-mnac-+
I
vaI<-+ I
I
I
M33U<-+
I
X3Q~X3VI8<-+
I
€;L3Naa<-+
I
NIXIdW<-+
--
wxazzvr z
I
II~SY<-+
3AIH3MI<-+
t
I
[XNOLI : o.crsn$xsra
/*
Rexx
*/
Curlevel=l
Offsets"
1n
Call Makedir
Do
Forever
If Q.curlevel>O Then Do
Q.curlevel=Q.Curlevel-1
Pull ' 3 'Actdir' DIR'
.
.
Say Offset
Say Offset'->'Actdir
.
'SET DEFAULT [ 'Actdir' 1 '
Curlevel = Curlevel + 1
Off set=Of f set"I "
Call Makedir
End
Else If Curlevel>l Then Do
' SET DEFAULT[ -1 '
Curlevel=Curlevel-1
Offset = Substr(Offset,l,Length(offset)-4)
End
Else Exit
End
Makedir: procedure Expose9. Curlevel
OldQ-Queued ( )
'DEFINE SYSSOUTPUT NL:'
'DEFINE SYSSERROR NL:'
'DIR/OUT-LIFO/NOHEAD/NOTRAIL
*.DIR'
'DEASSXGN SYSSOUTPUT'
'DEASSIGN SYSSERROR'
Q.
Curlevel=Queued
( ) -0ldQ
Return
i
148
. .
6F1
T h i s is t h e main HELP f i l e f o r IDA. HELP may be obtained on any I D A
command l i s t e d b e l o w . Some of t h e commands l i s t e d h o w e v e r are o n l y
a c t u a l l y a v a i l a b l e if t h e relevant module h a s been loaded w i t h I D A .
For example t h e DSP c o m m a n d s l i s t e d b e l o w a r e o n l y a v a i l a b l e i f t h e
DISPLAY package h a s been loaded.
For a n i n t r o d u c t i o n t o IDA and a general d i s c u s s i o n of K E f r i s s u e s
select INTRODUCTION from t h e i t e m s b e l o w .
AdditionalInformationAvailable:
$RETURN
ADD
CALL
DEF
ELSEIF
Belp
BXNXT
HSLICE
IDALREXX
JLIST
NEXTif
PLOT
PROJECT
mxx
SPAWN
TIMELIM
WRITE
$SIGNAL
ALPHA
CLEAR
DEL
END I F
HCAT
HIST
H SPACE
IF
JMOD
OPEN
POINTER
READ
RUN
STATUS
TOPDRAW
-- f u n c t i o n
@-command
bit functions
Bank functions
BANKLOOP BETX
CMDPEOC
CMS
CONTINUE DEBUG
DO/ENDdo DOPT ELSE DSP
EXITif
EXTERNAL F I T
GET
GO
HCOMB
HDEL
HDIV
HGE T
HMULT
HOP TN
HOUT
HREAD
HSET
HSTAT
HSUB
HWRITE
Introduction
IMMEDIATE
INDEX
INPROC
INTERPret
RON
LABEL
MAKETAB
MESSAGE
NAN0
OPENTAPE P l o t d e f i n i t i o n
PAUSE
PEEK
POKE
PROCPROC
PROCESSOR
REBIN
RECTYPE
REMOVE
RETURN
REWIND
SCAT
SIGNAL
SETPTRSET
SEGLIST
SYNONYM
TABLE
TABLELOOP
TABULATE TD
TYPE
UNFIT
VAR
WHILE
WIPE
ATTACH
CLOSE
DI R
ENDWHILE
HCLR
P F l r S e l e c t I tPe Fm3 - P r e v i o u s
Menu
P F 4 = QPuFi 7t = B a c k wPa F
r d8 = F o r w a r d
PSU5t>
Macro-read 2 F i l e s
I
150
This HELP describes the SLD shell
program, IDA, as well as the
commands for several
of the facilitiesbuilt into it by default.
The
major
sections
are :
OverviewDiscussionofthelogicalorganization
sf IDA
XDAL commands
Summary of IDAT, commands and the Jazelle
interface to IDAL
Jazelle-commands Summary of Jazelle commands.
10 commands
Input-output commands
Wandypak-commands Hiatogram manipulation commands
User interface Description of the user interfaceand assoicated
commmands
Fit-commands
Summary of the c o m n d s t o fit p l o t s
-
I
Additional
Information Available:
Jazelle-commands
Handypak-commands
Overview ICDAT,-commands
IO commands
User-Interface
Fit-commands
-
PFlmSelect
Item
PF3mPrevious
Menu
PFJxQuit
PF7-Backward
PFB=Forward
=arm=>
Macro-read 2 Files
151
Ii’
DEVELOPING FULLSCREEN
REXX APPLICATIONS
Larry Oppenheim
152
W h a t
is
XMENU?
I
A s e t o f tools making it easy t o wrap f u l l screen menus around
REXX a p p l i c a t i o n s .
I
The XHENU product has three
main
pieces:
XMEDIT
A menu p a i n t e r and menu e d i t o r .
MENUEXEC
The i n t e r f a c e between menus and R E X X .
Subroutines
A s e t o f subroutineswhichallow
h a n d ley o u re x is tin g
menus.
154
non-REXX
languages to
XMEDIT
8
B aD
s iecf i n i t i o n s :
Menus
c r e a t e d by XMEDIT c o n s i o
p
s tfr o t e c t e d
u n p r o t efcittehela
dts
have
highlighting options.
F i e l d sa r ea s s i g n e d
names t oa l l o w
read o r w r i t e t h e s c r e e n .
I
an a p p l i c a t i o nt o
Advantages:
.
The programmer d o e s n ’ t need t o know t h el o c a t i o n s
ofthedata
on thescreen.
You can e a s i l y make
t o u c h i n gt h es u p p o r t i n g
changes t o
REXX code.
I
t should be o b v i o u s t h a t
prototyping.
I
and
various
menus
without
XMENU i s g r e a t f o r r a p i d
How t o Create a Menu:
E n t e r t h e XMEDIT command (it i s to menus what XEDIT
is to ordinary flles).
.
Q u i c k ltyy p teh tee xpt o r t i o (nf i e l cda p t i o n s ,
e t c . ) on t h es c r e e n .
Transfer to edit
mode t o r e f i n e t h e r o u g h s k e t c h .
Return
to
input
mode t od e f i n ey o u fr i e l d s
a s s i g n them a t t r i b u t e s .
and
Set i n i t i a l c u r s o r p o s i t i o n .
Name t h e f i e l d s w h i c h
w
i
l
l receive or display data.
mode
T r a n s f etdori s p l a y
WYSIWYG view o f your newmenu.
155
tgoe t
an
immediate
MENUEXEC
I
A l l o w s REXX t o move d a t a back and f o r t h between t h e EXEC
and t h es c r e e n .
I
Controo
l f
the menu i s p r o v i d e di nt w o
ways b y MENUEXEC:
MENUEXEC command o p t i o n s
MENUEXEC subcommands
I
bi e
si s
ntv o k e d
by
i n t e r f a c e . Here i s anexample:
MENUEXEC
/*
usin
t hge
SUBCOM
CMS
*/
REXX a p p l i c a t i o n
MENUEXEC menuname (SUBCMDS
ADDRESS MENUCMDS
"ERRMSG MESSAGE"
"FIELDMSG NAME ' T h i s i s t h e NAME helpmsg'"
"FIELDPFK PFOl"
"REQUIRE NAME ALPHA"
n e x t subcommand
MENUEND
ADDRESS COMMAND
/*
Terminates SUBCOM i n t e r f a c e
*/
Notes on t h e above example:
The SUBCMDS o p t i o n i n i t i a t e s t h e
SUBCOM i n t e r f a c e .
The MENUCMDS e n v i r o n m e net x p e c tvsa l i d
subcommands.
MENUEND t e r m i n a t e s t h e
ERRMSG,
MENUEXEC
SUBCOM i n t e r f a c e .
FIELDMSG,
FIELDPFK
together:
and REQUIRE
-
ERRMSG d e s c r i b et h
sf e
ield
messages a r ep l a c e d
-
FIELDMSG a s s o c i a t e s a help o r
in
w i t h t h e named f i e l d . Themessage
b y one o f t h e f o l l o w i n g e v e n t s :
all
work
w h i cehr r o r
error message
is triggered
A REQUIRE c o n d i t i o nf a i l s( i n v a l i dd a t a
was e n t e r e d i n t h e f i e l d ) ,
or
The F I E L D P F K (PF 1 ) was pressed w i t h t h e
c u r s o r on t h a t f i e 7 d .
...
156
157
0
Y
L
i=
Q)
U
0
>
Q)
U
cn
I
0
0
OdL
yl
0
159
u)
3
m
c
rn
L
0
L
.
I
>
Q)
+
Q)
.0I
>
Q)
m
160
Q
0
)
Q
0
)
L
..
E
is
rc
I
*I
a
Q
i
e
w
L
a
+
0
c
a
v
0
c
v)
a
a
3
.-cn
a
L:
I-
L
L
a
a
.
I
I
Q
.-e
e
W
E
161
a
0
a
CI
a
c
w
0
rc
c
0
+.r
.
I
c
a
;i=
a
is
E“
rn
c
a
.
I
v)
5
.
'.
0
a
U
W
t
4
0
0
162
'CI
C
Q
cn
a
>
~
0
0
I
0
e
0
0
163
W
t
0
0
A
n
z
W
L
0
IK
0
cn
0
3
w
2
CI
3.
W
0
x
J
W
W
K
6
V
e
164
h
0
0
0
0
c\1
e
0
e
0
0
165
0
L
166
.
I
8
a
v)
a
167
168
..
c
Q)
f
0
.Y
c,
.
I
8
Q)
P
m
A
Q
L
I
e
2E
..
..
m
0
m
0
3
0
c
CI
v)
.-
0
.
I
Q)
LI
m
... .
.. . . . , ,.
,.
0
0
170
171
REXX
IN THREE
DIFFERENT
ENVIRONMENTS
April 261h, 1990
Mason Kelsey
172
Table of Contents
................................................
STORAGE ............................................................
CLEARlXG SCREENS ...................................................
ADDRESSIXG Ehl'1RON"S
..........................................
FUNCTIOXS NOT AVAILABLE ON ALL SYSTERlS ...........................
QUEUES (STACKS) ....................................................
REXXIIO ............................................................
HOW CAS W E JSCREASE REXXPORTABILITY? ...........................
MOVING TOWARDS SAA
Table of Contents
173
1
3
5
7
9
11
32
55
THANKS
SpeciaI thanks are due to Charlie Fowler, AVP of Systems Training, Fireman’s Fund Insurance
Company, for access to the resources necessary to write this paper.
Table of Contents
174
MOVING TOWARDS SAA
MOVING TOWARDS SAA
175
ARE WE ACHIEVING SAA?
1. REXX has been SAA Product since 1987
2. Supplants CMDs (BATS) on OS12
3. Can co-exist with
OS/2 Command Files in OS/2
4. IBM OS/2 REXX uses CMD.EXE, just like Command Files
5. Supplants CLIST and JCL (Subset?) on MVS
6 . Runs in TSO Space or Non-TSO Space (Batch) on MVS
7. Can co-exist with CLIST in MVS
8. Supplants EXEC and EXEC2 on VM
9. Can co-exist with EXEC and EXEC2 in VM
10. Learning curve much lower than C
11. Compilers or Run-Time Modules Available
HOWEVER
1. Incompatibility of file state determination, clearing screen, and other general utility type commands in 3 systems.
Not REXX's problem, but REXX portability suffers because of it
2. Over 38 commonly used REXX functions do not work in all 3 environments
3. Stacks are handled differently in all 3 environments
MVS and OS/2 have multiple stack capabilities; VM does not
MVS and VM have multiple buffer capabilities; OS12 does not
OS/2 stacks can be shared with other tasks; MVS and VM can not
4. FILE I/O is handled differently in all 3 environments
MVS EXECIO (except for DISKRU) i s a subset of VM EXEC10
No FINIS command in MVS Environment (operand of EXECIO)
Issues over Record I/O vs. Stream I/O clouds portability to OS/2
No EXEC10 command in OS/2 versions; instead has 7 functions
5. Display capture is different in all three environments
MVS uses OUTTRAP()
VM uses (STACK, (FIFO, or (LIFO operands on C P K M S commands
OS/2 usesredirection to QUEUE: device
176
MOVISG TOWARDS SAA
STORAGE
STORAGE
177
STORAGE
VM
0
0
VM REXX Execs are stored with a file type of EXEC.
EXEC2EXECs alsohave a filetypeof
EXEC. This is thereasonwhy
comment is required in the first line; to tell the two languages apart.
a
MVS
0
0
0
0
Store in EXEC PDS allocated under SYSEXEC.
in a CLIST PDS allocatedunder
in an EXEC PDS allocatedunder
MVS REXX Execs mayalsobestored
SYSPROC. They mayalsobestored
SYSPROC o r SYSEXEC.
If allocated under SYSPROC, EXEC must have “REXX” in first line comment;
otherwise the CLIST interpreter is used during implicit execution.
The dataset name can be anything, but
are highly recommended.
UserlD.EXEC o r UserlD.REXX.EXEC
Duringimplicit execution, EXEC librariesarenotcurrentlyfoundifallocated under SYSEXEC ddname unless the following command is executed:
EXECUTJL SEARCHDD(YES)
which causes the SYSEXEC files to be inserted in the search path ahead
of SYSPROC files. When REXX Execs outnumber CLIST, sometime in the
future, this search order can be made automatic.
os12
*
Store 16”s
O S 2 REXX Execs with an extension of CMD.
Command Language files also have an extension of CMD; but EXECs begin
with a comment.
0
Both CTC’s OS/2 REXX2 Source Code Execs andMansfield’s 0 9 2 REXX
Execs can be stored with any extension,if explicitly executed with that extension. If explicitly executed without a n extension, the Execs must have
a REX extension. This is the design recommended by C ishaw.
%
STORAGE
178
CLEARING SCREENS
CLEARING SCREENS
179
CLEARING SCREENS
1. MVS:
UTYTCLERTSO
Command
Aliases: K and CLEAR
Syntax: CLEAR[BEEPINOBEEP][SAVEINOSAVE]
9
[IMMEDIATE]
Defaults: NOBEEPNOSAVE
SAVE causes a paging conditionunder VTAM so thecurrent
screen can be seen; NOSAVE inhibits the paging condition
IMMEDIATE clears the screen immediately under VTAM. If not
coded the screen is not cleared until the next TPUT (from 110
commands). Should be coded with any Dialog Application.
Not an IBM TSO command
2. OSl2:
CLS Internal 0 9 2 Command
No Operands
3. VM:
VMFCLEAR or CLRSCRNCMS Commands
Both clearthe
status.
screen immediatelywhen
screen in RUNNING
VMFCLEARhas no operands and no help.
Although VMFCLEAR has always been on the CMS/SP S-disk, it
is notan IBM command. Andthere is no HELP file, and no
documentation.
CLRSCRN MORE causes a MORE... message to appear. When
the user presses CLEAR or PA2, then the screen is cleared.
CLRSCRN ? displays the help for CLRSCRN.
CLEARING SCREENS
180
ADDRESSING ENVIRONMENTS
ADDRESSING ENMROKMENTS
181
ADDRESSING ENVIRONMENTS
1. MVS Environments:
Non-TSO/E address space
TSOlE address space (TSOlE)
TSOlE address space (ISPF)
MVS (default), LINK, and ATTACH
TSO (default), MVS, LINK, and ATTACH
TSO (default), MVS, LINK, ATTACH,
ISPEXEC, and ISREDIT
2. OS/2 Environments:
Default OS/2 Command Environment
CMD (default)
SPF2 (CTC Only) PDF Look alike by CTC
ISPCIR
DM/DTL Environment
3. VM Environments:
CMS
XEDIT
COMMAND
n o operand
ISPEXEC
ISREDIT
MVS Environs
normal command processing; Exec, load module, CMS,
or CP command will go through normal search. Default
Environment.
commands received by XEDIT
commands issued are handled via SVC 202; put 'EXEC'
in front of execs and 'CP' in front of CP commands
(null); same as COMMAND; this is not the same as no
operand
switch back to previous environment
ISPF Environment
ISPF Edit Macro Environment
if MVS is running under CP, any MVS environment is
available
Use the ADDRESS command to direct a host command to other than the
fault host environment.
ADDRESSING ENVIROKMENTS
182
de-
FUNCTIONS NOT AVAILABLE ON ALL SYSTEMS
183
FUNCTIONS NOT AVAILABLE ON ALL SYSTEMS
*
*
*
*
*
*
*
*
*
*
*
*
BEEP(frequency,duration) IBM OS12
B2X(binarystring) IBM and CTC OS12
CHARIN([name][,start][,length]) IBM and CTC OS12
CHAROUT([name][,start][,length]) IBM and CTC OS12
CHARS([name]) IBM and CTC OS12
CMSFLAG(f1ag) CMS
CtATE([option(julian)]) MVS and VM
D ~ T E ( [ o p t i o n ( l ) ] ) I B M a n dCTC OS12
DlAG[rc]( .....) CMS
DIRECTORY([newdir]) IBM OS12
ENDLOCAL() IBM and CTC OS12
EXTERNALS() MVS, VM, and CTC OS/2
FILESPEC(option,filespec) IBM OS12
FIND(phrase,word) MVS, VM, and CTC OS12
JUSTIFY(string,length,[pad]) MVS, VM, and CTC
LINEIN() IBM and CTC OS12
LINEOUT() IBM and CTC OS12
LINES() IBM and CTC OS12
LINESIZE() MVS, VM, and CTC OS12
LISTDSI() MVS
LOADFUNCLIBO CTC OS1.2
MSG(”0N”I”OFF”) MVS
OS/2
OUTTRAP(”var.”,rnax-lines,”CONCAT”j“NONCONCAT”)
PROMPT() MVS
*
*
*
*
*
*
MVS
RXFUNCADD(name,module,procedure) I B M OS12
RXFUNCDROP(narne) IBM 0 9 2
RXFUNCQUERY(narne) IBM OS12
RXQUEUE(control,[queuenarne]) IBM and CTC OS/2
SETLOCAL() IBM and CTC OS/2
SHARE() CTC OS12
STORAGE([addr,length,data]) M V S a n d V M
STREAM() IBM and CTC OS12
SYSDSNO MVS
SYSVARO MVS
USERID() MVS, VM, and CTC
OS12
VALUE(ext-var,new-vaI,’OS2ENVIRONMENT’) IBM OS/2
VALUE(ext-var,new-vaI,’CMD’) CTC OS/2
X2BO CTC OS12
1. FIND() and JUSTIFY() are available on all systems, except IBM OS/2.
2. EXTERNAL() is available on all systems,except IBM OS/2, but it is only
useful on CMS, which has a terminal buffer.
3. USERID() is available on all systems, except IBM OS/2, but it is only useful
on MVS and VM.
FUNCTlOSS NOT AVAILABLE ON ALL SYSTEMS
184
QUEUES (STACKS)
QUEUES (STACKS)
.
,.
185
DATA QUEUE OR
PROGRAM STACK
Program Stack in somesystems is called an "ExternalData Queue", "Data
Queue" or, simply, "Queue". MVS manuals also refer to it as the "Data Stack".
In REXX, Queue and Stack are synonyms.
Used to receive data from a command or to pass data toone
In MVS and OS/2, additional stacks can be created although only one is active.
In MVS, use the NEWSTACK, DELSTACK, and QSTACK commands, and the
QUEUED() function. In OS/2, use the RXQUEUEO function.
LIFO (PUSH)
Next record
to be read
from the stack
FIFO (QUEUE)
QUEUES (STACKS)
.
I
record n
Program Stack
186
1
UFFERS
A buffer is a subdivision of a stack. This capability is available on M V S and
VM only. It is controlled with the MAKEBUF, DROPBUF, QBUF, and QELEM
commands, and the QUEUED() function. The command, DESBUF, is available
on VM only.
(PULL)
I
1
LIFO (PUSH)
Buffer 2; Record1
Next record
Buffer 2; Record 2
t o be read
from the stack
FIFO (QUEUE)
Buffer 2; Record n
Buffer 1; Record 1
Buffer 1; Record 2
Buffer 1; Record 3
Buffer 0; No Records
Program Stack
QUEUES (STACKS)
187
-
MAKEBUF
For MVS and VM only.
The current data queue starts with buffer 0. Executing MAKEBUF divides
the current data queue into a two buffers, only one active.
The return code is equal to the stack number.
zero RC if the command works properly.
MAKEBUF returns a non-
Do not use SIGNAL ON ERROR while executing MAKEBUF.
How many buffers with contents can be created depends upon your Region. When youexceedstorage,you
may geta REXX error message:
”Failure in System Service”.
If a buffer is created in a higher or lower EXEC, a function, or subroutine,
it is still active upon return to the other level. Data left in the stack is executed at exitfromhighestlevel
EXEC, unlessyoudoa
DESBUF o r
DROPBUF. The message ”UNKNOWN COMMAND’’ will appear if a line in
the buffer is not a valid command.
QBUF returns the number of the currently active buffer.
QELEM returns the number of records of the currently active buffer.
QUEUED() returns the number of records of all buffers in the currently active data stack.
If a PULL command exhausts the contentsof an active buffer in stack,
a
the
next time the PULL command is executed, it does.an automaticDROPBUF
and gets the top record of the next buffer, if the next buffer is not empty.
If it is not empty, no DROPBUF occurs.
MAKEBUF
RC = 1
’
STACK 1
QUEUE§ (STACKS)
188
STACK 1
DROPBUF AND DESBUF
SYNTAX: DROPBUF [N] (MVS and VM Only)
ACTION: Will release one or more buffers
DROPBUF will eliminate a buffer and the contents of it if any remain.
N, when specified, will eliminate the buffer number specified. If a buffer
exists that has a higher number, it will also be eliminated.
SYNTAX: DESBUF (VM Only)
ACTION: Deletesthecontents
program stacks
QUEUES (STACKS)
, -,.
.
189
of theconsole and
MAKEBUF
AN
ROPBUF.
VM EXAMPLE
Example from VM/CMS EXEC: LINKTO
address command ’MAKEBUF’
address command ’SET CMSTYPE HT’
address command ’EXEC10 * DISKR‘ mdisk-name ’$DISKID$’ fm ’0 ( FINIS’
saverc = rc
address command ’SET C M S N P E RT’
IF saverc \ = 0
. .
then do
IF \quiet then say ’Error’ saverc ’reading’ mdisk-name,
’$DISKID$ file’
address command ‘DROPBUF’
exit
end
PARSE PULL mdisk description
PARSE PULL lib ders
PARSE VARLIB-DEFS
global . ’START=’ pgm-name .
address command ’DROPBUF’
etc.
The excessive ”ADDRESS COMMAND” prefix was done for performance. How
does this improve performance?
QUEUES (STACKS)
190
SENTRIES
UEUEDO
SYNTAX: QUEUED() (MVS and VM Only)
ACTION:
Returns the number of lines in all the buffers of the active stack
The return code will. be0 if there is nodata in the current stack
SYNTAX:SENTRIES
ACTION:
to RC
(VM Only)
Returns the number of lines in all the buffers of the active stack
The return code will be 0 if there is no data in the current stack
Example
/* QUEUED MVS EXEC */
MAKEBUF
SAVERC = RC
X = OUTTRAP(”H0LD.”)
’LISTDS EXEC’
LIMIT = QUEUED()
DO I = 1 TO LIMIT
PULL HOLD.1
END I
DROPBUF SAVERC
EXIT
/ * SENTRIES VM EXEC “I
MAKEBUF
SAVERC = RC
’LIST ONE EXEC C (STACK’
SENTRIES
LIMIT = RC
‘ D O I = 1 TO LIMIT
PULL LINES.1
END I
DROPBUF SAVERC
EXIT
QUEUES (STACKS)
191
UFFERS
EXAMPLE
/*
REXX EXEC TO DEMO MAKEBUF, QELEM, QBUF, DROPBUF, and QUEUEDO
/*trace a*/
/*"QBUF"*/
/*queue
'Line
@ of
Buffer'
do u n t i l q u e u e d ( )
say 'Number of
"QELEM"
s a y 'Number of
"QBUF"
say 'Number of
pull var
say var
end
/* What would happen
these if
*/
/* 2 l i n e s were n o t commented?*/
RC*/
"MAKEBUF"
s a y 'Number ofbufferscreated
queueLine
1 of Buffer' RC
queue ' Line 2 of Buffer'
RC
c a l ls u b r u t l
say
i s ' RC
= 0
linesin
most c u r r e n t s t a c k
lines in
most r e c e n t l y made b u f f e r i s ' RC
c u r r e n tb u f f e r
is ' queued( )
i s ' RC
s aq!
s a y 'Number of l i n e s i n most c u r r e n t stack i s ' queued()
"QELEM"
s a y 'Number of l i n e s i n most r e c e n t l y made b u f f e r i s ' RC
"QBUF"
s a y 'Number of c u r r e n t buffer is' RC
"DROPBUF"
say 'Now a b u f f e r was dropped'
"QBUF"
s a y 'Number o f c u r r e n t b u f f e r
i s ' RC
say
exit
s u b r u t 1:
"MAKEBUF"
say 'Number o f b u f f e r s c r e a t e d
push ' Line A of Buffer' RC
push ' L i n e B of Buffer' RC
push'Line C of Buffer' RC
return
QUEUES (STACKS)
*/
is' RC
192
BUFFERS
EXAMPLE
OUTPUT
Number of buffers created 1is
Number of buffers created 2is
/*
/*
Note that the lines in Buffer
2 are PULLed LIFO
PUSHed into the buffer
Number oflines in most current stack5 is
Number of lines in most recently made buffer3 is
Number ofcurrent buffer is
2
LINE C OF BUFFER 2
because
they
*/
were
*/
Number of lines in most current stack 4 is
Number oflines in most recently made buffer2 is
Number ofcurrent buffer is2
LINE B OF BUFFER 2
Number oflines in most current stack3 is
Number of lines in most recently made buffer1 is
Number of current buffer is2
LINE A OF BUFFER 2
the
into
/*
/*
Note that the lines in Buffer
1 are PULLed FIFO because they */
were
QUEUEd
*/
Number of lines in most current stack 2is
Number of linesin most recently made buffer
is 0
Number of current buffer 2is
/* As the current buffer hasno more lines; the next
PULL essentially */
/* performs a DROPBUFand starts popping records of the next buffer
LINE 1 OF BUFFER 1
*/
Number of lines in most current stack 1is
Number of lines in most recently made buffer
1
is
Number of current buffer is1
LINE 2 OF BUFFER 1
/*
Note that because there wereno records in the stack, the DO
loop ended without another PULL to do an automatic DROPBUF
Number of lines in most current stack
0 is
Number of lines in most recently made buffer0 is
Number of current buffer 1is
Now a buffer was dropped
is 0
Number of current buffer
/*
QUEUES (STACKS)
193
”/
*/
THE CONSOLE STACK
Not available on MVS, where keyboard is typically locked until command just
VM or OS/2, data is placed in the console
entered is finished executing. On
stack by ”typing ahead”.
On OS/2, the console stack may be called the terminal input buffer, default input stream, or the external event queue.
VM PARSE PULL searches the program stack, first, then console
ond, then a VM READ on the terminal, if the stacks are empty
stack, sec-
IBM’s and CTC’s OS/2 PARSE PULL searches the data queue, first, then,
empty, searches the default input stream, then prompts at the console.
CTC’s OS/2 PARSEEXTERNAL searches theconsolestack,then,ifempty,
prompts at the console. It behaves like the VM PARSE EXTERNAL.
I
1
Pulis
from
next
Program
stack
Console
stack
2
I
PULL v a r l
QUEUES (STACKS)
194
if
YNTAX: EXTERNALSO (Onlyusefulin
VM)
ACTION: returns the number of fines in the console
stack, also called the terminal input buffer or system external event queue
If there are no lines in the stack, zero is returned
In MVS, the EXTERNALS() function always returns a zero
Example
lines = EXTERNALS()
303.55
100.999
I T 1
H
$1,304.23
o What is lines equal to in this example?
QUEUES (STACKS)
195
*
0
MAKING NEW
MVS STACKS
MVS data queues start with Stack 1. Each time you execute NEWSTACK a
new stack with the next higher number is created. Only 1 stack is active.
Reasons forusing NEWSTACK:
1. Protect elements placed on data stack on one level from another level
2. Preventelements already on stack from being used as prompts to
a
TSO Command; i.e., isolate TSO Command with NEWSTACK
DELSTACK
3. Pass datastackelements
to amodule executed froman MVS batch
EXEC executed with PGM = IRXJCL
0
0
HOWmany stacks with contents can be created depends upon your Region.
When you exceed storage, you may get a REXX error message: ”Failure
in System Service”.
If astack is created in a another EXEC, function, or subroutine, it is still
active upon moving to other levels. Data left in the stack is executed at exit
fromhighestlevel
EXEC, unlessyoudoa
DESBUF or DELSTACK. The
message ”UNKNOWN COMMAND” appears if a line in the buffer is not a
valid command.
QUEUES (STACKS)
196
MVS STACK
COMMANDS
0
e
QBUF returnstheactivebuffernumber
of theactive stack to RC. Ifno
MAKEBUF has been executed after a NEWSTACK, QBUF returns a zero.
QELEM returns the number of records of the currently active buffer
active stack to RC.
in the
Use the QSTACK command to return to RC the current stack number.
@
0
0
QUEUED() returns the number of records of all buffers in the currently active data stack only,
DELSTACK deletesthemostrecentlycreated
stack, createdwiththe
NEWSTACK command; otherwise, deletes contents of original stack.
If a PULL command exhausts the contents of an active stack the next PULL
command prompts the terminal.
If there is another non-empty stack, its
contents can not be accessed before a DELSTACK.
1-
QUEUES (STACKS)
,
,... .
Stack 1
NEWSTACK
QSTACK
RC = 1
197
NEWSTACK
EXAMPLE
/* REXX EXEC TO DEMO NEWSTACK, QSTACK, DELSTACK, and Q U E U E D O
push "SENX 'PUSHed b e f o r e f i r s t NEWSTACK' USER(STR1AAA)"
push "SEND ' PUSHed b e f o r e f i r s t NEWSTACK'
USER(STR1AAA)"
"NEWSTACK"
"QSTACK"
s a y ' A NEWSTACK h a s c r e a t e d S t a c k *
RC
say
1 of Stack' RC
queue'Line
queue'Line
2 ofStack'
RC
callsubrutl
callsubrut2
Y&ACK'*
doforever
do u n t i l q u e u e d ( ) = 0
s a y 'Number of l i n e s i n S t a c k '
RC ' i s ' queued()
s a y ' P u l l i n g from Stack' RC
i f queued() \= 0 thendo
pull var
say var
end
elsesay'NothinginCurrentStack'
end
"DELSTACK"
"QSTACK"
say
s a y ' A DELSTACK hasbeendone;returned
t o S t a c k ' RC
say
i f RC = 1 t h e n e x i t
end
exit
s u b r u t 1:
"NEWSTACK"
"QSTACK"
s a y ' A NEWSTACK h a s c r e a t e d S t a c k '
say
push'Line X of Stack' RC
push'Line Y of Stack' RC
push'Line Z ofStack' RC
return
subrut2 :
"NEWSTACK"
"QSTACK"
s a y ' A NEWSTACK h a s c r e a t e d S t a c k '
say'Nothing w i l l be p u t i n i t '
return
QUEUES (STACKS)
RC
RC
198
*/
MPLE
NEWS
A NEWSTACK has created Stack
2
A NEWSTACK has created Stack
3
A NEWSTACK has created Stack
Nothing w i l l b e p u t i n it
4
Number of l i n e s i n S t a c k
P u l l i n g from Stack 4
Nothing i n C u r r e n t S t a c k
4 is 0
/*, drop
A DELSTACK has been done; returned
Number o f l i n e s i n S t a c k
P u l l i n g fromStack 3
LINE 2 OF STACK 3
P u l l i n g from Stack 3
LINE Y OF STACK 3
P u l l i n g from Stack 3
LINE X OF STACK 3
*/
*/
t o Stack 3
/*
/*
Note r e v e r s eo r d e r
Due t o PUSH
command
*/
*/
to Stack 2
2 is 2
A DELSTACK has been done; returned
to Stack 1
PUSHED BEFORE FIRST NEWSTACK STRlAAA
COMMAND SENX
NOF
TOUND
QUEUES (STACKS)
t h a t PULL does
down t o S t a c k 3
3 is 3
A DELSTACK has been done; returned
Number of l i n e s i n S t a c k
P u l l i n g from Stack 2
LINE 1 OF STACK 2
P u l l i n g from Stack 2
LINE 2 OF STACK 2
/* Note
199
/*
/*
Execution as Commands
ofTextleftinStack
*/
*/
REDIRECTING TSO
COMMAND OUTPUT
TO DATA QUEUE
BACKGROUND:
Just as the &SYSOUTTRAP and &SYSOUTLINEn system variables in CLIST allowed the capture of any terminal output created with a WTO macro, you can
also do the same in an EXEC with the OUTTRAP() function.
SYNTAX:
OUTTRAP(”cv.”,max-lines,”CONCATI”NONCONCAT”)
ACTION:
,Captures output sent to terminal’with WTO macro
OPERANDS:
cv.
is the name of the compound variable, including period,
that will receive lines of output
max-linesmaximumnumberlinesthatarecaptured;
default is 999,999,999
CONCAT
subsequentcommands or modulesappenddisplayoutput;
CONCAT is the default
NONCONCAT subsequent commands or modules overlay previous output
After the funtion has executed, three special variables can be used:
e
e
cv.max
cv.trapped
cv.con
QUEUES (STACKS)
Maximum lines that can be captured
Number of lines captured
CONCAT or NONCONCAT. whichever set
200
/*
UTTRAPO EXAMPLE
REXX EXEC THAT DISPLAYS ALL FILES ALLOCATEDUNDER DDNAME PASSED */
arg filedd debug
if debug= 'debug' then trace i
*/
x = OU?TRAP("catch.",55) /* Capture <= 55 lines in compound variable
"listdd"
/* Command
that
output
will
captured
be
*/
DO line = 1 until line
= catch.trapped
queue catch.line
/* Put captured lines in data queue
END
*/
DO until QUEUEDO = 0
/* Scan to bottom or until filename found
*/
parse pull ddname
DD dsn volser disp .
if ddname= filedd then leave
END
if QUEUED() = 0 & ddname \= filedd,
then do
say 'No files allocated under' filedd
exit
end
"DATASETS
sayALLOCATED
UNDER "filedd"
VOLSER
say ''--------------------------------------------------DO until ddname\= f iledd & ddname \= ""
spacel = 1 1
space2 = 1 1
do until length(dsn)
+ length(space1) > 45
spacel = spacel I I
end
do until length(vo1ser)+ length(space2) > 10
space2 = space21 1 '
end
say dsn spacel volser space2 disp
parse pull ddname
DD dsn volser disp .
end
DISP"
----
"DELSTACK"
If I enter "EXECNAME ispplib", it displays, for example:
\
UNDER ISPPLIB
DISP
VOLSER
DATASETS
ALLOCATED
------
--------------------_____^______________------
SYS8.ISR.ISRPLIB
SYS9.SDSF.ISPPLIB
SYSE.COB2PLIB
QUEUES (STACKS)
. .
IGLE91
SDD032
ZTSOCO
201
----
SHR
SHR
SHR
?I
XQUEUEO
YNTAX: RXQUEUE(”action” ,queuename])
ACTIONS: Control Private Queues in OS12
ACTION OPERANDS:
Create Creates
a queue with name, queuename. If no name is
coded, REXX provides a name. Returns queuename.
DeleteDeletesnamedqueue.Returns
0 if successful.
RC = 9 means queue does not exist.
Get
Returns name of queue currently in use.
Set
Sets name of current queue to operand queuename.
Returns name of previous queuename.
Exits
Checks for existance of named queue. Returns 1 if
queue exists, 0 if it does not exist. Only available
with CTC’s OS/2 REXX.
The RXQlUEUE() function is used to controlOS/2 Private Queues by name. The
PUSH, QUEUE, and PULL commands are used to perform Queue I/O.
RXQUEUE can also be called.
Private Queue names must be unique across the entire OS/2 system.
Any lower level external process inherits asits default queue the queue in use
bytheparentprocess.Private
Queuescontinuetoexistuntilexplicitlydeleted.
In OS/2, if no RXQUEUEO function has been executed, the OS/2 Session Queue
is automatically provided and controlled by
OS/2. Its name is SESSION. All
processes in a session can access the session queue.
Private Queues are not owned by any specific process and the synchronization
of requests that update any Queue is the responsibility of the programmer.
No queue element can be less than 64 bytes or more than 64K.
QUEUES (STACKS)
202
RXQUEUEO
EXAMPLE
/" REXX EXEC TO DEMO RXQVEVE() */
/*
/" PUSH/PULL WITHOUT multiprogramming
support
/"
t idmaetp0
au( )s h
do 1000
noP
end
pull a b
say'Pushedat
/*
/*
/*
/*
I ,
PUSH/PULL WITH multiprogramming
support
No r e cr roovre r y ,
or unsupported Env t e s t s
newq = RXQUEUE('Create')
oldq = RXQUEUE('Set',newq)
tim
d aet(p
e)(u)s h
do 1000
nop
end
pull a b
s a y 'Pushed at
a b ', P u l l e d a t
c a l l RXQUEUE ' D e l e t e ' ,newq
c a l l RXQUEUE ' Set
,.oldq
QUEUES (STACKS)
.
.
.,
*/
*/
*/
"/
*/
date
/* push
and time
pass lets
some time
nothing
/* doing
/* end of loop
"/
/* p u l l them
"/
P u l l e da t ' d a t e ( )t i m e ( ) /* say now and t h e n */
/*
ab
"/
/*
/*
/*
'
C r e a t e a p r i v a t e queue
E s t a b l i s h new queue
Push d a t e and time
d a t e (t )i m e ( )
/* t e lul s e r
Destroy
unique
queue
created
*/
R e s td
eote f a uql tu e u( eo p t i o n a l )
/*
/*
203
"/
*/
*/
"/
*/
*/
*/
*/
*/
OS/2 REDIRECTION
WI[TH 'QUEUE:
4 S / 2 providesadefaultinputandoutputstream
of STDIN: and STDOUT:,
you to override the
which are from and to the console. Redirection allows
default streams with file names.
The input/output streams can also be redirected to reserve device names by using:
STDERR:
Standard error output
CON:
Display screen input and output.
Key sequence will generate an
input.
K B D:
Keyboard Input
LPTl: and LPT2:
Parallel Printer Devices
PRN:
Current default printer output (Same as LPTl:)
If input, an F6 - Enter
EOF, terninating CON as
COMl: and COM2: Asynchronous Communication Ports
AUX:
Current Async Comm Port (Same as COMl:)
NULL:
Dummy Device.
QUEUE:
REXX external data queue
If input, immediate EOF.
It is the last item that is of interest to us here.
QUEUE: gives us the capabilityof direct input/ouput to/from the REXX External
Data Queue and an OS/2 Command or load module.
For example:
'DIR
> QUEUE:'
puts the output of the DIR command in the queue, line by line.
QUEUES (STACKS)
204
CMS CQMMANDS
WITH STACK
OPERAND
QUERY, IDENTIFY, and LIST are a few of the CMS commands that can put
data into the data stack.
Data can be put into the stack in either FIFO or LIFO order
The option STACK may be used and denotes FIFO order
Examples
'QUERY DISK (STACK'
'QUERY CMSTYPE (FIFO'
'IDENTIFY (LIFO'
'LISTfile fn ft fm (STACK'
QUEUES (STACKS)
. .
205
REXX 110
REXX ! / O
206
EXECIO ACCESS
(MVS and VM)
SYNTAX:
EXEC10
nl* function [operands] [(options]
n is t h e number of lines or records; * means all
Functions:
RDR
PRT
CARD
DISKRU
DISK
DISKR
PUN
PRINT
PUNCH
APpEL/XCl
"EXECIO
..."
CON
CP
CP
FUNCTIONS AVAILABLE ONLY ON VM: CARD, PRINT, PUNCH, CP, EMSG
REXX I/O
MVS EXECIO
DISK 1 / 0
Read from disk, DISKR:
EXECIQ nl* DISKR ddname [LN] [(options E)] ]
0
0
*
e
@
n is number of lines read; * means all
LN isthestartinglinenumber
Optionson next page
If no "LN", .sequential from record 1
RC = 2 means End-of-File
Data read into the stack or REXX variable(s) (based on options)
Write to disk, DISKW:
EXEC10 nl* DISKW ddname [(options [)] ]
6
6
*
0
n is number of lines written;
* means all
File allocated by ddname and must be allocated before EXECIO.
Data written from the stack or REXX variable(s).
Writing from stack continues until null line found or null entry made
from console, if stack exhausted. Writing from a compound variable
continues until null value or uninitialized variable found.
Update disk, DISKRU:
EXECIQ nl* DISKRU ddname [LN] [(options f)] ]
*
0
m is number of lines read;
means all
LN should notbe set to a value lessthancurrent
closing and reopening the file; can cause errors
REXX I/O
208
position without
VM EXEC10
DISK 1 / 0
* Read from disk,
DISKR:
EXEC10 nl* DISKR fnft
[fm [LN]] [(options]
n - Numberoflines (* means all)
fn - Filename
ft - Filetype
fm - Filemode(default: *)
LN - Starting LineNumber
If no "LN", sequential from record 1
Data read into the stack or REXX variable(s) (based on options)
Write to disk, DISKW:
EXEC10 nl* DISKW fnft fm [LN
[FIV [Irecl]]] [(options]
FIV - Record format, Fixed or Variable
fm - Requiredbutmaybe
*
lrecl - Logical record length; default for F = 80
If "LN", over-writes from that record onward
If no "LN", appends to End-of-File
Data written from the stack or REXX variable(s) (based on options)
209
REXX 1 / 0
).
.
.
EXEC10 OPTIONS
0
STEM name.
Lines
readlwritten
to/from
stem
variables
"narne.1" to "name.n" ("narne.O"= lines read)
*
STRING data
0
FINIS
Close
after
fiie
DISKR,
Data foroutput,instreamonVM
DISKRU, or DISKW
(aliso available as VM command)
VAR name
VM line
read/written
SKIP
Skips over
coded
number
lines;
of
LIFOIFIFO
Order of lines
read
into
the
0
NOTYPE
Suppress
VM
0
BUFFER
Increases
VM
CP
*
*
EXEC10 crnd
to/drorn
variable
*
skips
to
EOF
Data
Queue
I/O error
message
ops area
from
8 K to 32K
VM editing options: FIND, LOCATE, AVOID, MARGINS, STRIP, CASE
IF VAR and STEM are not coded, records are read from or written to the Data
Queue.
In MVS, only STEM, FINIS, SKIP, LIFO, and FIFO can be coded.
IfSTEM and
FINIS are coded, FINIS is coded after. Atso, you code SKIP, LIFO, o r FIFO only
if you are accessing theData Queue.
RESX 110
210
MVS STEM AND
FINIS EXAMPLES
EXEC(R0YROGER)
”ALLOC DA(’ROY.ROGERS.BOOTS’) F(OUT1) SHR”
LINE1 = ’Pardon me, Roy, is this the cat that ate your new shoes?’
”EXEC10 1 DISKW OUT1(STEM LINE1”
EXEC(JESTER)
”ALLOC DA(JEX.DATA) F(PUNNY) SHR”
”EXEC10 1 DISKR PUNNY 8 (STEM LINE.”
”EXEC10 1 DISKR PUNNY(STEMLINE.”
lines Whichfile
of the
will
be
in
LINE.1 and .2?
EXEC(DICKENS)
”ALLOC DA(ATALEOF.TWO.CITIES) F(DICKENS) SHR”
How
many records
will
QUEUE ’It was
the
best of times,’
written?
will
be
QUEUE ’it was the worst of times,‘
QUEUE ’it was the age of wisdom,’
QUEUE”
”EXEC10 * DISKW DICKENS (FINIS’’
EXEC(PUNS)
QUEUE ’I leftmyharp
in SamClam‘sdisco’Canyoutellhowmany
QUEUE ’Repaint
and
thin
more!’
no lines
will
be written?
QUEUE ’Hangover: The wrath of grapes.’
”ALLOC DA(DARK.STORMY(NlGHT)) F(ST0RY) SHR”
”EXECIO * DISKW STORY (FINIS’’
EXEC(HUXLEY)
”ALLOC DA(’6RAVE.NEW.W’) F(FID) S H R ”
”EXECIO * DlSKR FID,
(STEM” LINE. ”FINIS”
211
Explain what is
here
happening
VAR dk ,STEM-OPTIONS
Fi:CCULLEREXEC
FIB = 'HEARTISA LONELY H'
o
were
two
deaf-mutes,'
LINE = 'There
"EXECIO 1 DISKW"FID"(VARLINE"
EXEC
HELLER
FID = 'CATCH 22'
"EXECIO 1 DISKR"FID "8(VAR L-A"
"EXECIO 1 DISKR"
FID
"(VAR L-B"
If this
is
a new
file,
what will
the
RECFM be?
o lines
Which
fileof the
be will
in L-A and L-B?
DICKENS EXEC
FIB = 'ATALEOF 2CITIES A'
LN.1 = 'It was the
best
of times,'
LN.2 = 'it was the
worst
of times,'
LN.3 = 'it was the age of wisdom,'
is value in L-A?
o
How
long
o
How
many
records
will
will
written?
be
o
What will the LRECLbe?
o
Explainwhat is
happening here
LN.99 = '/
"EXECIO * DISKW" FID "F 120",
"(STEM" LN.
HUXLEY EXEC
FID = 'BRAVE NEWW'
"EXECIO * DISKR" FID,
"(STEM" LINE. "FINIS"
R E X S 1/0
212
!
VM UNIT RECORD 1 / 0
* Read from virtual reader, CARD:
- E.g. EXEC10
CARD (STEM DECK.
* Punch to virtual punch, PUNCH:
E.g. EXEC10 1 PUNCH (VAR CARD
* Print on virtual printer, PRINT:
E.g. EXEC10
*
PRINT
Special option: CC DATAIcode
CC DATA means Carriage control is 1st byte in line
Actual CC character (e.g., 0, -, 1)
Without CC, it defaults to single spacing
REX4 1 / 0
213
VM EXAMPLES
Print all lines in the array PRINTME.n, the first byte in each lineis the carriage control character.
0
*
4
*
Write the data in variable
LETTUCE to the file SALAD
27. Close the file after this write.
DAYS 15 as record
Test if there is a device at vaddr 183. insure no CP response appears on
the screen.
ReadfromthefileMASON
WHYME onsome disk. The startingrecord
number is in variable X. Read until EOF into array E3ECAUSE.n. Close the
file when done.
Create a new variable length file with a maximum length
of 133. File ID is
C.
Data
is
in
the
program
stack.
Number
of rows in stack
OHSAY CANYOU
is in variable STACK-NUM.
KEXX 110
214
VM FINIS
SYNTAX:
FINIS fn ft [fm]
fn - Filename (can be *)
ft - Filetype (can be *)
fm - Default is A1 (can be *)
ACTION: Closes one or more open fifes
If not executed, all files closed automatically by C M S command handler at R;
message.
215
RESX 1/0
.
.
RECORD vs.
STREAM 1 / 0
M V S and VM Files usually use RECORD 110.
RECORD I/O ATTRIBUTES
1.
2.
3.
4.
FixedLengthFields
Stored with No Delimiter between Fields
Fixed or VariableLengthRecords
Stored with No Delimiter between Records
But in the micro world, it is
just as common
method of storing data, STREAM I/O.
to see an alternate (and older)
STREAM I/O ATTRIBUTES
1.
2.
3
4.
5.
VariableLengthFields
Fields Separated by a Delimiter (comma is common)
VEriableLengthRecords
Records Separated by a Delimiter (CRLF is common)
Or File may be One Long String of Fields or Characters
With STREAM 1/0 so common, there is no EXEC10 command for 0 9 2 RE%.
Instead you workwithfiles,whethertheywerecreatedwith
RECORD or
STREAM I/O techniques, as a "Stream" of Data using functions.
REXX I/O
216
WHAT ARE OS/2
I/O STREAMS?
A Stream may be:
Streams may be accessed a character at a time using:
CHARIN(), CHAROUT(), CHARS()
or a line at a time using:
LINEIN(), LINEOUT(), LINES()
o r explicitly determine and control the state of the stream with:
STREAM()
Which way you code it depends on the way the data was created o r how it will
be received.
REXX 1/0
217
LINEOUT()
SYNTAX: LINEOUT( [stream][,[linedata],line#])
ACTCON:
If not open? implicitly opens stream first time executed, for read
or write. Appends a
CRLF to the end of the ’’linedata” and writes it to the
st ream.
*
*
The only valid value for lineiff in 16”s
REXX is 1.
The stream can be written to a file, data queue, or output device. Returns
a 0 if write successful, 1 if unsuccessful. If called as a subroutine, returned
value is in RESULT.
REXX l/O
218
LINEOUT()
EXAMPLES
X = LINEOUT()
/* Opens STDOUT: and w r i t e s a n u l l s t r i n g ,
CRLF
X = LINEOUT(, 'Look, Ma, no stream! ' )
/* Writesstring-CRLF t o c o n s o l e (STDOUT:)
*/
X = LINEOUT( 'QUEUE: ' ,' F i r s t T i m e ' )
/* Opens Data Queue and w r i t e s string-CRLF
*/
*/
X = LINEOUT('C:\PATH\OLD.TXT', 'Overlay I t ' ,I)
/* Opens 0LD.TXT f i l e and o v e r l a y sl i n e 1, p o s i t i o n s t o l i n e
X = LINEOUT( ' OLD.TXT' , Change Rates ' )
/* W r i t e ss t r i n g - C R L Fo v e rs e c o n dl i n e ,p o s i t i o n st ol i n e
2
3
*/
*/
X = LINEOUT( ' OLD. TXT' , ,1)
/" No W r i t e o c c u r s , r e p o s i t i o n s
t o l i n e 1 f o r next LINEOUT() write
x = LINEOUT('OLD.TXT')
/* I f o p e n , p o s i t i o n s a t endof
f i l e and c l o s e s 0LD.TXT
*/
C a l l LINEOUT ' D O N G . X I ' , ' L i B a i ' , l
/* W r i t e s s t r i n g o v e r f i r s t l i n e
of DONG.XI, r e t u r n s 0 t o RETURN
Call LINEOUT 'LPT1: ','Du Fu'
/* W r i t e s s t r i n g t o p r i n t e r 1 (LPTl:),returns
REXX 1/0
219
0 t o RETURN
*/
*/
*/
LINEIN()
YNTAX: LINEIN( [stream] [,[line#] ,count])
CTION:
If not open, implicitly opens stream first time executed, for read
o r w-ite. Returns the next line from the stream and strips any CRLF from the
end of the line.
The only valid value for line#, if coded in 16”s OS/2, is 1. However, CTC’s
REXX allows repositioning to any valid line number in the stream.
Not coding
A count of 0 returns a null string and no characters are read.
1 meansreadonestring.Afterreadoccurs,updates
count or coding a
”count” with 0 if no lines read, 1 if one line read.
The stream can be read from a file, data queue, or input device.
Available as operand in ”PARSEVALUE LINEIN() WITH template”command to perform parsing with stream VO input.
NEXX
I/O
220
LINEIN()
EXAMPLES
X = LINEIN()
/* Opens STDIN: and reads a l i n e
*/
x = LINEIN( 'QUEUE: ' )
/* Opens Data Queueand r e a d s s t r i n g ; i f Q u e u e
is empty, f u n c t i o n */
/* g o e s i n t o w a i t s t a t e u n t i l
a l i n e i s p u t i n t o t h e DataQueue.
*/
/* Remember thatDataQueuescanbeupdated
by o t h e rp r o c e s s e s .
*/
x = LINEIN('C:\PATH\OLD.TXT')
/* I f o p e n , r e t u r n s n e x t l i n e o f f i l e
X = LINEIN('C:\PATH\OLD.TXT',5,0)
*/
/*
/* R e t u r n s N u l l V a l u e , p o s i t i o n s t o l i n e
x = LINEIN('c:\PATH\oLD.TXT',I,~)
/* R e p o s i t i o n s t o l i n e 1 and r e t u r n s
CTC's O S / 2 REXX ONLY */
5 f o r n e x t LINEIN() read
it, positionstoline
2
*/
X = LINEIN( 'Am:' )
/* r e a d s s t r i n g from d e f a u l t communication p o r t , i f l i n e n o t c o m p l e t e
/* a n dn oe r r o r ,t h e nf u n c t i o ng o e si n t ow a i ts t a t eu n t i lf i n i s h e d
22 1
REXX I/O
I
.
*/
*/
*/
SYNTAX: LINES( [stream] )
AcYloN:
Returns 1 if any data remains between the current read position
and the end of the stream; returns if no data remains. The function is used to
determine if an EOF condition exists.
e
If you explicitly specify aDeviceasthestream,the
return a 1
function will always
e
Examples
x = LINES()
/* Return a
/*
1 ifdefaultinputstream,
c u r r e n tr e a dp o s i t i o n ;
0 i f a t EOF
STDIN:, c o n t a i n s d a t a beyond
x = LINES('QUEUE:')
/* Returns a 1 r e g a r d l e s s o f c o n t e n t s of Data Queue. */
x = LINEs('C:\PaTH\oLD.mxr')
/* Returns 0 i f a t end of f i l e , o t h e r w i s e , a 1 is r e t u r n e d */
REXX 110
222
*/
*/
CHAROUT()
SYNTAX: CHAROUT( [Stream][,[String],Start])
ACTION:
If not open, implicitly opens stream first time executed, for read
or write, positioned at the end of the Stream. After each write, the write posi-
tion is incremented by the number of characters written.
If Stream not coded, the character string
output stream.
is written to STDOUT:, default
If Start is coded, and the Stream is persistent, it adjust the write position
to a positive increment from the beginning
of the Stream, and writes the
String. A 1 is the first position.
If String is not coded, the write position
nothing is writtenanda
0 isreturned.
coded, the Stream is closed.
is set to the value of start, but
If StringandStartarebothnot
The Stream can be written to a file, data queue, or output device. Returns
acount of charactersremainingafterattemptingtowriteString
to the
Stream. If called as a subroutine, returned value is in RESULT.
RESS 110
223
CHAROUT()
EXAMPLES
X = CHAROUT()
/* Opens STDOUT: and writes a null string
*/
X = CHAROUT(, 'Look, Ma,no stream! ' )
/*
Writes string to console (STDOUT:)
X = CHAROUT( 'QUEUE:' , 'First
/*
*/
Time')
Opens Data Queue and writes string
at bottom of Queue
*/
X = CHAROUT('C:\PATH\OLD.TXT','Overlay
It',l)
/+c
Opens 0LD.TXT file and overlays starting the
in first position*/
X = CHAROUT('OLD.TXT','Change
/*
x
Rates')
Writes string over 11th position thru 22nd position
*/
= CHAROUT('OLD.TXT',,S)
No Write occurs, positions
to position 5 for next CHAROUT() write
/*
*/
X = CHAROUT('OLD.TXT')
/*
If open, closes 0LD.TXT */
Call CHAROUT'DONG.XI','Wo de Bei Da de pongyou xihuan Zhongguofan.',l
/* Writes string over first CHAR
of DONG.XI, returns0 to RETURN */
Call CHAROUT'LPTl:','Annata no namae desuka?'
/* Writes string to printer (LPTl:),
1
returns 0 to RETURN
REXX 1 / 0
224
*/
CHARIN()
SYNTAX: CHARIN( [Stream][,[Start],Length])
ACTION:
If not open, implicitly opens stream first time executed, for read
or write. Returns the next Length Characters from the Stream.
If Stream is not coded, it defaults
8
to STDIN:.
Like CHAROUT(), aread-writepositionismaintainedandupdatedautomatically as reads or writes occur. You can override the read position by
coding the Start operand, if the positive value is within the range of characters remaining in the persistent Stream.
A Length of 0 returns a null string and no characters are read. Not coding
Length or coding a 1 means read one character.
The stream can be read from a file, data queue,
REXX 1 / 0
225
. .
or input device.
EXAMPLES
X = CHARIN()
/* Opens STDIN: andreadsonecharacterenteredatthekeyboard
*/
x = CHARIN('QUEUE:')
/* Opens Data Queue and reads a c h a r a c t e r , i f Queue'sempty,function
"/
/* g o e s i n t o wait s t a t e u n t i l a c h a r a c t e r i s p u t i n t o t h e D a t a Queue. */
/* Remember t h a t Data Queues canbeupdated
by o t h e p
r rocesses.
/
x = CHARIN('AUX:',,~O)
/* Reads 80 b y t e s fromcommunication p o r t ,i f 80 not a v a i l a b l e and
*/
/* no e r r o r ,t h e nf u n c t i o ng o e si n t ow a i ts t a t eu n t i l
80 received.
:;' /
x = CHARIN('C:\PATH\OLD.TXT')
;'r
/*
x
Opens 0LD.TXT f i l e and r e a d sf i r s tr e c o r d ,p o s i t i o n st o
= CHARIN('C:\PATH\OLD.TXT')
I fo p e n ,r e t u r n sn e x tc h a r a c t e r
/*
from Stream,updatesreadposition
X = CHARIN('C:\PATH\OLD.TXT',5,0)
/* R e t u r n s N u l l V a l u e , p o s i t i o n s t o 5 t h p o s i t i o n f o r n e x t
X = CHARIN( ' C : \PATH\OLD.TXT' ,1,2)
/*
2nd b y t e
"1
CHARIN()
R e p o s i t i o n s t o p o s i t i o n 1, r e t u r n s 2 b y t e s ,p o s i t i o n st o3 r db y t e
226
"/
"/
CHARS()
SYNTAX: CHARS( [Stream] )
ACTION:
Returns 1 if any data remains between the current read position
and the end of the stream; returns if no data remains. The function i s used to
determine if an EOF condition exists.
If you explicitly
return a 1.
e
specifyaDeviceasthestream,thefunctionwillalways
Examples
X = CHARS( )
/* Return a 1 i fd e f a u l ti n p u ts t r e a m ,c o n t a i n sd a t a ;o t h e r w i s e ,
x
= CHARS(
'QUEUE: ' )
/;: Returns a 1 r e g a r d l e s s of contentsofData
X = CHARS( ' C : \PATH\OLD.TXT' 1
/;: Returns 0 i f a t end of f i l e , o t h e r w i s e ,
Queue.
0
*/
a c o u n t - o f t h e number of
t h e Stream i s t r a n s i e n t ,
c h a r a c t e r sr e m a i n i n gi nt h eS t r e a m .I f
/" t h a t i s t h e t o t a l number of c h a r a c t e r s . I ft h e Stream i s p e r /;'; s i s t e n t , i t is theremainingbytes
from t h e r e a d - w r i t e p o s i t i o n .
/+:
REXX 1/0
227
*/
*/
*/
*/
*/
EAMO
(StrmName [J S
1
D I C, StrrnCrnd I])
CTIQN: Returns a stringdescribing the state of,
or result of operation on, the ”StrrnName”
Operands
S - State
D - Description
C
- Command
Returns a message string indicating the stateof the Stream.
Default.Messagesinclude:
ERROR
NOTREADY
READY
UNKNOWN
An error has occurred
Normal I/O not possible
Normal I/O possible
Stream is closed
Also returns state of Stream followed by a colon and more
info about ERROR and NOTREADY states
Executes StrmCmd against Stream. Commands include:
OPEN
OPEN
READ
OPENWRITE
CLOSE
Explicitly
opens
Stream
for
read
and
write
Opens forreadonly
Opens forwriteonly
Closes
Stream
the and
returns
”READY”,
or null string if unsuccessful
SEEK offset
Moves
read-write
position
relative
to currentposition,thestart
or the end ofthe
Stream. Offset can be prefixed with:
= Offset from
beginning
of Stream.
Default.
0
< Offset fromend of Stream.
f Offset forward from current position.
* - Offset backwardfromcurrentposition.
QUERY EXISTS Returns full path of Stream, if it exists; null
if not.
QUERY SIZE
Returns
size
bytes
in
of persistent
a
Stream.
QUERY DATETIME Returns the date/time stamp of a Stream.
The 3 QUERY command are not available with CTC’s O W 2 REXX.
HEXX 110
228
HOW CAN WE INCREASE REXX PORTABILITY?
WISH LIST
1.
2.
3.
4.
5.
Provide a prepro e:-essor capability; modelled after C.
Provide BAT or CMD to REXX.CMD Convert Utility.
Provide EXEC2 to R E M EXEC Convert Utility.
Provide CLlST and JCL to EXEC(REXX) Convert Utility.
Provide simi tar methods
of determiningfilestates,etc.(Mustputpressure on Environment Support People; Not REM’s problem).
6. Provide multiple stack capability to VM environment.
7. Provide NEWSTACK et a/ commands for OS/2.
8. Provide OUTTRAP() function on VM and OS/2 for capturing displays.
9. Provide EXEC10 command (as subroutine?) on OS/2 for Record 110.
10. Expand on the EXECIO operands (STRING, VAR, SKIP, LIFOIFIFO, and editing options) for MVS and OS/2.
11. Provide FINIS command on MVS and OS/2; to ease conversion from VM to
MVS or OS/2.
12. Provide DISKRU on VM and 0 9 2 version of EXECIO.
13. Provide a SAYNR command that displays text without a carriage return, to
ease conversion from CLlST (with WRITENRs) to EXEC.
14. Provide the ability in MVS of inserting High/Non-Display/Normal Attributes
in SAY text as can be done in VM with ’1DOx’X. Provide simular capabilities on OS/2.
15. Eliminate synonyms for Data Queue: Program Stack, External Data Queue,
Queue, Stack, etc. in documentation.
16. Add Binary String type to MVS and VM, along with a function
to convert
Binary to Hexadecimal.
17. CTC might create synonym of OS2ENVIRONMENT for their CMD operand
of the VALUE function to be compatible with IBM 0 9 2 . On the other hand,
it would make more sense if IBM made the synonym of CMD available.
18. Providea
LINESIZE(),EXTERNALS(),
FIND(), JUSTIFY(), and USERID()
function on IBM’s OS12 REXX.
19. Provide a julian date function on 0 9 2 REXX (IBM and CTC).
20. Provide a language date function on MVS and VM.
21. Provide a beep function on MVS and VM.
22.Establisha REXX User’s Group that will maintain a library
of programs,
functions,andsubroutinesoutside
of Mansfield, CTC, IBM, SHARE, or
GUIDE.
HOW CAN WE ISCREASE REXX PORTABILITl?
230
Dept. 3477. P . 0 . Box 37QOO San Francisco, CA 91137
Ackerman, Alan
BAY on VMSHARE ADSE, Bank of America
675-4358
1555 Berger Dr. Bldg.11-3rd Floor, San Jose CA 95112
Agui3.a~, Ben
405-299-4381 Sr. Prog. Analyst, Santa Clara County
18311 Baylor Ave., Saratoga, CA 95070
Aitken, David
408-866-8334 Staff Systems Programmer, Amdahl
SLAC, 2575 Sand Hill Road, Menlo Park, CA
94025
Aston, David
[email protected],SLAC
920-2457
41.1 Tumey St. I Sausalito, CA 94965
Bailey, Tom
Programmer, Log.i.ca1C o n d u s i o n . s
332-8495
482 Gaviota, Long Beach, CA 90802
Bakcr, Mark
Douglas
213-593-8838 Computing Engineer, McDonnell
Baldwin, Chuck 1327 Corte De Los Vecinos, Walnut Creek, CA
94598
256-1195
V.P. Yfktg., Taliesin, Inc.
Barnett, Mark
451 Alger Drive, P a h Alto, CA 94306
494-8074
WB(_§LAW Programer, SLAC
Berger , Ramon
STLAC, Bin 71, 2575 Sand Hill Road, Menlo Park, CA94025
926-3446
[email protected]
Programer, SLAC
Boeheim Chuck
Bin 97, SLAC, 2575 Sand Hill Rd,&!enlo Park CA 94-25
926-4640
B O E H E I M @ S ~ - ~ ~ T JProgramser
I
,SuC
2304 Wooster Ave., Belmont, CA 94002
Bowlby, Gavin
592-0808
Staff Design Engineer, Amdahl
1240 Hobart St., Menlo Park, CA94025-5517
Brink, Ed
322-8113
MCI:EBRINK,ConpuServe:76555,422 Brink and Associates
PO Box 3408, San Jose CA 95156
Buder, Pat
408-251-2108 Section Mgr., Safeway
Cava, Phil
1250 E. Arques MS/201, Sunnyvale, CA 94086
408-746-8544 Sr. Systems Programmer, Amdahl
99 Pacific St.Suite 155A, Manterey, CA 93940
Cholar, Craig
408-655-4000 [email protected] Sys.Prog,Defense Manpwr-Data Ctr.
Cif
onelli
, John 6300 N. River Rd., Rosemont, IL 60018
708-696-4800 uunet.!wrkgrp!jac Software Mgr, Workstation Grp.
Clancey, Patrick PO Box4349 #50, Stanford, CA 94309
926-2339
[email protected]~ Systems Programmer,
SLAC
Coffee, Peter
4131 Michelle Dr., Torrance, CA 90503
213-371-8096 MC1:Peter Coffee Compuserve:76344,3161 Analyst,PCWeek
Cole, Creswell
1260 E . Arques, MS/205, Sunnyvale, CA 94086
408-746-4877 Software Engineer, Amdahl Corp.
Coussens, Irene Bin 97, SLAC, 2575 Sand Hill Rd., Menlo Park, CA94025
926-2842
IRENQSLACVM
Programmer, SLAC
Cowlishaw, Mike IBM Hursley Park, Winchester,
UK
+44-962-844433 [email protected] IBM Fellow, IBM
UM Laboratories
Dager, Cathie
SLA? Bin 97, 2575 Sand' Hill
Rd, Menlo Park, CA
94025
415-926-2904
[email protected] Scientific Programmer, SLAC
Dager, Terry
150 Spear St, San Francisco, CA 94105
415-543-9320
Tesseract
Daney , Charles
19567 Dorchester D r , Saratoga, CA 95070
408-257-3697
Quercus Systems
Downey , Teresa
SLAC, Bin 97, 2575 Sand Hill Rd. Menlo Park, CA94025
926-2903
[email protected]
Programmer Analyst, SLAC
Dunkel, Daniel 1040 Marina Village Pk~,Alameda,CA 94501
748-5244
Director, Mktg./Sales, Command Technology Corp.
Erickson, Bruce 857 Serra St, Stanford, CA 94305
725-1785
[email protected] Micro Support, Stanford Univ.
Estes, Will
12301 DeSanka Ave. Saratoga, CA 95070-3150
408-446-0387
sUn!p~rtal!cup.portal.com!willProg, U.S. Computer
Faracchio, Joe
CCS , 26 1 Evans, IJC Berkeley, Berkeley, CA947 20
642-,?638
[email protected] Prog. Arlalyst IV, UCB
Feller, Bok:
10 W. Orange Ave, So. San Francisco, CA 94030
867-1472
Systems Progranmer: Guy F Atkinson
Fitch, Joel 1804 Vacca
Dr, San Jose, CA 95124
[email protected] Eng. Asst, SLAC
408-264-6839
MN 55144
E'raatz, Dave Bldg. 220-3W-01, St. Paul,
612--736-5650 Specialist, 3M
Franklin, Ray 1214 Paru St, Alameda, CA 94501
543-9320
programmer,
Tesseract
Gambelin, Mike 1555 Berger Dr,3rd Floor,Bldg.2, San Jose, CA 95112
299-4301SystemProgrammer,CountyofSantaClara
Garnett, Forrest 5600 Cottle Rd, San Jose, CA 95193
[email protected]\"B System Programmer, IBM
408-997-4089
Giguere, Suzanne 1260 E. Arques M/S 205, Sunnyvale, CA 94086
Software Eng., Amdahl Corp.
408-746-6279
Ginevich, Rost 4000 N. Mingo Rd. MD 348, Tulsa, OK 74158
918-832-5375 Sr. Prog. Analyst, American Airlines
Goldberg, Gabe 1604 Spring Hill Road, Vienna, VA 22182
703-506-0500 VMG on VMSHARE V.P. VM Systems Group
Gomberg, Dave
7 Gateview Ct. San Francisco, CA 94116
[email protected]
UCSF
Graff, Michael 4652 Piper
St, Fremont, CA 94538
770-1312IBM
W E T [email protected],IBM
Green-Suskind,Linda G92lGC14PC Box 8009, Endicott,NY 13760
SAA Procedures Lang. Interface Owner, IBM
601-752-1172
Gunning, Randy 1755 Grant St,2nd Floor #5863, Concord, CA 94520
675-4148
ADSE, Bank
of
America
Hall, John662Canyon
Dr., Pacifica,CA94944
477-5049TechnicalAnalyst,WellsFargoBank
Hassenplug, Sandra 1117 N. 15, Philadelphia, PA 19102
215-246-6273 Supr. Systems Programming, Towers Perrin
Hawes, Bill
533Gleasondale Rd, Stow, MA 01775
508-568-8695
BIX:WAWES
Heidenreich, Karen SLAC, 2575 Sand Hill Rd, Menlo Park, CA 94025
926-3962
[email protected]
Prog.
Analyst,
SLAC
Helffrick, Boone 1649S . Main St, Milpitas, CA 94053
408-265-1483 Software Developer, HPL
Jose, CA 95120
Holland, Ray IBM ARC, 650 Harry Rd, San
927-2637
[email protected]
IBM
E. Arques Ave M/S 201, Sunnyvale, CA 94088
Jenkins, Jonathan 1250
408-737-5019 AMDAHL!JUTS!JW50 Systems Prog., Amdahl
SLAC Bin 48, 2575 Sand Hill Rd, Menlo Park, CA 94025
Jenkins, Ted
[email protected]
SLAC
926-4325
Johnson, Bill SLAC Bin 97, 2575 Sand Hill Rd, Menlo Park, CA 94025
326-2660
[email protected]
SLAC
Johnson, Tony PO Box 4349 Bin 71, Stanford, CA 94309
926-2278
[email protected]
Physicist,
Boston
Univ.
E. Arques M/S 249, Sunnyvale, CA 94086
Johnson, Vern 1250
408-746-6993 Staff Design Engineer, Amdahl Corp.
Johnston, Ted SLAC Bin 97, 2575 Sand Hill Rd, Menlo Park, CA 94025
926-2689
[email protected]
Mgr,
SLAC
Kaminski, Peter 159 Los Trancos Circle,Portoh Valley, CA 94028
851-0927
B1X:kaminski
Software
Designer,
self
Kearney, Kevin PO Box 532, Storrs,
CT 06268
203-429-8402 President, Mansfield Software
Keller , Bob 39861 Wyatt Lane, Fremont, CA 94538
770-1479
System
Programmer,
Motorola
Kelse-y, Mason 1121C Porter St, Vallejo, CA 94590
707-645-7195 C.S.E., Bank of America
Kiesel, Peter 250 E. Fifth
St, 4th Floor, Cincinnati, OH 45202
513-762-2618 Staff Instructor, IBM
Munz, P a u l
SLAC, 2575 Sand Hill Rd, Menlo Park, CA 94025
y1
a6-2884
PL"KER(aSWOJM Physicist, SLAC
I
L
232
I,nngeveld, t 4 i l l y S L i C B i n 9 7 , 2575 Sand Hill Rd, Menlo Park, CA 94025
[email protected] S U C
327-4610
L t : t y Hank
10420 Castine Ave, Cupertino, CA 95014
HZlf.!KLFvrS' MzPVM2 Programmer, IBM
408-257-9076
Lichtenthal, Marvir: 4 Captain Dr., Emeryville, CA 94608
653-5211
Lichter, Stephen 65 E 55 St: New York, NY 10022
[email protected] Instr./Developer, IBM
212-230-5132
LC~:;;~ Conr,ie
SLAC, 2575 Sand H i l l Rd, Menlo Park, CA 94025
[email protected],ACVM
Mathematician, SLAC
9 2 c '2879
T,u !e-::.::
I m , i?eter 447 Claremont Way, Menlo Park, CA 94025
[email protected] [email protected] Adv. Analyst,IBM
3 5 8 - 3050
Jose CA 95112
1555 BergerDr, 3rd Floor GSA/DPC San
Luoh, Harry
of Santa Clara
408-299-4301 System Programmer, County
1442A Walnut St. Suite 412, Berkeley, CA 94709
Mantino, Mike
523-2616
WR Church Computing Ctr, Code 0141, Monterey,CA 93943
Mar, Dennis
[email protected] S.tat./Prog. Naval PostGrd. School
408-646-2672
IEM UK Laboratories, Winchester, England
Marks, Brian
44-962-841122 FAX 962-840092 Sr. Programmer, IBM
R d , Menlo Park, CA 94025
Martin, Charlie SLAC Bin 97, 2575 Sand Hill
[email protected]" System Programmer, SLAC
926-2260
1250 E. Arques, Sunnyvale, CA 94088
Maru , Kenji
Sys . Programmer, Amdahl
408-746-3299
Alto, CA 34304
NcClennan, John 1520 Page Mill Rd, MS33G, Palo
Programmer, IBM
855-3722
638 66th St, Oakland, CA 94609
McGrath, Sean
[email protected]' Consultant, URSA MINOR
653-8387
G19/21A-l-E5 PO Box 9008, Endicott, NY 13760
McGuire, Rick
607-752-1865 Advisory Programer, IBM Endicott
PO Box 632,Los Gatos, CA 95031
Mehl, Jim
[email protected] Programmer, IBM
408-927-1879
3657 Ramona Circle, Palo Alto, CA 94306
Meyer, Mike
853-6507
[email protected] Syst. Programmer, Digital
Milsted, Neil
6300 N. River Road, Rosemont,IL 60018
708-969-4800 met!wrkgrp!NFNM Developer, Workstation Group
Moraes, Roger
1555 Eerger Dr, GSA/DPC San Jose, CA 95112
408-299-4301
of Santa Clara
System programmer, County
Morrow, Mike
533 Parnassus Rm. U76, San Francisco, CA 94143
476-4525
Syst. Programmer, UCSF
Nee, €hi-Mei
1555 Berger Dr.3rd Floor,Bldg.#2, San Jose CA 95112
408-299-4301
of Santa Clara
System Programmer, County
CCS, 253 Evans, UCB, Berkeley, CA 94720
Ng, May
642-5025
[email protected] User Services Consult., UC Berkeley
Nguyen , Xuan
1555 Berger Dr, San JQSe, CA 951.12
408-299-4381
Programmer AnalystIV, Santa Clara County
Noakes, Michael 99 Pacific St. Suite 155A, Monterey, CA 93940
408-655-4000
3547PFNAVPGS.BITNET Sys.Prog,De€. Manpower DataCtr.
0' Hara,
Robert 1 Rogers St, Cambridge,MA 02142
617-252-5275
[email protected] Sys. Arch., Lotus Dev. Corp.
Oppenheim, Larry 236 W. Portal, Ste. 347, San Francisco, CA 94127
585-1.009
Consultant, Penguin Computing
Orr, Sid
405 El Camino REal #411,, Menlo Park, CA 94025
856-5405
[email protected] Software Engr, SLRC
Pachl, Walter
IBM Austria,00/705 Cobdenq.2,
Vienna
A 1010
.
43-1-222-211454420 PACHLVABWl Developer, IBM
Payton, Brian 5104 Westmont
Ave. #9, San Jose, CA 95130
[email protected],IEM
P h i l l i p s , Russell. 4558 O s a i Loop, Union City, CA 94587
471.-0215
System
Programmr, Tesseract Schlage Lock
I
Robin, David
100 H a l f Da.y Rd, L i n e o l n s h i r e , IL 60069
C o n s u l t a n t , Hewitt Associates
708-295-5000
Rockowitz, Sanford 1373 S . Mayfair Ave, Daly City,
CA 94015
[email protected]~.,
m e r , Minaret
Software
755-4570
Rogers, Sara
PO Box 532, Storrs, CT 06268
203-429-8402
Srqqort Staff, Mansfield Software
Fmthacker, Frank SLkC. B i n 8 8 , 2575 Sand Hill Rd, Menlo Park, CA 94025
r;'RrzrrJI<@LAC\?~I SLAC
926--2624
Schmidt, Denise 3118 S . 15th St, Omaha, NE 68130
402-333-4385 MC1:362-2229 Independent Ccnsultant
1555 Berger- Ex, Bidg.2, San Jose,CA 95112
Snawder, Paul
Sr. Syst-emsProg. County of Santa Clara
408-299-4301
Spadafora, John 29 Hartwell P;iie, Lexington, MA 02173
BIX,JSPADAFO%(A Programter Analyst, BIX
517-860-6241
Spencer, Randal 2728 Sheldon Dr., El Sobrante, CA 94803
[email protected]
222-7595
160 Caldecott Lane #124, Oakland, CA 94618
Stevens, Kevin
BIX Icevinestevens Network Admin, Heals Health Plan
649-0479
CCS, 271 Evans, UC Berkeley, Berkeley, CA 94720
Sturak, Tamara
[email protected] User Svs. Coord, UCB
642-9123
1800 Alexander BellDr, Reston, VA 22091
Style, Bernie
Sr. Syst. Arch., Systems Center
703-264-8362
Thompson, Marshall S G C , 2575 SardHill Rd, Menlo Park, CA 94025
926-4231
[email protected]
Financial
Analyst
, SLAC
Tsai, Raymond
1250 E. Arques Ave M/S 201, Sunnyvale, CA 94086
408-737-5123 Staff
Systems Programmer, Amdahl. Corp.
Tunkel , Jay
fEM Corp.3600,lCOCI W' 51st St,Boca Raton FL 33432
407-443-5955
Advisory Proyra.mmer: IBN Corp.
Tyree, Scott 125Q
E . Arques M/S 201, Sunnyvale, CA 94088
AMTI on WSHAKE Systems Programmer, Arndahl
408-746-4634
Van Herwijnen, Eric CERN, AS Division, Geneva, Switzerland CM-1211
[email protected]*S\%. CERN .CH CERN
41-22-7675087
Vigil, Peter 1250
E , Arques Ave. M/S 249, Sunnyvale, CA 94086
408-746-3493 Design
E n g r . , Amdahl Corp.
Vul,
Alex
Arndahl Corp,
Slunnyvale,
CA
94086
Corp.
408-746-8596 amdahl!agv Software Engr, Amdahl
Warnett, Martin 1420 Harbor Bay P k k y , #200, Alameda, CA 94501
769-4900SoftwareEngineer,SoftwarePursuits,Inc.
Watanabe, Gerry 5600 CottPe Rd A6O-029, SanJose, CA 95193
408-997-4279
Mgr, TRM
Watts, Keith
1945 Washington St, #410, San Francisco CA 94109
775-8360
Proprietor,
Kilowatt
Software
SLhC Bin 97, 2575 Sand Hill Rd, Menlo Park, CA 94025
Weeks, B i l l
[email protected] Sys Prog . , SLAC
926-2909
Weinstein, Marvin S U C , 2575 Sand Hill Rd, Menlo Park, CA 94025
926-2214
[email protected] SLAC
Weissman, J i m
59 Echo Ave, Oakland, CA 94611-4307
MCI-MAIL
Wells Fargo
Bank
396-6979
SLAC Bin 97, 2575 Sand Hill Rd, Menlo Park, CA 94025
White, Beho
B E B ( ? ( S S U W A SLAC
926-2907
Winson, Alan 6 Admiral
D r . #437, Emeryville, CA 94608
TDA on VMSHARE IndependentConsultant
653-2695
SLAC Bin 9 7 , 2575 Sand Hill Rd, Menlo Park, CA 94025
Winters, Joan
924-2530
[email protected]
Scientific
Programmer, SLAC
Witthaus, Ken
SLAC B i n 6 1 , 2575 Sand Hill Rd, Kenlo Park, CA 94025
926--2468
[email protected]
Mathematician,
SLaC
A conference for velopers and users
All in the relaxed atmosphere of the Calvomia coas;
TO teceivefurther iqformation send a sev-adclressed stamped envelope to the address below.
To make your reservation, sen
235
Download