-
Notifications
You must be signed in to change notification settings - Fork 70
/
README.REXX
618 lines (415 loc) · 18.5 KB
/
README.REXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
Hercules REXX support
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
NOTE fixed a typo for the error handler variable name
NOTE the changes in the Address HERCULES invocation
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
This is a full rewrite of the original Rexx implementation by Jan Jaeger
the Rexx packages supported are
Open Object Rexx ( from now on called simply ooRexx )
Regina Rexx ( from now on called simply Regina )
Building Hercules with Rexx support
The support is completely dynamic, only the headers are needed to provide Rexx support
if the headers rexx.h and oorexxapi.h are found ooRexx support will be included
if the headers rexxsaa.h is found Regina support will be included
if Rexx support is not <needed/wanted> configure supports the flags
--disable-object-rexx
--disable-regina-rexx
Using Rexx
Since the support is completely dynamic the available rexx interpreters will be
determined at run time ( trying to load the appropriate dynamic libraries )
unless specified otherwise ( see further down the available options )
the rexx initialization stub will check in the order ooRexx and Regina
so in case both interpreters are available ooRexx will be the first choice.
no action is required by the user,
all will be automatic at the first execution of a rexx script
to invoke a rexx script the command is
EXEC <scriptname> <script arguments>
within the Rexx script Hercules commands can be issued using the constructs
1 - ...Address <ENVIRONMENT> interface
* the original implementation was forced to do parsing/subparsing
of the <string> passed to extract the <command> options
since the <command string> might/ contain arbitrary char sequences
the subparsing was prone to errors
now Address Hercules has as the ONLY parameter the command
all the <local> option are defined/passed thru predefined and reserved rexx variables
( even IBM used this approach in the original RXSQL interface :-) )
and here they are
HREXX.ERRORHANDER "RETCODE"/"SYSTEM"
to determine how error situations must be handled
( usually a non 0 return code from the command )
for example a devlist with no devices present exits with a return code 1
from the subcommand interface point of view it should not be considered an error
( also RXSQL when no rows satify the query does not raise an error condition )
just play around a bit with the different situations to understand better the reason
why I let the user choose
HREXX.RESPSTEMNAME
to tell the stem <root> to be used for the response
the variable is dropped at every call so that each Address HERCULES invocation
will find an unbiased environment
if on the other side a response is alway wanted the variable
HREXX.PERSISTENTRESPSTEMNAME will provide such facility
as usual the Rexx variable RC contains the return code from the hercules command
the <stemname> will contain the reply with the usual convention that
<stemname>.0 will contain the number of lines returned
NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW
2 - external function interface ( much cleaner IMO )
the parameter passing does nor depend on any parsing/subparsing
the function name is awscmd
( I liked the name, but if somebody feels that it infringes some IP I will change it )
the format and the parameters are
<rc> = awscmd(<command>,[<stemname>],[<error handling mode>])
or
call awscmd <command>, [<stemname>], [<error handling mode>]
in both cases ( command and external function )
the error handling default is "RETCODE"
NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
When a response stemname is not specified, Hercules will display the command
results normally, just like it always does.
When a response stemname is used however, Hercules does NOT display the results
of the command.
Instead, the results of the command are captured and returned in the specified
REXX stem variable, and it is Your prerogative to preocess in any way You feel
appropriate... ( for example )
display them yourself using the REXX 'say/lineout' statement."
write them to a file using lineout ( for ooRexx EXECIO or the stream class )
analyze the content to process accordingly
to manage the Rexx environment the command is
REXX <option> <arguments>
the option are
-- to define the search path for the Rexx script invoked
PATH a path with the system defined PATH separator
( ; for windows / : for linux and similar )
well no need to tell about it
PATH clear
to clear the path
PATH reset
to reset the PATH to the default startup path ( see later for the meaning )
as an alternate spelling for those who might be confused REXXPATH is also accepted
SYSP[ATH] on/off
to extend the search to the standard system PATH used for executables
the above behavior mimicks the ooRexx behavior for the search of external
function/classes ( ::library ::requires directives)
the default is to extend the search
-- to define the extensions to be used when resolving the script name
EXT[ENSIONS] list of the extension to use when autocompleting the script name
EXT[ENSIONS] reset
to reset the EXTENSIONS list to the default startup list ( see later for the meaning )
the default extension are
(NONE) the plain file name ==> always checked
.REXX:.rexx:.REX:.rex:.CMD:.cmd:.RX:.rx
if a script name contains a (.) ==> is in the format <filename>.<filetype>
it is used as is without any further processing
note the alias of SUF[FIXES] can be used
-- control the script name resolution process
RESOL[VER] on/off
defines who will resolve the script name
on the hercules rexx interface will take care of that and issue the appropriate
message if the process fail
off the command name will be passed AS IS to the rexx interpreter
the behavior is different from ooRexx and Regina
for ooRexx
HHC01603I exec notfound
REX0003E: Error 3: Failure during initialization
REX0534E: Error 3.901: Failure during initialization: Program "notfound" was not found
HHC17502E REXX(ooRexx) ooRexx RC(-3)
for Regina
HHC01603I exec notfound
HHC17502E REXX(Regina) Regina RC(-3)
-- control the verbosity of the interface
MSGL[EVEL] 0-9
0 is the default
as far as now any value between 1 and 9 will have the same effect
it will display at the end of the script the messages
HHC17503I REXX(<package name>) Exec/Script '<script name>' RetRC(0)
HHC17504I REXX(<package name>) Exec/Script '<script name>' RetValue'0'
-- define a prefix to be used for standard and error/trace messages
MSGP[REFIX] a <string> up to 9 chars ( no blanks allowed ) / reset
ERRP[REFIX]
-- define the argument passing mode to the invoked script
see the hbasics example in the script directory
and read the rexx documentation - no reason to retype the manuals :-)
MODE com[mand]
sub[routine] ( support arg() construct )
I guess that no further details are needed
for each command issued at the end a status of the rexx interface is displayed
the same info as in
-- displaying the status of the rexx interface
the command REXX without any operands will display the status of the interface
HHC01603I rexx
HHC17500I REXX(ooRexx) Rexx Path : /hercules/scripts
HHC17500I REXX(ooRexx) SystemPath: (ON)
HHC17500I REXX(ooRexx) Extensions: .REXX:.rexx:.REX:.rex:.CMD:.cmd:.RX:.rx
HHC17500I REXX(ooRexx) Resolver : (ON)
HHC17500I REXX(ooRexx) Msg Level : 0
HHC17500I REXX(ooRexx) Msg Prefix: (OFF)
HHC17500I REXX(ooRexx) Err Prefix: (OFF)
HHC17500I REXX(ooRexx) Mode : (Command)
HHC17500I REXX(ooRexx) REXX-ooRexx_4.2.0(MT) 6.04 21 Mar 2012
HHC17500I REXX(ooRexx) MACOSX FUNCTION Instore
HHC01603I rexx
HHC17500I REXX(Regina) Rexx Path : /hercules/scripts
HHC17500I REXX(Regina) SystemPath: (ON)
HHC17500I REXX(Regina) Extensions: .REXX:.rexx:.REX:.rex:.CMD:.cmd:.RX:.rx
HHC17500I REXX(Regina) Resolver : (ON)
HHC17500I REXX(Regina) Msg Level : 0
HHC17500I REXX(Regina) Msg Prefix: (OFF)
HHC17500I REXX(Regina) Err Prefix: (OFF)
HHC17500I REXX(Regina) Mode : (Command)
HHC17500I REXX(Regina) REXX-Regina_3.6(MT) 5.00 31 Dec 2011
HHC17500I REXX(Regina) UNIX FUNCTION Instore
or when no interface is enabled
HHC01603I rexx
HHC17500I REXX() Rexx Path : /hercules/scripts
HHC17500I REXX() SystemPath: (ON)
HHC17500I REXX() Extensions: .REXX:.rexx:.REX:.rex:.CMD:.cmd:.RX:.rx
HHC17500I REXX() Resolver : (ON)
HHC17500I REXX() Msg Level : 0
HHC17500I REXX() Msg Prefix: (OFF)
HHC17500I REXX() Err Prefix: (OFF)
HHC17500I REXX() Mode : (Command)
HHC17521I REXX() Support not started/enabled
since the builtin support is bilingual two other commands are provided
to manage the Rexx interface
REXX stop/disable
REXX start/enable without any operands will enable the default Rexx interpreter
and as expected specifyng oorexx/regina will override the default
NOTE the start/stop command are not available if hercules has been built with just
one package available
environment variables and defaults
the defaults are those hardcoded in the <code>
some environment variables are provided to override them
HREXX_PACKAGE=<value>
acceptedvalues are
AUTO, not really needed, but implements the default search order for interpreters
NONE no default rexx interpreter will be autostarted, a manual start is needed
oorexx/regina self explanatory
HREXX_PATH[S]=<a well formed path concatenation>
wher to find the rexx scripts
HREXX_EXTENSIONS=<a well formed extensions list >
HREXX_MODE=command/subroutine
when issuing a
REXX <some option> reset
the relative values are reset to the hardcoded values or to the value provided
by the environment variables
never wrote so much doc in my whole IT life :-)
if something is not clear , let me know and I will try to explain better
Enrico Sorichetti
possibly duplicate and inconsistent info, will fix later !
to clean up the <sources> the content of
hRexx_readme.txt and hRexx_readme_install.txt
have been moved here
OLD : hRexx_readme.txt
********************************************************************************
********************************************************************************
********************************************************************************
some preliminary doc for Rexx support
installation/enabling
at configure use :
--enable-object-rexx
--enable-regina-rexx
since support is fully dynamic no library checking is done
I hope to have done the proper error checking
when loading the Rexx dynamic libraries and resolving the symbols
oops I forgot about windows
to enable REXX support on windows just
set/export the environment variables
OBJECT_REXX_DIR
REGINA_REXX_DIR
to the appropriate directory
if the installation was standard
for object rexx ==> <programs files>\oorexx\api
for REGINA rexx the silly installer wants to install
to c:\Regina, smarter to force the install to <Program Files>\regina
anyway the include directory is <regina install path>\include
when enabling multilanguange support, REXX is not <autostarted>
the desired <package> must be manually started (*)
the REXX command is used to manage the Rexx environment
rexx start oorexx/regina
rexx stop
! enable/disable are the alternative forms
to tell rexx what path to use to search for the execs
rexx paths < a list of paths >
rexx paths reset to reset the search path to the default
( the deafult path is the current PATH )
an alternative spelling is
rexx path
to tell rexx what extensions to use when searching
rexx extensions < a list of extensions >
rexx extensions reset to reset the extensions to the defaults
the extensions defaults are : .REXX;.rexx;.REX;.rex;.CMD;.cmd;.RX;.rx
in the order
an alternative spelling is
rexx suffixes
when the IO handler issues the messages to the hercules console
it start from position 0/1 ( depending on how You count )
the commands
rexx errpref
rexx msgpref
will set the prefix for error and standard messages ( say )
as You can imagine
rexx errpref reset/ rexx msgpref reset, will disable message prefixing
to ba able to use a config file written in rexx
rexx must be autostarted
three environment variables are available
HREXX_PACKAGE=oorexx/regina
HREXX_PATHS/HREXX_PATH
HREXX_EXTENSIONS/HREXX_SUFFIXES
if the HREXX_PACKAGE environment variable is set
no need to start rexx support, it will be autostarted at the first exec invocation
as far as the exec command is concerned
using the format
exec name arg1 arg2 ... argn
will use the rexx defined extensions and packages
if the exec name is a fully resolved path it will not be tampered with and
<hRexx> will just pass the name asis to the interpreter
now for the Address HERCULES command
I mimicked the EXECIO format
address HERCULES <command>
no output is returned
Address HERCULES <command> ( STEM somestemname.
well You are all smart enough to understand how it works
enoug documenation for now! I am fed up of writing :-)
! oops I forgot an important thing ...
! when starting/enabling object rexx, receiving a 1002 error is not really
! a RXAPI_MEMFAIL
! it is a consequence of the RXAPI daemon not being active
! it should be enough to start it according to the documentation
! or have it autostarted at ipl/boot time
I tested with a standard ooRexx and Regina Rexx installation
and as long the installer sets up correctly the path for dynamic libraries
the hercules rexx interface will find them
( tested on fedora core 15, both oorexx and regina )
if the installation is <not standard> then it is a user task to
setup properly the overall environment
for example defining the relevant symlinks from /usr/<whatever> to the
relative paths for the non standared rexx installation
from :
/usr/bin to <rexx>/bin
/usr/lib to <rexx>/lib ( on some linux[es] regina uses lib64 )
the above are needed to run, to compile
/usr/include to <rexx>/include
please let me know of standard installations where the Rexx interface
fails to find the dynamic libraries
changes ..
implemented the "full" autostart facility.
relation with the HREXX_PACKAGE environment variable
when HREXX_PACKAGE undefined/unset ( the most common situation )
hercules will attempt to enable oorexx first , regina rexx next
when HREXX_PACKAGE has the value "auto"
same as above
when HREXX_PACKAGE has the value "none"
no autostart will be attempted
when HREXX_PACKAGE has the value oorexx/regina
the selected package will be started
the start command has been changed,
if no package name is entered the above sequence is followed
the help has been modified accordingly
NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
the REXX path will be used to search ONLY for the scripts invoked via the exec command
the hercules configuration written in rexx DOES NOT FOLLOW that setup
the configuration is read at the beginning of the startup process and it must
be read by the hercules configuration program to understand that it is a rexx script
so it must be reached thru a PATH available to the shell
after that rexx will be invoked passing the absolute path to the configuration
example
current directory ==> /Hercules/sandhawk.390.build
hercules invoked with ==> ./hercules -f hercules.rexx
inside the hercules rexx
parse source _src
say _src
returned ==> MACOSX COMMAND /Hercules/sandhawk.390.build/hercules.rexx
note the full resolved path of the configuration file
03/18
fixed a small glitch where sometimes the rexx status display
returned a dirty buffer
fixed the logic glitch in the extension separator
USES NOW THE SAME separator as the one used by PATH,
only one separator to remember !
to do ...
some cosmetics
small optimizations
comment the code ( pretty linear and sequential ) but better do it
enjoy
OLD : hRexx_readme_install.txt
********************************************************************************
********************************************************************************
********************************************************************************
here are the the installation steps for the REXX packages I used
as a prerequisite for implementing full rexx support
mkdir /opt
for Object Rexx - 4.2.0 ( svn revision 7688 )
cd /opt
svn co https://oorexx.svn.sourceforge.net/svnroot/oorexx/main/trunk ooRexx-svn
cd ooRexx-svn
./bootstrap
./configure --prefix="/opt/ooRexx"
--with-pic
CFLAGS=-O3
CXXFLAGS=-O3
make
make install
cd /usr/bin
sudo ln -s -f /opt/ooRexx/bin/(*) .
cd /usr/lib
sudo ln -s -f /opt/ooRexx/lib/(*)* .
cd /usr/include
sudo ln -s -f /opt/ooRexx/include/(*) .
SAME process used on SNOW LEOPARD, LION and LINUX ( RHEL and Fedora 15 )
I' ll let You find out the most comfortable way of starting the rxapi daemon
for Regina ( svn revision 89 )
cd /opt
svn co https://regina-rexx.svn.sourceforge.net/svnroot/regina-rexx/interpreter/trunk Regina-svn
cd Regina-svn
./configure --prefix="/opt/Regina"
--without-staticfunctions
--without-testpackage
--without-regutil
--without-rexxcurses
--without-rexxtk
--without-rexxgd
--without-rexxcurl
--without-rexxsql
--without-rexxeec
--without-rexxisam
--without-rxsock
--without-rexxdw
CFLAGS=-O3
CXXFLAGS=-O3
( the withouts are for , in my case, useless options; Your mileage might vary )
make
make install
for REGINA executable naming is a bit illogic
./regina -v
REXX-Regina_3.6(MT) 5.00 31 Dec 2011
./rexx -v
REXX-Regina_3.6 5.00 31 Dec 2011
so for full usability it might be better to make a symlink only to the GOOD ONE
cd /usr/bin
sudo ln -s -f /opt/Regina/bin/Regina rexx
sudo ln -s -f /opt/Regina/include/(*) .
cd /usr/include
sudo ln -s -f /opt/Regina/include/(*) .
for APPLE
cd /usr/lib
sudo ln -s -f /opt/Regina/lib/(*) .
for Linux 32 bits ( same )
cd /usr/lib
sudo ln -s -f /opt/Regina/lib/(*) .
for Linux 64 bits
cd /usr/lib64
sudo ln -s -f /opt/Regina/lib64/(*) .
BUT CHECK YOUR SYSTEM LAYOUT and fix the logic accordingly
when doing a bilingual installation just do the symlink stuff only for the
PRIMARY rexx ,
or for Regina do the symlink only for the Regina executable
so the scripts will have to use the shebang #! /usr/bin/regina
with this setup a small script to switch the symlinks might be the only thing
needed to change on the fly the default REXX package
after all this
You can build hercules with rexx support
as soon as I have a bit more time I will update this install readme
with the considerations for a rexx install from a binary package
all the above is for well behaved linuxes, for the others ... well You all are on Your own
I STRONGLY BELIEVE THAT WE SHOULD DECLARE A REFERENCE PLATFORM WITH <COMMITTED>
SUPPORT
For other platform a best effort is all that we should commit for