REXX Tips and Tricks

Автор: Karthik B

Дата: 01.2014

Источник: блог "REXX Tips and Tricks"

 

Гуляя на просторах инета случайно набрел на блог Karthik B посвященный программированию на Rexx. В настоящий момент в нем несколько записей об азах понимания что такое Rexx. Не смотря на это, считаю возможным разместить на сайте ссылку на блог и привести размещенные в текущий момент на нем сообщения. Будем надеяться, что автор блога продолжить изучение языка и будет периодически писать новые сообщения. Пожелаем ему здоровья и творческих успехов!

Желающие могут самостоятельно проследить за новыми сообщениями на блоге.

 

REXX Tips and Tricks Blog will provide detailed information about REXX language. It will help a user to become expert in REXX.

 

Wednesday, 1 January 2014

Functions in REXX

This are also called as Commands or Instructions which instruct the REXX compiler what are all the things to do.

Terminal input and output

Say - 'Say' Command is used to display output to the terminal/user.

Pull - 'Pull' command is used  to recieve input from the terminal/user. user has to Press 'Enter' once the user given the input.

Example:

SAY “ENTER YOUR AGE”
PULL AGE /*What ever the person types is converted
into upper case and stored in AGE */

PARSE PULL AGE /* Same as above, but input is not
converted to Uppercase */

SAY ‘ENTER YOUR FIRST AND LAST NAME ‘

PULL FNAME LNAME /*REXX assumes variables are
delimited by space */


Tip: Suppose if a user want to display the variable name as it is in the terminal then he should write the variable within single quotes.

For Example, consider the below program.

/* REXX */

Say A
A = Hello World
Say A
Say 'A'

Say A Statement in above code behaves differently.

First 'Say A' displays 'A' as 'A' doesn't contain any value.

Second 'Say A' displays as 'Hello World' as 'A' contains 'Hello World'.

Third 'Say 'A'' displays the word 'A'.

 

Variables in REXX

There is no variable declaration in REXX. Varaibles are declared on the fly the first time it appear in a statement.

For Example, consider the below program.

/* REXX */

Say A
A = Hello World
Say A

Say A Statement in above code behaves differently.

First 'Say A' displays 'A' as 'A' doesn't contain any value.

Second 'Say A' displays as 'Hello World' as 'A' contains 'Hello World'.

THE RULES FOR VARIABLE NAMES ARE
FIRST CHARACTER NOT 0-9 OR PERIOD.
REMAINING CHARACTERS ANYTHING EXCEPT BLANK.
CAN BE 250 CHARACTERS LONG
UPPER AND LOWER CASE CHARACTERS ASSUMED BE THE
SAME.

VARIABLES CAN ASSIGN THE VALUE USING SIMPLE
ASSIGNMENT STATEMENT OF THE FORM

= EXPRESSION

Variables can be used in arithmetic expression if they contain valid numeric value.

Explicit and Implicit Execution of REXX

After you have placed REXX instructions in a data set, you can run the exec
explicitly by using the EXEC command followed by the data set name

Explicit execution
= TSO EX ‘Q1.Q2.EXEC(HWORLD)’


or implicitly
by entering the member name. You can run an exec implicitly only if the PDS that
contains the exec was allocated to a system file (SYSEXEC OR SYSPROC) or it
is allocated to an application CLIST OR EXEC.

Implicit Execution
= TSO HWORLD

 

What is REXX and How to create a REXX Program?

REXX (Restructured EXtended eXecutor) is a powerful interactive
programming language that can execute system commands, such as TSO, ISPF
etc.
REXX is a procedural language that allows programs and algorithms to be written
in a clear and structured way. It is easy to use by experts and casual users alike.
REXX has been designed to make manipulation of the kinds of symbolic objects
people normally deal with such as words and numbers.

What we can do with REXX?

1. Request Input from the terminal/user.
2. Display output to the terminal/User.
3. Execute TSO Commands.
4. Read files.
5. Write files.

How to write a REXX Program?

Creating a REXX program is as simple as 1-2-3.

Here is sample program 'Hello World'.

1. open a PS file.

2. Write the below code and  save the file.

/*  REXX */
SAY 'HELLO WORLD'

Every REXX program should have word 'REXX' in it's first line.

3. Give 'EX' before the member name to execute the macro.

 

Wednesday, 18 December 2013

Request a material

Request a material is specific for users to request any material or ebooks related to any mainframe technologies. User can request through comments and we will work to provide better solution for your queries. This section is not limited to REXX. It is for any other mainframe technologies like JCL,DB2,COBOL and CICS.
Requesting users to make good use of this..!!

 

Sunday, 8 December 2013

REXX Tips and Tricks - Introduction

This Blog will help user to understand REXX easily with very less knowledge in REXX. We will be posting examples which are easily understandable. We will be posting more specific REXX programs/codes which will help users to perform their Day to day activities easily.
There going to be Specific post as '
Request a Material' where user can request for particular material and we will be providing the link or solution to the user.
This Blog will also contains other mainframe languages like JCL,DB2,COBOL and CICS material.
REXX Tips and tricks will make learning REXX easier one for the users. We will welcome other users to share their knowledge here so that it will be a common forum for learning REXX.