loadPackage OK for extension/stringChunk.cls
loadPackage OK for utilities/indentedStream.cls
loadPackage OK for extension/extensions.cls
loadLibrary OK for rxunixsys
loadPackage OK for ncurses.cls
loadPackage OK for csvStream.cls
loadLibrary OK for hostemu
loadPackage OK for json.cls
loadPackage OK for mime.cls
loadPackage OK for rxftp.cls
loadLibrary OK for rxmath
loadPackage OK for rxregexp.cls
loadPackage OK for regex/regex.cls
loadPackage OK for smtp.cls
loadPackage OK for socket.cls
loadPackage OK for streamsocket.cls
loadPackage OK for pipeline/pipe.cls
loadPackage OK for rgf_util2/rgf_util2.rex
loadPackage OK for BSF.CLS
loadPackage OK for oorexxshell_queries.cls
loadPackage OK for pipeline/pipe_extension.cls
loadPackage OK for rgf_util2/rgf_util2_wrappers.rex

REXX-ooRexx_4.3.0(MT)_64-bit 6.04 8 Feb 2023
Input queue name: S4633Q6000008e8750

--------------
-- ooRexxShell
--------------

/*
ooRexxShell, derived from rexxtry.
*/

/*
This shell supports several interpreters:
- ooRexx itself
- the system address (cmd under Windows, sh or bash under Linux and MacOs)
- PowerShell core (pwsh)
- any other external environment (you need to modify ooRexxShell, search for hostemu for an example).
*/

/*
The prompt indicates which interpreter is active.
By default the shell is in ooRexx mode: ooRexx[bash]>
When the interpreter is ooRexx, the value of address() is displayed between [].
*/
ooRexx[sh]> say "hello"
hello
ooRexx[sh]> say 1+2
3
ooRexx[sh]> 
/*
If an ooRexx clause ends with "=" then the clause is transformed to display the result :
'1+2=' becomes 'options "NOCOMMANDS"; 1+2 ; call dumpResult; options "COMMANDS"'
'=' alone displays the current value of the variable RESULT.
*/
ooRexx[sh]> 1+2=
 3
ooRexx[sh]> (1,2)=          -- When "=" then the arrays are displayed in condensed form
[ 1, 2]
ooRexx[sh]> (1,2)==         -- When "==" then the arrays are displayed one item per line
an Array (shape [2], 2 items)
 1 :  1
 2 :  2
ooRexx[sh]> 
/*
You have access to Java.
*/
ooRexx[sh]> jsystem = bsf.loadClass('java.lang.System')
ooRexx[sh]> properties = jsystem~getProperties
ooRexx[sh]> enum = properties~propertyNames
ooRexx[sh]> do while enum~hasMoreElements; key=enum~nextElement; say "key:" left("["key"]",30) "value: ["properties~getProperty(key)"]"; end
key: [java.runtime.name]            value: [OpenJDK Runtime Environment]
key: [java.vm.version]              value: [19.0.2+9]
key: [sun.boot.library.path]        value: [/Users/Shared/local/java/jdk/bellsoft/jdk-19.0.2-full.jdk/lib]
key: [java.vm.vendor]               value: [BellSoft]
key: [java.vendor.url]              value: [https://bell-sw.com/]
key: [path.separator]               value: [:]
key: [java.vm.name]                 value: [OpenJDK 64-Bit Server VM]
key: [user.country]                 value: [FR]
key: [java.vm.specification.name]   value: [Java Virtual Machine Specification]
key: [user.dir]                     value: [/Users/Shared/local/rexx/oorexx/executor/sandbox/jlf/demos]
key: [java.vm.compressedOopsMode]   value: [Zero based]
key: [java.runtime.version]         value: [19.0.2+9]
key: [os.arch]                      value: [aarch64]
key: [java.io.tmpdir]               value: [/var/folders/f6/ls9l793n1bg444403jmfh1_m0000gp/T/]
key: [line.separator]               value: [
]
key: [java.vm.specification.vendor] value: [Oracle Corporation]
key: [stderr.encoding]              value: [UTF-8]
key: [os.name]                      value: [Mac OS X]
key: [sun.jnu.encoding]             value: [UTF-8]
key: [stdout.encoding]              value: [UTF-8]
key: [java.library.path]            value: [/Users/Shared/local/rexx/oorexx/build/executor.master/sandbox/jlf/trunk/macos-arm64/clang/release/delivery/lib:/local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/lib:/local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/lib/macos-arm64::]
key: [jdk.debug]                    value: [release]
key: [java.class.version]           value: [63.0]
key: [java.specification.name]      value: [Java Platform API Specification]
key: [sun.management.compiler]      value: [HotSpot 64-Bit Tiered Compilers]
key: [os.version]                   value: [12.6.2]
key: [http.nonProxyHosts]           value: [local|*.local|169.254/16|*.169.254/16]
key: [user.home]                    value: [/Users/jlfaucher]
key: [file.encoding]                value: [UTF-8]
key: [java.specification.version]   value: [19]
key: [user.name]                    value: [jlfaucher]
key: [java.class.path]              value: [/local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/bsf4ooRexx-v641-20220131-bin.jar:]
key: [java.vm.specification.version value: [19]
key: [sun.arch.data.model]          value: [64]
key: [java.home]                    value: [/Users/Shared/local/java/jdk/bellsoft/jdk-19.0.2-full.jdk]
key: [user.language]                value: [en]
key: [java.specification.vendor]    value: [Oracle Corporation]
key: [java.vm.info]                 value: [mixed mode, sharing]
key: [java.version]                 value: [19.0.2]
key: [native.encoding]              value: [UTF-8]
key: [java.vendor]                  value: [BellSoft]
key: [java.awt.headless]            value: [true]
key: [file.separator]               value: [/]
key: [java.version.date]            value: [2023-01-17]
key: [java.vendor.url.bug]          value: [https://bell-sw.com/support]
key: [sun.io.unicode.encoding]      value: [UnicodeBig]
key: [sun.cpu.endian]               value: [little]
key: [socksNonProxyHosts]           value: [local|*.local|169.254/16|*.169.254/16]
key: [ftp.nonProxyHosts]            value: [local|*.local|169.254/16|*.169.254/16]
ooRexx[sh]> 
/*
A shell command can be used in ooRexx mode, surrounded with quotes.
*/
ooRexx[sh]> 'ls -lap *demo*.txt'
-rw-r--r--@ 1 jlfaucher  wheel    1190 Nov  5 22:06 _readme-demos.txt
-rw-r--r--@ 1 jlfaucher  wheel    8795 Feb 22 11:30 executor-demo-array-output.txt
-rw-r--r--@ 1 jlfaucher  wheel  305359 Feb 22 13:12 executor-demo-classic_rexx-output.txt
-rw-r--r--@ 1 jlfaucher  wheel   49136 Feb 22 11:30 executor-demo-extensions-output.txt
-rw-r--r--@ 1 jlfaucher  wheel   20592 Feb 22 11:30 executor-demo-text-compatibility-output.txt
-rw-r--r--@ 1 jlfaucher  wheel   22777 Feb 22 11:30 executor-demo-text-internal_checks-output.txt
-rw-r--r--@ 1 jlfaucher  wheel   20668 Feb 22 11:30 executor-demo-text-output.txt
-rw-r--r--  1 jlfaucher  wheel   53415 Feb 22 11:30 executor-demo-text-unicode-output.txt
-rw-r--r--@ 1 jlfaucher  wheel    5315 Feb 22 11:30 ooRexxShell-demo-helpers-output.txt
-rw-r--r--@ 1 jlfaucher  wheel   16334 Feb 22 13:12 ooRexxShell-demo-interpreters-output.txt
-rw-r--r--@ 1 jlfaucher  wheel  525893 Feb 22 11:30 ooRexxShell-demo-queries-output.txt
ooRexx[sh]> 
/*
When not in ooRexx mode, you enter raw commands that are passed directly to the external environment.
You switch from an interpreter to an other one by entering its name alone.
To get the list of all interpreter names, enter this command:
?i[nterpreters]
Under Linux & MacOs, this list includes the shells in /etc/shells.
*/
ooRexx[sh]> ?interpreters
Interpreters:
    bash: to activate the bash interpreter.
    cmd: to activate the sh interpreter.
    command: to activate the sh interpreter.
    csh: to activate the csh interpreter.
    hostemu: to activate the HostEmu interpreter.
    ksh: to activate the ksh interpreter.
    oorexx: to activate the ooRexx interpreter.
    pwsh: to activate the pwsh interpreter.
    screen: to activate the screen interpreter.
    sh: to activate the sh interpreter.
    system: to activate the sh interpreter.
    tcsh: to activate the tcsh interpreter.
    zsh: to activate the zsh interpreter.
[Info] 14 lines displayed
ooRexx[sh]> 
/*
'cmd' 'command' and "system" are aliases to select the system interpreter.
*/
ooRexx[sh]> system
sh[ooRexx]> 
/*
Now the default interpreter is the system shell.
No need to surround the commands with quotes.
*/
sh[ooRexx]> ls -lap *demo*.cast
-rw-r--r--  1 jlfaucher  wheel   43275 Feb 22 10:26 executor-demo-array.cast
-rw-r--r--  1 jlfaucher  wheel  367968 Feb 22 13:08 executor-demo-classic_rexx.cast
-rw-r--r--  1 jlfaucher  wheel  116303 Feb 22 10:36 executor-demo-extensions.cast
-rw-r--r--  1 jlfaucher  wheel  164835 Feb 22 11:23 executor-demo-text-compatibility.cast
-rw-r--r--  1 jlfaucher  wheel  149502 Feb 22 10:57 executor-demo-text-internal_checks.cast
-rw-r--r--  1 jlfaucher  wheel  195407 Feb 22 11:08 executor-demo-text-unicode.cast
-rw-r--r--  1 jlfaucher  wheel  112167 Feb 22 10:48 executor-demo-text.cast
-rw-r--r--  1 jlfaucher  wheel   10855 Feb 22 11:24 ooRexxShell-demo-helpers.cast
-rw-r--r--  1 jlfaucher  wheel   21123 Feb 22 14:46 ooRexxShell-demo-interpreters.cast
-rw-r--r--  1 jlfaucher  wheel  643249 Feb 22 11:30 ooRexxShell-demo-queries.cast
sh[ooRexx]> 
/*
HostEmu is a subcommand environment that partially emulates a TSO/CMS environment.
*/
sh[ooRexx]> hostemu
HostEmu[ooRexx]> 
/*
Now the default interpreteur is HostEmu.
No need to surround the commands with quotes.
*/
HostEmu[ooRexx]> 
/*
EXECIO is an I/O mechanism.
The following command will read the 10 first lines from the file "_readme-demos.txt".
They are stored in the stem named "lines.".
*/
HostEmu[ooRexx]> execio 10 diskr "_readme-demos.txt" (finis stem lines.
HostEmu[ooRexx]> 
/*
When in HostEmu mode, the ooRexx expressions are not recognized
*/
HostEmu[ooRexx]> lines.=
hostemu: bad PLIST, token "syntax error"
RC= 24
HostEmu[ooRexx]> 
/*
You can switch temporarily to ooRexx to display the result.
For that, start your command line with "oorexx".
*/
HostEmu[ooRexx]> oorexx lines.=
a Stem (11 items)
 0  :  10
 1  : 'Demonstration scripts.'
 2  : 'ooRexxShell has a demo mode with slow display.'
 3  : ''
 4  : 'https://asciinema.org/              asciinema   Terminal session recorder'
 5  : 'https://github.com/theZiz/aha       aha         Ansi HTML Adapter.'
 6  : ''
 7  : 'Current demos:'
 8  : 'executor-demo-array.rex'
 9  : 'executor-demo-classic_rexx.rex'
 10 : 'executor-demo-extensions.rex'
HostEmu[ooRexx]> 
/*
Switch to PowerShell core.
pwsh
*/
HostEmu[ooRexx]> pwsh
pwsh[ooRexx]> 
/*
Now the default interpreter is pwsh.
No need to surround the commands with quotes.
*/

/*
Find the commands containing "rexx":
*/
pwsh[ooRexx]> get-command *rexx* | select -property name, source

Name                             Source
----                             ------
bsf4ooRexx-v641-20220131-bin.jar /local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/bsf4ooRexx-v641-20220131-…
callrexx1                        /Users/Shared/local/rexx/oorexx/build/executor.master/sandbox/jlf/trunk/macos-arm64/clang/relea…
callrexx2                        /Users/Shared/local/rexx/oorexx/build/executor.master/sandbox/jlf/trunk/macos-arm64/clang/relea…
oorexxshell                      /local/rexx/oorexx/executor/incubator/ooRexxShell/oorexxshell
oorexx_collect_docfiles          /Users/Shared/local/rexx/builder/scripts/oorexx_collect_docfiles
oorexx_vars                      /Users/Shared/local/rexx/builder/scripts/oorexx_vars
refcardBSF4ooRexx.pdf            /local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/refcardBSF4ooRexx.pdf
rexx                             /Users/Shared/local/rexx/oorexx/build/executor.master/sandbox/jlf/trunk/macos-arm64/clang/relea…
rexx.cat                         /Users/Shared/local/rexx/oorexx/build/executor.master/sandbox/jlf/trunk/macos-arm64/clang/relea…
rexx.img                         /Users/Shared/local/rexx/oorexx/build/executor.master/sandbox/jlf/trunk/macos-arm64/clang/relea…
rexxc                            /Users/Shared/local/rexx/oorexx/build/executor.master/sandbox/jlf/trunk/macos-arm64/clang/relea…
rexxcUtil.rex                    /local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/rexxcUtil.rex
rexxj2-32.sh                     /local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/rexxj2-32.sh
rexxj2-64.sh                     /local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/rexxj2-64.sh
rexxj2.cmd                       /local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/rexxj2.cmd
rexxj2.sh                        /local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/rexxj2.sh
rexxscriptlib.rex                /Users/Shared/local/rexx/builder/scripts/rexxscriptlib.rex
rexxtry.rex                      /Users/Shared/local/rexx/oorexx/build/executor.master/sandbox/jlf/trunk/macos-arm64/clang/relea…
setenv-oorexx                    /Users/Shared/local/rexx/builder/scripts/setenv-oorexx
testOORexx.rex                   /local/rexx/oorexx/official/test/trunk/testOORexx.rex

pwsh[ooRexx]> 
/*
Same command, send the output to the rexx queue without the table headers.
The empty lines are still in the output, they will be filtered on ooRexx side.
*/
pwsh[ooRexx]> get-command *rexx* | select -property name, source | format-table -HideTableHeaders | rxqueue
pwsh[ooRexx]> 
/*
Collect the lines of the rexx queue in an array, and then parse the lines to create an ooRexx directory.
*/
pwsh[ooRexx]> oorexx .rexxqueue~new~makearray~select{item <> ""}~reduce(.directory~new){parse value item~space with name source; accu[name]=source}=
a Directory (20 items)
'bsf4ooRexx-v641-20220131-bin.jar' : '/local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/bsf4ooRexx-v641-20220131-b…'
'callrexx1'                        : '/Users/Shared/local/rexx/oorexx/build/executor.master/sandbox/jlf/trunk/macos-arm64/clang/releas…'
'callrexx2'                        : '/Users/Shared/local/rexx/oorexx/build/executor.master/sandbox/jlf/trunk/macos-arm64/clang/releas…'
'oorexxshell'                      : '/local/rexx/oorexx/executor/incubator/ooRexxShell/oorexxshell'
'oorexx_collect_docfiles'          : '/Users/Shared/local/rexx/builder/scripts/oorexx_collect_docfiles'
'oorexx_vars'                      : '/Users/Shared/local/rexx/builder/scripts/oorexx_vars'
'refcardBSF4ooRexx.pdf'            : '/local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/refcardBSF4ooRexx.pdf'
'rexx'                             : '/Users/Shared/local/rexx/oorexx/build/executor.master/sandbox/jlf/trunk/macos-arm64/clang/releas…'
'rexx.cat'                         : '/Users/Shared/local/rexx/oorexx/build/executor.master/sandbox/jlf/trunk/macos-arm64/clang/releas…'
'rexx.img'                         : '/Users/Shared/local/rexx/oorexx/build/executor.master/sandbox/jlf/trunk/macos-arm64/clang/releas…'
'rexxc'                            : '/Users/Shared/local/rexx/oorexx/build/executor.master/sandbox/jlf/trunk/macos-arm64/clang/releas…'
'rexxcUtil.rex'                    : '/local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/rexxcUtil.rex'
'rexxj2-32.sh'                     : '/local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/rexxj2-32.sh'
'rexxj2-64.sh'                     : '/local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/rexxj2-64.sh'
'rexxj2.cmd'                       : '/local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/rexxj2.cmd'
'rexxj2.sh'                        : '/local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/rexxj2.sh'
'rexxscriptlib.rex'                : '/Users/Shared/local/rexx/builder/scripts/rexxscriptlib.rex'
'rexxtry.rex'                      : '/Users/Shared/local/rexx/oorexx/build/executor.master/sandbox/jlf/trunk/macos-arm64/clang/releas…'
'setenv-oorexx'                    : '/Users/Shared/local/rexx/builder/scripts/setenv-oorexx'
'testOORexx.rex'                   : '/local/rexx/oorexx/official/test/trunk/testOORexx.rex'
pwsh[ooRexx]> 
/*
Back to the ooRexx interpreter, by entering "oorexx" alone.
*/
pwsh[ooRexx]> oorexx
ooRexx[sh]> say "The default interpreter is now ooRexx"
The default interpreter is now ooRexx
ooRexx[sh]> 
/*
End of demonstration.
*/