DesktopLinux
Home  |  News  |  Articles  |  Forum  |  Polls  |  Blogs  |  Videos  |  ITLink

Keywords: Match:
Using Rexx for easy Desktop Linux scripting
by Howard Fosdick (May 28, 2005)

Foreword: This article by Howard Fosdick, author of the Rexx: Programmer's Reference, tells you everything you need to know to get started using Rexx on your Linux desktop. Linux features powerful scripting languages like Bash and Perl, but these may not be suitable for end user scripting. Rexx, on the other hand, has proven ideal for desktop Linux users, according to Fosdick, yet it combines both ease of use and power, and is available in a three basic forms including procedural ("classic" Rexx), object-oriented, and Java-compatible versions.



Using Rexx for easy Desktop Linux scripting

by Howard Fosdick

Linux runs a plethora of free shell languages. These include Bash, the KornShell, the C shell, and their supporting tools such as awk, sed, and yacc. Linux also offers an exceptional selection of powerful free scripting languages such as Perl, Python, and Ruby.

Linux developers dwell in hog heaven. Who wouldn’t love this set of powerful scripting tools?

The answer, of course, is the desktop user. This person is not a professional developer. He doesn’t have the time or inclination to learn an advanced language like Bash or Perl. Nor does he program full-time. This person might be an IT professional who is employed somewhere other than in desktop development. Or she might be a "sophisticated user" -- a professional employed outside of IT, such as a business person or administrator or engineer or scientist.

Users script to tailor their systems, automate repetitive tasks, or solve simple programming problems. Languages that base their power on complex syntax, such as Bash or Perl, are difficult for them to learn, master, and remember. Users require a language they can script from memory, since they don’t program every day. They like languages with minimal syntax, forgiving formatting, and easy interactive debugging. Their language has to be designed for quick learning and ease of use while still supplying power.

Rexx fulfills this role. Rexx was bundled with both OS/2 and the Amiga OS based on its exceptional ease of learning and ease of use. But Rexx yields power: the language drives mainframes, where it has been the default scripting language for over twenty years.

Ease of use and power conflict. Rexx reconciles them through its tiny instruction set surrounded by a large set of built-in functions. As in C language, this design allows users to quickly code in the language while expanding their knowledge into the function set at their own pace. But Rexx differs from C in that scripts contain almost no punctuation or syntax. Rexx instructions and functions are high-level.

Rexx is a glue language. Scripts easily stitch together existing programs, scripts, operating system commands, APIs, DLLs, shared libraries, objects, widgets, components, and the like. Rexx supplies power through easy extensibility: external functions are coded just like internal ones (after a statement sets up access to the external library). Scripts leverage existing code to increase productivity and give power to casual programmers.

Rexx capitalizes on its interpreted nature to avoid the programming restrictions that frustrate non-professionals. Take data typing and storage allocation, for example. Rexx does not type variables; all variables contain variable-length strings. Variables containing valid numbers may be used in computations, while the others are simply character, bit, or hex strings. Variables may either defined by use or declared in advance. Rexx automatically manages all aspects of variable sizing and storage allocation.

Consider how this applies to arrays. An array does not have to be declared. Its size automatically expands and contracts as required. Arrays can contain like or varied data elements. They can be homogeneous or heterogeneous, sparse or dense, indexed by numbers or arbitrary strings or variables, and subscripted to any degree.

This flexibility yields power. Yet it is all based on the simple syntax of variable names separated by periods, such as: my_array.1 or my_array.1.4.

Arrays may be indexed by variables and arbitrary character strings as well as numbers, as in my_array.my_subscript. This allows users to create any imaginable data structure with them, including lists, key-value pairs, look-up tables, trees, balanced trees, linked lists, doubly-linked lists, and more. All this is achieved with the simple "dot notation" of arrays. No other syntax is necessary. The result is power without complexity.

Rexx varieties

Rexx comes in three basic varieties: Procedural or Classic Rexx; Object-oriented Rexx; and NetRexx.
  • Procedural or Classic Rexx -- this variety of Rexx features a strong international standard to which all interpreters adhere. It's a cross-platform scripting tool that runs on every imaginable platform, from handhelds to PCs to servers to mainframes. Users can run the same scripts on desktop Linux as on their handhelds, for example. Rexx even integrates desktop Linux into mainframe sites because it is the predominant mainframe scripting language.

    When using Procedural (Classic) Rexx, Linux users can choose among three available Rexx interpreters:

    • Regina features many built-in extensions to the language and comes with book-quality documentation. Regina runs under all varieties of Linux, BSD, and Unix as well as all other major operating systems. Regina has a large user community and is a great place to start with Rexx.

    • Rexx/imc was specifically designed for Linux, BSD, and Unix. It is a standard Rexx with a few well-chosen additional features for the Linux user. Rexx/imc has been around for a decade. It's a rock-solid interpreter with a proven, long-term track record for support.

    • BRexx is the smallest and fastest Rexx interpreter. It runs in tiny and embedded Linux systems (as well as on the Mac OS, Windows CE, DOS, BSD, Unix and Amiga OS). BRexx runs like a bandit with the cops on his tail in memory-resident Linuxes like Knoppix.

  • Object-oriented Rexx -- this variety of Rexx was originally developed by IBM Corporation. Called Object REXX, it was released as open source and turned over to the Rexx Language Association in late 2004. The Rexx L.A. renamed it Open Object Rexx or ooRexx for short. ooRexx is fully object-oriented. It supports inheritance, multiple inheritance, classes, messages, polymorphism, overloading, intra-object concurrency, and a powerful class library. Open Object Rexx runs under all versions of Linux, Unix, and Windows.

    What makes ooRexx unique is that it is 100 percent upwardly-compatible with classic Rexx. Users can work under ooRexx immediately, coding procedural scripts, then wander into object-oriented scripting at their own pace. Companies preserve their investment in traditional Rexx scripts even as they migrate to object-oriented scripting.

    Are object-oriented languages the best choice for desktop users? The question is debatable. If you believe they are ooRexx presents an easy-to-learn alternative to Python or Ruby.

  • NetRexx -- this final variety of Rexx brings Rexx's traditional user-friendliness to the Java environment. It either runs under the Java Virtual Machine (JVM) or stand-alone. NetRexx scripts use Java classes and may be used to create classes used by Java programs. NetRexx can be used to develop applets, applications, servlets, classes, and beans. NetRexx is not a standard Rexx and can best be described as a "Rexx-like language." Most consider it a developer tool rather than an end-user language.

    NetRexx's big advantage is that it provides an easy scripting alternative to traditional Java programming. An IBM study showed that NetRexx reduced the number of lexical tokens versus Java source for a typical class by about 35 percent while requiring 20 percent fewer keystrokes. With complete JVM compatibility, NetRexx can be intermixed to any degree desired into Java-based systems. NetRexx can even generate fully commented Java code.

Rexx For Desktop Linux?

With its very different personality, Rexx nicely complements Linux's power scripting languages. Rexx offers ease of use and ease of learning while supplying power and flexibility. It is especially suitable for end user programming and for use by computer professionals who script only on occasion. Rexx addresses the needs of the desktop Linux user.

Rexx has hundreds of thousands of users world-wide. Yet it's little-known within the American Linux community because its heaviest use has been on other platforms. Rexx earned itself a role as the bundled language of operating systems like the Amiga OS and OS/2. It fulfills a real need for desktop Linux users.

Learn More

This short article omits the most important item in your understanding of Rexx -- example scripts. You can download several dozen example scripts in a single compressed file. These examples run under Linux and/or Windows. They include a half-dozen Open Object Rexx scripts for Linux.

My new book Rexx Programmer's Reference covers everything about free Rexx. It starts with a simple tutorial, then progresses into advanced scripting, tools and interpreters, and a complete language reference.

What about support? The Rexx Language Association is an international organization devoted to Rexx. Along with the web sites above for specific interpreters, it’s a great source of tools and information. Rexx forums offer support in a half dozen languages. Check them out in English, French, German, Russian, and Japanese. An international platform like desktop Linux needs international support -- and Rexx provides it.



About the Author: Howard Fosdick is an independent DBA contractor who's worked with most major scripting languages. His book Rexx: Programmer's Reference is the complete tutorial and reference for Rexx. It covers all aspects of the language, its tools and interfaces -- in 700 pages for under $30.



Related stories:

(Click here for further information)


7 Advantages of D2D Backup
For decades, tape has been the backup medium of choice. But, now, disk-to-disk (D2D) backup is gaining in favor. Learn why you should make the move in this whitepaper.

4 Legal Reasons to Control Internet Access
The Internet is obviously a valuable resource for many organizations. However, many are exposed to legal liability concerns because they fail to control Internet access. Learn if you're safe in this white paper.

Rapidly Resolve J2EE Application Problems
Whether you are in the process of building J2EE applications or have J2EE applications already running in production, you must ensure that they deliver the expected ROI. Learn how in this white paper.

Load Testing 2.0 for Web 2.0
There are many unknowns in stress testing Web 2.0 applications. Find out how to test the performance of Web 2.0 in this white paper.

Build Better Games Online
For the game infrastructure providers, life is complex. Making money from games has become more complicated. Why? Find out in this white paper.

Building a Virtual Infrastructure from Servers to Storage
This white paper discusses the virtual storage solutions that reduce cost, increase storage utilization, and address the challenges of backing up and restoring Server environments.

Gaining Faster Wireless Connections with WiMAX
Welcome to what is quickly becoming the hyperconnected world where anything that would benefit from being connected to the network will be connected. Learn more in this white paper.

Is Your Desktop a Security Threat?
The new wave of sophisticated crimeware not only targets specific companies, but also targets desktops and laptops as backdoor entryways into those business’ operations and resources. Learn how to stay safe in this white paper.

Increasing SAN Reliability by 100 Percent
Storage area networks (SAN) are a strong part of storage plans. Learn how to increase your reliability and uptime by 100 percent in this case study.

 



Got a HOT tip?   please tell us!

ADVERTISEMENT
(Advertise here)


Desktop Linux books

Join our Desktop Linux discussion forums:
•  Moving to Linux
•  Linux/Windows debate!
•  Linux Q&A
. . . and more

Linux vs. Windows
•  in the enterprise
•  in gadgets & devices
Most popular recent stories:
• A Vista vs. Linux matchup
• Choosing a desktop Linux distro
• Linus versus GNOME
• Why Windows wins and Linux loses
• The best free desktop Linux
• Why Windows Vista will suck
• 2006 Desktop Linux year in review
• The well-tempered Debian desktop
• Here come the Dell Linux desktops, laptops
• Seven Linux distros fight over one old ThinkPad
• Putting openSUSE 10.2 through its paces
• Results from the 2006 Desktop Linux Survey

BREAKING NEWS

• Fedora 9 KDE 4.0 features reviewed
• Linux gains action RPG
• Hats off to Fedora 9
• Linux for the self-employed
• CNR supports Linux Mint, adds Weatherbug
• Ubuntu ported to PDA
• Sample chapter available for new Scalix book
• Sun launches OpenSolaris
• EeePC to gain Linux content aggregation tool
• A Windows-like install for Hardy Heron
• Ubuntu 8, Fedora 9 package OpenJDK
• A "hardy" Linux distro goes to work
• KDE Linux reaches 52 million Brazilian kids
• Tutorial explains Mandriva 2008 configuration
• Google Maps gains easy Linux install



Linux-Watch headlines:
• Verizon chooses Linux "platform of choice"
• Hats off to Fedora 9
• Running a small business on desktop Linux
• Sun launches OpenSolaris
• Via tiptoes toward openness
• Linux certification comes to Italy
• Installing Ubuntu Hardy Heron as a web hosting server
• Black Duck Buys Koders
• Open source conference co-locates with Ubuntu show
• Ubuntu 8.04 ready to challenge Windows


Visit the...


news feed

Home  |  News  |  Articles  |  Forum  |  Polls  |  About  |  Contact
 
Use of this site is governed by our Terms of Service and Privacy Policy. Except where otherwise specified, the contents of this site are copyright © 1999-2008 Ziff Davis Enterprise Holdings Inc. All Rights Reserved. Reproduction in whole or in part in any form or medium without express written permission of Ziff Davis Enterprise is prohibited. Linux is a registered trademark of Linus Torvalds. All other marks are the property of their respective owners.