13 May, 2012

How to write a simple REXX program?

Here is a key to learn REXX.
  • Start with Keyword REXX in comments
  • Comments are enclosed between /* and */
  • /* REXX */ in the first line of REXX Exec makes the command processor (TSO) invoke the REXX interpreter.
  • ; To Separate two Instructions (optional)
  • , To Continue an Instruction (optional)
  • SAY and PULL are two basic commands in REXX.
  • SAY – To Display the text on the Terminal
  • PULL – To Accept the input from the user in upper case

Learn REXX

REXX Routine: (save the below code in a PDS member)

/*REXX*/
SAY 'ENTER TWO NUMBERS'; PULL NUM1 NUM2
SUM = NUM1 + NUM2
SAY 'THE SUM OF THE’,
    'TWO NUMBERS IS'
SAY SUM

Execute the Routine by giving the below TSO Command

TSO EXEC <PDS NAME>(<MEMBER NAME>)

Output:

ENTER TWO NUMBERS
4 5
 THE SUM OF THE TWO NUMBERS IS
9

Note: You can expect more Mainframe related stuffs in my future blog posts'
Tags:

No Responses to "How to write a simple REXX program?"

Subscribe to Comment follow up

Comment Form

Trackbacks