On 17.04.2024 02:12, Andrew Rowley wrote:
On 16/04/2024 3:08 am, Jon Perryman wrote:
From a language standpoint, REXX is just another language but it's real strength is it's
environment integration. Instead of the caller maintaining libraries, the environment
automatically integrates with REXX. For instance, REXX in the TSO environment, gives you access
to TSO commands (address TSO) and z/OS programs (address linkmvs). Start ISPF and address ISPEXEC
is available. ISPF option 2 gives you address ISREDIT. SYSCALLS ON gives you address syscalls.
Rexx has better integration with z/OS, but Java has better integration with the
rest of the world.
I just wrote a piece about sending SMS text messages from z/OS:
https://www.blackhillsoftware.com/news/2024/04/15/text-message-alerts-from-the-z-os-smf-real-time-interface/
Spoiler: it's 2 Java statements using the Twilio API.
Twilio.init(ACCOUNT_SID, AUTH_TOKEN); Message message = Message.creator( new
com.twilio.type.PhoneNumber("+14159352345"), // to new
com.twilio.type.PhoneNumber("+14158141829"), // from args[0]) .create();
Twilio provide a library that can be used to send text messages from z/OS. Amazon provide a
library that can be used to work with AWS services from z/OS. It's very common for cloud providers
to provide Java libraries for working with their services. Most of them will work on z/OS and open
up those features to the mainframe.
Java is also a much more powerful language. I used to write a lot of Rexx, but I hate to go back
because it is so much easier to get things done in Java.
Rexx is good for small tasks where the overhead of starting the JVM is significant, or where there
isn't functionality in Java. Otherwise, Java is my choice.
As you know already Rexx it would be easy for you to learn about what ooRexx adds to Rexx. Take half
an hour and read "Proposing ooRexx and BSF4ooRexx for Teaching Programming and Fundamental
Programming Concepts" at
<https://research.wu.ac.at/files/41301564/ISECON23_Flatscher_Proposing_ooRexx_article.pdf>.
Using the ooRexx-Java bridge BSF4ooRexx (which I have been authoring for over twenty years and
available for all major operating systems like Windows, Linux, macOS, also a s390x version is
available) you can easily write ooRexx programs that use any of the Java class libraries on any of
the supported operating systems.
Notabene: you write one ooRexx program that will be runnable without any changes on Windows, Linux
and macOS. This means you develop it e.g. on Windows at home and execute it in a Linux s390x
subsystem at work and vice versa. ;)
To give you an idea I transcribed your interesting example given in Java using the depicted code
supplied by your link above which looks like:
/* Java version,
cf.<https://www.blackhillsoftware.com/news/2024/04/15/text-message-alerts-from-the-z-os-smf-real-time-interface/>
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Message;
import com.twilio.type.PhoneNumber;
public class TwilioTest {
// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. Seehttp://twil.io/secure
public static final String ACCOUNT_SID =
System.getenv("TWILIO_ACCOUNT_SID");
public static final String AUTH_TOKEN =
System.getenv("TWILIO_AUTH_TOKEN");
public static void main(String[] args) {
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
Message message = Message.creator(
new com.twilio.type.PhoneNumber("+14159352345"), // to
new com.twilio.type.PhoneNumber("+14158141829"), // from
args[0])
.create();
System.out.println(message.getSid());
}
}
As practically all Java classes get documented as interlinked HTML files and usually are published
on the Internet one can get at these JavaDocs using Internet search engines. One of the possible
hits is e.g.: <https://javadoc.io/doc/com.twilio.sdk/twilio/latest/com/twilio/Twilio.html>.
So anyone could take a look at how JavaDocs look like and use Internet search engines to get
additional information.
Using the above Java program as an example here the (untested) ooRexx code:
/* ooRexx version (using BSF4ooRexx) */
parse arg argument /* get argument */
/* get values from process environment */
account_sid=value("TWILIO_ACCOUNT_SID", ,"ENVIRONMENT")
auth_token =value("TWILIO_AUTH_TOKEN" , ,"ENVIRONMENT")
/* initalize Twilio environment */
bsf.loadClass("com.twilio.Twilio")~init(account_sid, auth_token)
/* create phone numbers */
phoneTo =.bsf~new("com.twilio.type.PhoneNumber", "+14159352345")
phoneFrom=.bsf~new("com.twilio.type.PhoneNumber", "+14158141829")
/* load Message class and use its static method creator) */
clzMsg=bsf.importClass("com.twilio.rest.api.v2010.account.Message")
/* create message */
message=clzMsg~creator(phoneTo, phoneFrom, argument)~create
say message~getSid
::requires BSF.CLS -- get the ooRexx-Java bridge
A dynamic and dynamically typed language as ooRexx allows to forgo many of the declarations a static
and statically typed language mandates, thereby simplifying coding quite considerably.
The aforementioned article demonstrates (tested) nutshell examples that hopefully show the
interested reader that it is indeed rather easy to use any Java class library directly from ooRexx.
Those nutshell examples run unchanged on Windows, Linux and macOS which is quite remarkable.
---rony
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN