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 22 Jun 2024
Input queue name: Saf91Q600001c5ef20

--------------
-- 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[bash]> say "hello"
hello
ooRexx[bash]> say 1+2
3
ooRexx[bash]> 
/*
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[bash]> 1+2=
 3
ooRexx[bash]> (1,2)=          -- When "=" then the arrays are displayed in condensed form
[ 1, 2]
ooRexx[bash]> (1,2)==         -- When "==" then the arrays are displayed one item per line
an Array (shape [2], 2 items)
 1 :  1
 2 :  2
ooRexx[bash]> 
/*
You have access to Java.
*/
ooRexx[bash]> jsystem = bsf.loadClass('java.lang.System')
ooRexx[bash]> properties = jsystem~getProperties
ooRexx[bash]> enum = properties~propertyNames
ooRexx[bash]> 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: [20.0.1+10]
key: [sun.boot.library.path]        value: [/Users/Shared/local/java/jdk/bellsoft/jdk-20.0.1-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: [20.0.1+10]
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: [64.0]
key: [java.specification.name]      value: [Java Platform API Specification]
key: [sun.management.compiler]      value: [HotSpot 64-Bit Tiered Compilers]
key: [os.version]                   value: [13.5.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: [20]
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: [20]
key: [sun.arch.data.model]          value: [64]
key: [java.home]                    value: [/Users/Shared/local/java/jdk/bellsoft/jdk-20.0.1-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: [20.0.1]
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-04-18]
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[bash]> 
/*
A shell command can be used in ooRexx mode, surrounded with quotes.
*/
ooRexx[bash]> 'ls -lap *demo*.txt'
-rw-r--r--@ 1 jlfaucher  wheel    1190 Nov  5  2022 _readme-demos.txt
-rw-r--r--@ 1 jlfaucher  wheel    8720 Sep 14  2023 executor-demo-array-output.txt
-rw-r--r--@ 1 jlfaucher  wheel  305774 May 31  2023 executor-demo-classic_rexx-output.txt
-rw-r--r--@ 1 jlfaucher  wheel   57279 Apr 11 20:39 executor-demo-extensions-output.txt
-rw-r--r--@ 1 jlfaucher  wheel   42422 Apr 22 14:48 executor-demo-text-compatibility-auto-conv-output.txt
-rw-r--r--@ 1 jlfaucher  wheel   42487 Apr 22 14:48 executor-demo-text-compatibility-output.txt
-rw-r--r--@ 1 jlfaucher  wheel   23335 Apr 11 20:39 executor-demo-text-internal_checks-output.txt
-rw-r--r--@ 1 jlfaucher  wheel   21806 Apr 22 14:48 executor-demo-text-output.txt
-rw-r--r--@ 1 jlfaucher  wheel   54212 Jun 22 17:17 executor-demo-text-unicode-output.txt
-rw-r--r--@ 1 jlfaucher  wheel    5315 Feb 22  2023 ooRexxShell-demo-helpers-output.txt
-rw-r--r--@ 1 jlfaucher  wheel   16308 Feb 22  2023 ooRexxShell-demo-interpreters-output.txt
-rw-r--r--@ 1 jlfaucher  wheel  551259 Apr 11 21:40 ooRexxShell-demo-queries-output.txt
ooRexx[bash]> 
/*
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[bash]> ?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[bash]> 
/*
'cmd' 'command' and "system" are aliases to select the system interpreter.
*/
ooRexx[bash]> system
sh> 
/*
Now the default interpreter is the system shell.
No need to surround the commands with quotes.
*/
sh> ls -lap *demo*.cast
-rw-r--r--@ 1 jlfaucher  wheel   44582 Jun 22 18:06 executor-demo-array.cast
-rw-r--r--@ 1 jlfaucher  wheel  374800 May 31  2023 executor-demo-classic_rexx.cast
-rw-r--r--@ 1 jlfaucher  wheel  125281 Jun 22 18:15 executor-demo-extensions.cast
-rw-r--r--@ 1 jlfaucher  wheel  376010 Jun 22 19:38 executor-demo-text-compatibility-auto-conv.cast
-rw-r--r--@ 1 jlfaucher  wheel  384918 Jun 22 19:07 executor-demo-text-compatibility.cast
-rw-r--r--@ 1 jlfaucher  wheel  144755 Jun 22 18:36 executor-demo-text-internal_checks.cast
-rw-r--r--@ 1 jlfaucher  wheel  202156 Jun 22 17:17 executor-demo-text-unicode.cast
-rw-r--r--@ 1 jlfaucher  wheel  114733 Jun 22 18:27 executor-demo-text.cast
-rw-r--r--@ 1 jlfaucher  wheel   11238 Jun 22 19:39 ooRexxShell-demo-helpers.cast
-rw-r--r--@ 1 jlfaucher  wheel   20899 Jun 22 19:41 ooRexxShell-demo-interpreters.cast
-rw-r--r--@ 1 jlfaucher  wheel  603105 Apr 11 21:40 ooRexxShell-demo-queries.cast
sh> 
/*
HostEmu is a subcommand environment that partially emulates a TSO/CMS environment.
*/
sh> hostemu
HostEmu> 
/*
Now the default interpreteur is HostEmu.
No need to surround the commands with quotes.
*/
HostEmu> 
/*
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> execio 10 diskr "_readme-demos.txt" (finis stem lines.
HostEmu> 
/*
When in HostEmu mode, the ooRexx expressions are not recognized
*/
HostEmu> lines.=
hostemu: bad PLIST, token "syntax error"
RC= 24
HostEmu> 
/*
You can switch temporarily to ooRexx to display the result.
For that, start your command line with "oorexx".
*/
HostEmu> 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> 
/*
Switch to PowerShell core.
pwsh
*/
HostEmu> pwsh
pwsh> 
/*
Now the default interpreter is pwsh.
No need to surround the commands with quotes.
*/

/*
Find the commands containing "rexx":
*/
pwsh> 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-…
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
setenv-rexx                      /Users/Shared/local/rexx/builder/scripts/setenv-rexx
testOORexx.rex                   /local/rexx/oorexx/official/test/trunk/testOORexx.rex

pwsh> 
/*
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> get-command *rexx* | select -property name, source | format-table -HideTableHeaders | rxqueue
pwsh> 
/*
Collect the lines of the rexx queue in an array, and then parse the lines to create an ooRexx directory.
*/
pwsh> oorexx .rexxqueue~new~makearray~select{item <> ""}~reduce(.directory~new){parse value item~space with name source; accu[name]=source}=
a Directory (19 items)
'bsf4ooRexx-v641-20220131-bin.jar' : '/local/rexx/bsf4oorexx/BSF4ooRexx_install_v641-20220131-ga/bsf4oorexx/bsf4ooRexx-v641-20220131-b…'
'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'
'setenv-rexx'                      : '/Users/Shared/local/rexx/builder/scripts/setenv-rexx'
'testOORexx.rex'                   : '/local/rexx/oorexx/official/test/trunk/testOORexx.rex'
pwsh> 
/*
Back to the ooRexx interpreter, by entering "oorexx" alone.
*/
pwsh> oorexx
ooRexx[bash]> say "The default interpreter is now ooRexx"
The default interpreter is now ooRexx
ooRexx[bash]> 
/*
End of demonstration.
*/