[MAINFRAME, IBM MAINFRAMES TUTORIAL, JCL TUTORIAL, VSAM TUTORIAL, COBOL TUTORIAL, DB2 TUTORIAL, CICS] Introduction to Rexx

68 views
Skip to first unread message

Quasar

unread,
Mar 9, 2012, 10:37:14 PM3/9/12
to mainfra...@googlegroups.com
Q. What is Rexx? Is Rexx easy to learn? Why should I program in Rexx?
250px-Rexx-img-lgThe acronym Rexx stands for REstructured eXtended eXecutor. Rexx was developed in the year 1979, by a programmer, Mike Cowlishaw, who is now a visiting professor at the University of Warwick. The language Rexx is recommended for beginners, because it has a simple instruction set – just a couple of dozen instructions.

Rexx is a free-form language. Unlike COBOL, a Rexx program does not have a definite structure – like DIVISIONs, SECTIONs and Paragraphs.


COBOL Programs have to be compiled(translated) to machine code, before you run them. On the other hand, Rexx is an interpreted language. Once you code a Rexx Program, you don't have to compile it. Instead, the Rexx Interpreter simply reads your source-code one line at a time, interprets it and executes it.

One of the reasons, why you should learn Rexx, is that it increases the productivity of the average Mainframe Programmer. Repetitive tasks which are tedious, and require manual labour can be automated using Rexx. Just like you use the FIND, CHANGE, SAVE Commands in the ISPF Editor, you may code your very own custom commands using Rexx. 

Rexx programs you can talk to other software applications that run on the Mainframe. A Rexx program can talk to the TSO Software. Like Windows on the PC Platform, ISPF is the Graphical User-Interface(GUI) software on the Mainframes platform, to do day-to-day common tasks such as creating files, editing files, deleting files etc. You can write a Rexx program, that ADDRESSes(talks to) ISPF. Rexx integrates beautifully with DB2, SDSF etc. Has it crossed your mind, you can write COBOL Programs too, to do all that I've said above. But, as a norm, you generally write programs in COBOL to implement business rules, build an Insurance Product like a Annuities system, or a banking product.


--
Posted By Quasar to MAINFRAME, IBM MAINFRAMES TUTORIAL, JCL TUTORIAL, VSAM TUTORIAL, COBOL TUTORIAL, DB2 TUTORIAL, CICS at 3/10/2012 09:07:00 AM

Quasar

unread,
Mar 10, 2012, 8:07:14 AM3/10/12
to mainfra...@googlegroups.com
Q. How do you code comments in Rexx? What is the SAY instruction?
Comments in Rexx must be enclosed within a /* and a */. Every Rexx program should contain the word "Rexx" in its first line of source-code. Usually this will be a comment.

Its a good practise that you liberally sprinkle your Rexx Program with comments, explaining the purpose and meaning of the code. This helps your friends understand your code.

The SAY Instruction in Rexx is used to display text on the Mainframe Terminal. The syntax of the SAY Instruction is as follows -

SAY expression

Here's a simple Rexx Program to get you started with.

image

The SAY <expression> Instruction always prints the value of the expression on the Mainframe terminal. For example, say 'Hello World' would display Hello World on the screen.

Rexx does not require you to explicitly declare variables. For example, the variable number is assigned the integer-value 5. So, say number would display the value 5 on the Mainframe Screen. The variable text is assigned the character string 'I am learning Rexx'. say text would display 'I am learning Rexx' on the screen.
Q. How do I execute or run my Rexx Program?
To execute a Rexx Program, a simple and easy way is to type the character 'ex' as in execute, against the member-name in the Personal Data-set(PDS) Library you are using to store your Rexx Programs. I am going store all my Rexx Programs in my library SYSADM.DEMO.REXXLIB. The name of my program is REXX01. Look at the below screenshot, on how to run REXX01.

image

I typed ex against the member-name REXX01, and pressed Enter. Here's the output, you should be able to see.

image
Reply all
Reply to author
Forward
0 new messages