---
title: "Mainframe Rexx for Beginners (1 of 3)"
description: "REXX is a platform-independent Scripting Language. It uses extensively in the mainframe. It is a free-flow language. Let us take a simple program (Reference \"Informit\") /* GUESSING GAME -- try guessin..."
url: https://srinimf.com/2012/05/13/rexx-beginers-for-mainframe-1of-3/
date: 2012-05-13
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2012/05/pexels-photo-3952034.jpeg?fit=1880%2C1255&ssl=1
categories: ["REXX"]
tags: ["REXX"]
type: post
lang: en
---

# Mainframe Rexx for Beginners (1 of 3)

REXX is a platform-independent Scripting Language. It uses extensively in the mainframe. It is a free-flow language.

## Let us take a simple program (Reference “Informit”)

```
/* GUESSING GAME -- try guessing the randomly-generated number */

do while end_this_game <> ’N’
   the_number = random(1,5)  /* generate the random number */
   say "I’m thinking of a number between 1 and 5, what is it?"

   pull your_guess
    say "You entered: " your_guess

   if your_guess = the_number then
      say ’You guessed it! The number was: ’ the_number
    else do
      say ’Sorry, the number was: ’ the_number
      say ’We should have bet on this!’
    end

   say ’Try again? [Y or N]: ’
    pull end_this_game
 end
```

**The above program is self-explanatory.**

**Points:**

- REXX program always starts with /*…….*/ (No problem you can span comments in multi-lines)
- Variables initialization is optional
- T[here is](https://srinimf.com/2014/04/29/nosqlz-dbms-for-mainframe-zos/) a number of error-handling conditions available. Some of them are: novalue, error, failure, halt, notready, syntax, lastdigits  
- PULL means in Cobol it is Accept. Say- in Cobol it is Display. 

In my next posts, I will give details from starting of REXX and its usage in the mainframe.

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2012%2F05%2F13%2Frexx-beginers-for-mainframe-1of-3%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2012%2F05%2Fpexels-photo-3952034.jpeg%3Ffit%3D1200%252C801%26ssl%3D1&description=Mainframe%20Rexx%20for%20Beginners%20%281%20of%203%29)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2012/05/13/rexx-beginers-for-mainframe-1of-3/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2012/05/13/rexx-beginers-for-mainframe-1of-3/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2012/05/13/rexx-beginers-for-mainframe-1of-3/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2012/05/13/rexx-beginers-for-mainframe-1of-3/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20Mainframe%20Rexx%20for%20Beginners%20%281%20of%203%29&body=https%3A%2F%2Fsrinimf.com%2F2012%2F05%2F13%2Frexx-beginers-for-mainframe-1of-3%2F&share=email)
-

### Like this:

Like Loading…
