In this section, we will guide you through the process of setting up the REXX programming environment on your computer. This involves installing the necessary software and configuring your system to run REXX scripts. By the end of this section, you will be ready to write and execute your first REXX program.

  1. Understanding the REXX Environment

Before we dive into the setup process, it's important to understand what the REXX environment consists of:

  • Interpreter: The REXX interpreter is the software that reads and executes REXX scripts.
  • Editor: A text editor to write your REXX scripts. This can be any text editor of your choice, such as Notepad++, VS Code, or even a simple text editor like Notepad.

  1. Installing the REXX Interpreter

There are several REXX interpreters available, but for this course, we will use Regina REXX, which is a free and open-source implementation of the REXX language.

Steps to Install Regina REXX

  1. Download Regina REXX:

    • Visit the Regina REXX website.
    • Navigate to the download section and choose the appropriate version for your operating system (Windows, macOS, or Linux).
  2. Install Regina REXX:

    • Windows:
      • Run the downloaded installer and follow the on-screen instructions.
      • During installation, you may be prompted to add Regina REXX to your system's PATH. Ensure this option is selected to make it easier to run REXX scripts from the command line.
    • macOS:
      • Open the Terminal.
      • Use a package manager like Homebrew to install Regina REXX by running the command:
        brew install regina-rexx
        
    • Linux:
      • Open the Terminal.
      • Use your distribution's package manager to install Regina REXX. For example, on Ubuntu, you can run:
        sudo apt-get install regina-rexx
        
  3. Verify the Installation:

    • Open a command prompt or terminal window.
    • Type the following command to check if Regina REXX is installed correctly:
      rexx -v
      
    • You should see output indicating the version of Regina REXX installed.

  1. Setting Up Your Text Editor

You can use any text editor to write REXX scripts. Here are some popular options and how to set them up for REXX development:

Notepad++ (Windows)

  1. Download and Install Notepad++:

    • Visit the Notepad++ website and download the installer.
    • Run the installer and follow the on-screen instructions.
  2. Configure Syntax Highlighting for REXX:

    • Open Notepad++.
    • Go to Language > Define your language....
    • Click Create New and name it "REXX".
    • Define the syntax highlighting rules for REXX keywords, comments, and strings.

Visual Studio Code (Cross-Platform)

  1. Download and Install Visual Studio Code:

    • Visit the Visual Studio Code website and download the installer for your operating system.
    • Run the installer and follow the on-screen instructions.
  2. Install REXX Extension:

    • Open Visual Studio Code.
    • Go to the Extensions view by clicking the Extensions icon in the Activity Bar on the side of the window.
    • Search for "REXX" and install a suitable extension for REXX syntax highlighting and support.

Vim (Cross-Platform)

  1. Install Vim:

    • Vim is often pre-installed on many Unix-based systems. If not, you can install it using your package manager.
    • For example, on Ubuntu, you can run:
      sudo apt-get install vim
      
  2. Configure Syntax Highlighting for REXX:

    • Open Vim and edit your .vimrc file to include syntax highlighting for REXX.
    • Add the following lines to your .vimrc:
      syntax on
      au BufNewFile,BufRead *.rexx set filetype=rexx
      

  1. Writing and Running Your First REXX Script

Now that you have set up the REXX environment, let's write and run a simple REXX script.

Writing the Script

  1. Open your text editor.
  2. Create a new file and save it with a .rexx extension, for example, hello.rexx.
  3. Write the following code in the file:
    /* Hello World in REXX */
    say "Hello, World!"
    

Running the Script

  1. Open a command prompt or terminal window.
  2. Navigate to the directory where you saved your hello.rexx file.
  3. Run the script by typing:
    rexx hello.rexx
    
  4. You should see the output:
    Hello, World!
    

Conclusion

In this section, you have successfully set up the REXX environment on your computer. You installed the Regina REXX interpreter, configured a text editor for writing REXX scripts, and ran your first REXX program. You are now ready to dive deeper into REXX programming. In the next section, we will cover the basic syntax and structure of REXX programs.

© Copyright 2024. All rights reserved