You are on page 1of 100

INTERNAL TRAINING PROGRAM

REXX
WIPRO TECHNOLOGIES

REXX/WIPRO TECH

SESSION ONE
REXX BASICS
INTRODUCTION TO REXX ADVANTAGES OF REXX CODING RULES EXECUTING A REXX EXEC TALKING TO THE ENVIRONMENT
REXX/WIPRO TECH 2

INTRODUCTION.
REXX is the most exciting language youll find on IBMs mainframe systems. Rexxs main function is to pass commands to TSO or the dialogue Manager of TSO/ISPF. Rexx is more than just a facility that lets you put TSO commands into a procedure; its a full-fledged programming language. It lets you create variables and use them in expressions to perform calculations or test specific conditions. Rexx provides a full set of control instructions, including IF-THEN-ELSE and a powerful DO instruction. It allows you to communicate with terminal user by displaying messages and accepting data from keyboard.

REXX is an interpreted language rather than a compiled language. As a result , you dont have to compile and link-edit a REXX exec before you can use it, instead the interpreter reads and interprets the instructions in your exec one at a time.
REXX/WIPRO TECH 3

ADVANTAGES OF REXX.
A. MAIN FUNCTION OF REXX. REXXs main purpose is to pass commands to tso and/or the dialogue manager of TSO/ISPF. B. AUTOMATING REPETITIVE TASKS. Instead of keying a series of commands over and over again you can place these commands within a REXX program and then REXX can pass these commands to TSO or TSO/ISPF. This eliminates keying errors. C. INTERACTING WITH THE DIALOGUE MANAGER. The TSO/ISPF Dialogue manager allows you to create and display custom-made panels. So using REXX you can create sets of panels or menus, much like ISPF itself ! D. CREATING NEW COMMANDS. With REXX you can create programs that behaves as if they are new TSO commands. You can execute these programs by typing the name just like any other TSO command while you are in Line mode TSO. If you are in ISPF you must preface your command with TSO , so ISPF will know you are not talking to it but to TSO. E. PERSONAL PROGRAMMING. REXX is so easy , you can use it for those short (or long !) programs that helps you in everyday affairs.
REXX/WIPRO TECH 4

CODING RULES
In general there are no column rules for REXX. Start your program in any column and continue in any column you choose. Words should be separated by one or more spaces. Start the programs with a command line like this /* REXX SAMPLE PROGRAM*/ It says us this is a sample REXX program, it also say the same thing to TSO. TSO sees the word REXX and knows that it a REXX program not a CLIST. You may have comments anywhere in your program.

Components of REXX
Rexx is broken down into seven components. Keywords, Assignment statements, Literal, Variable, Command, Label and Function. l Key words. Like most other languages REXX has verbs with specific meaning, each verb is a keyword and is found first in the sentence. E.g.. Address, ARG, CALL, DO, NOP etc... l Assignment. First component in this feature is a variable may not be in quotes. The variable is made equal to whatever is the right of the equal sign.
A=5 TOTAL = 5 + 25 NAME = AISH REXX/WIPRO TECH 5

Literal. Stands for literal, literals are normally enclosed in quotes or apostrophes. Although REXX can
interpret a literal as such if you forget the quotes or apostrophes. REXX will first look the string of character is a variable if it is then REXX uses the contents of the variable else REXX takes the character string as a literal, but will convert it to upper case.
GOOD DAY GOODBYE 12345 F1F2F3X (hex string)

If you need apostrophe in a literal as in the name OConnor , you can use either one of the following ways. OConnor O Connor You can put a plus sign or minus sign in front of a numeric literal then REXX will never treat it as a mere character string. In REXX you can have quotes or apostrophes for numeric literals. This means 1243 is legal in REXX. In REXX a literal may be up to 251 characters in length. You can concatenate two literals to produce a longer one
LONG_VAR = LONG STRING TO END OF LINE ||, REST OF STRING ON NEXT LINE LONG_VAR = LONG STRING TO END OF LINE, REST OF STRING ON NEXT LINE

If you put the letter X after a literal in quotes or apostrophes, REXX will take it as a hex string M Any time you put an X after a quoted string , REXX takes it as a hex string , This will lead into syntax errors X = 12 + 22 /* syntax error : attempts hex interpretation*/
REXX/WIPRO TECH 6

Variable. The variable holds information which may change during the program execution.
A B NAME EMP_ADDRESS RECORD.I

Variable names must begin with a letter and may as long as 250 characters. Underscore character can be used , period is not allowed. A variable that was never given a value is taken as a literal but converted into upper case. Command. Command is something that is understood by the operating system such as TSO. REXX passes it to TSO for TSO to process.
ALLOCATE LOGOFF LISTCAT SEND HDX WELCOMES YOU USER(T12089)

REXX/WIPRO TECH

Label. Label is used to name a subroutine, user-written function, or a error trap, or target of a
transfer of control instruction. A label must be the first thing on the line and end with a colon.
COMPUTE: SUBROUTINE1: ERROR: HERE:

Function. A function is a built-in capability of REXX that performs arithmetic or a character


string operation on data that is passed to it.
SAY LENGTH(HOW ARE YOU) SAY LEFT(ABCDEF,3)

REXX/WIPRO TECH

EXECUTING A REXX EXEC.


IBM will prefer you to put your REXX programs in libraries whose names end in EXEC and are connected to TSO using an ALLOCATE command that specifies the name of the library and the DDNAME SYSEXEC. This will increase the performance , TSO will search SYSEXEC before SYSPROC. REXX can be executed in long and short ways. Long way is called explicit execution. Short way is called implicit execution. Long way does not require an ALLOCATE command. Program may be contained in a Library or may be a sequential dataset. Executing REXX in this way requires keyword EXEC twice.
Explicit Method of Executing REXX Programs. /* Executing REXX in a sequential data set , no parameters */ EXEC MYREXX.EXEC EXEC /* Executing REXX in a library , no parameters */ EXEC REXXPRGS.EXEC(REXX1) EXEC /* Executing REXX in a sequential data set, Two parameters */ EXEC MYREXX.EXEC parameter1 parameter2 EXEC Executing REXX in a library , Two parameters */ EXEC REXXPRGS.EXEC(REXX1) parameter1 parameter2 REXX/WIPRO TECH EXEC

TALKING TO THE ENVIRONMENT.


Talking to the environment is talking to TSO or the ISPF editor. Commands that talk to TSO,ISPF will be found in REXX programs. REXX doesnt recognizes them and passes to the environment. Environment executes (or tries) the command and send a RC back to REXX. The default environment is TSO, this applies no matter from where you are executing the program. You can change the default environment temporarily by telling REXX which environment to send them to. Use ADDRESS command to change the environment.

Making all commands work by temporarily changing the environment.


DELETE MYDAT.DATA ADDRESS ISPEXEC DISPLAY PANEL (PANL123) VGET VAR1 SHARED /* for TSO */

/* for ISPF /* for ISPF

*/ */

ADDRESS ISREDIT (SAVESTAT) = USER_STATE /* for ISPF editor CHANGE ALL B N /* for ISPF editor

*/ */

REXX/WIPRO TECH

10

If most of your commands are for the same environment , but one command in particular is meant for a different environment, you can use the following way this will not change the default environment.
ADDRESS ISPEXEC DISPLAY PANEL(PAN123) /* for ISPF */

The word for ADDRESS is taken as a literal, even if no quotes or apostrophes are used. If you want to use a variable here, use the keyword VALUE or put the variable in parentheses as shown below.
Environment = ISPEXEC ADDRESS VALUE Environment ADDRESS (Environment) /* Put ISPEXEC in var */ /* use var in command */ /* use var in command */

IS AN ENVIRONMENT AVAILABLE ?
Before passing a command to an environment, you can find out if that environment is available. TSO sub command SUBCOM asks TSO is the desired subcommand environment is available, if available TSO will return a RC of 0.
SUBCOM ISPEXEC IF RC = 0 THEN DO ADDRESS ISPEXEC DISPLAY PANEL(PANEL1) END REXX/WIPRO TECH 11

SESSION TWO
ESSENTIAL VERBS
I/O instruction (Parse External, Say) Concatenation of strings with & without spaces. String manipulation. Arithmetic Operation(Binary, Unary). Boolean Operators.

REXX/WIPRO TECH 12

I/O INSTRUCTIONS
Parse : Upper : Origins : Template : This is the instruction This is optional, specified data will be converted to upper case. arg, pull, external, var, value, source, version. Tells REXX hoe to split up the data and put the variables in the template.

In session 2 we will see only PARSE EXTERNAL, Remaining we will cover down the line.

PARSE EXTERNAL
Parse external will take information from the terminal not from the stack Parse external is equivalent to Accept in COBOL. Use it when you dont to access STACK. Eg: Parse upper external name It expects the user to type the name in the terminal and since upper is specified the input will change to upper case REXX/WIPRO TECH 13

SAY....
Syntax: SAY STRING OR VARIABLE

It displays a line on the terminal, consisting of string or variable It is equivalent to DISPLAY command in COBOL. When literal is used use double quotes .
say hello welcome to rexx hello welcome to rexx will be displayed in the terminal. 2. A=23 say A The value of 23 will be displayed in the terminal. Say enter your name parse upper external name say thank you, name say for entering your name Eg:1. REXX/WIPRO TECH 14

3.

CONCATENATION OF STRINGS WITH & WITHOUT SPACES


Concatenating without spaces
Two dissimilar items happen to be next to each other, they will be concatenated without spaces. REXX will separate two different items either by quotation marks OR Concatenation operator || . The more positive way to join two items is with the concatenation operator ||.

EG:

1.

Name = giri SAY hai Name


The result will be haigiri

2.

SAY hai || The result will be haigiri

giri

REXX/WIPRO TECH

15

CONCATENATING WITH ONE SPACE


Concatenating with one space

If two items next to each other with one or more spaces between them, one space remain. One or more spaces become one space. giri

Eg: SAY hai

The result will be hai giri

REXX/WIPRO TECH

16

STRING MANIPULATION
The topic to be covered (except Parse External)

Abbreviations of Parse Function of Parsing. Parsing Argument in a main program. Parsing Argument in a function or subroutine. Parsing from the stack and terminal. Parsing a variable. Parsing a literal;value.

REXX/WIPRO TECH

17

ABBREVIATIONS & FUNCTION OF PARSE


Abbreviations of Parse.

REXX allows the users to abbreviate instructions like Parse upper arg to simply arg. Similarly users can say simply PULL instead of Parse upper Pull

Functions of Parsing

Parse takes data from the origin it may be command line, TSO stack, Terminal, variable, literal. Passes the data to template. Distributes the data to the variables. When Parse instructions is executed all the variables are changed even variables receives NULL
REXX/WIPRO TECH 18

PARSING ARGUMENTS IN A MAIN PROGRAM


The main program is executed from option 6 from ISPF, Native TSO and command line in ISPF. Parse upper arg receives anything typed next to REXX program when you execute. Information is passed to the variables that you specify on the Parse upper arg.

==> TSO Exec MYPROGRAM hello welcome to rexx /* rexx program*/

Parse upper arg A B C D SAY B C D A /*Displays welcome to rexx hello */ Parse upper arg may be abbreviated as ARG . The above example may be use arg instead of parse upper arg.
REXX/WIPRO TECH 19

PARSING ARGUMENT IN A FUNCTION OR SUBROUTINE

Parse Arg or Arg instruction is also used in a user-written function or subroutine. The main difference is that you may use COMMAS between variables.
/* rexx program CALL MYPROGRAM 1, 2 SAY RESULT EXIT MYPROGRAM: PARSE ARG A , B RETURN A + B */

REXX/WIPRO TECH

20

PARSING FROM THE STACK & TERMINAL


Normally there is nothing in the stack, so this instruction is to get information from the terminal. If there is nothing in the stack, parse upper pull receive any information from terminal.
Terminal GIRIDHAR

Say enter name PULL NAME

STACK

Say please enter your name pull name say thank you, name say for entering your name
REXX/WIPRO TECH 21

PARSING A VARIABLE, LITERAL:VALUE


Parsing a variable

A Variable may contain string of characters consisting of any number of words, spaces etc.., By parsing a variable user can split up its contents into one or more other variables.
Name = Giridhar G babu PARSE VAR NAME FIRST MIDDLE LAST SAY YOUR LAST NAME IS LAST.

Parsing a literal:value

Parse value with a literal and function. REXX needs keyword WITH so it can tell where the template begin. Eg., Parse value this is a sample with a b c d Parse value date( ) with day month year This eg., uses built-in function date to get the date.
REXX/WIPRO TECH 22

ARITHMETIC OPERATORS (BINARY & UNARY)


OPERATORS
REXX operators are like those in most other languages. Possible exception are % for integer division, // for remainder of a division. In REXX user must use operators, not words. Eg., +, _, *, /, %(integer divide), //(remainder of division), **, -, ( ). SAY 5//2 ----> 1 SAY 5%2----> 2

BOOLEAN OPERATORS

Boolean operators allow you to do more than one comparison. REXX uses Boolean Operators like AND, OR, EXCLUSIVE OR. Use only symbols not words.
REXX/WIPRO TECH

contd in next slide...

23

Contd from previous slide....


&
| &&

AND.
OR; either one or both. Exclusive OR; one is true, not both.

Eg., 1.

if today =Monday | today = Tuesday THEN SAY holiday. 2. If Employee_a = engineer &&, Employee_b = engineer with computer knowledge THEN SAY youre employed ELSE SAY Over qualified 3. If <cond1> && <cond2> THEN SAY one condition is true Else Say both condition are true or false
REXX/WIPRO TECH

24

SESSION THREE
PROGRAMMING TECHNIQUES
IF CONDITION SELECT CASE STRUCTURE

LOOPING (DIFFERENT DO LOOPS)


REXX/WIPRO TECH 25

IF CONDITION....
Topics to be covered
IF Syntax Key points to remember Using NOP More than one instruction
REXX/WIPRO TECH 26

IF Syntax....
1. IF THEN IF comparison THEN one-instruction ELSE one-instruction IF comparison THEN instruction; ELSE instruction. English words such as EQUAL, AND, OR are not allowed THEN is required THEN is followed by one instruction or by a DO ... END sequence NOP may be used as a do nothing instruction ELSE is not required. If coded, it is followed by one instruction or by a DO...END sequence IF THEN ELSE should be on separate lines comparison one-instruction 2.

3.

Points to remember about conditionals with IF :

HOW EQUAL IS EQUAL ?


Equal to : With numbers = means numerically equivalent. ( .01 & 000.010 are numerically equivalent) With character strings, = considers leading and trailing spaces as equivalent. (apples & apples are equal) = = Strictly Equal to : This means equal in all aspects . So .01 & 00.010 are not the same. =
REXX/WIPRO TECH 27

Using NOP
Sometimes you dont want to do anything at all when a condition is true, but want to do something when a condition is false. In that case, you can use the verb NOP. Using NOP after ELSE is not useful, except in a nested IF to ensure that every IF has its own ELSE.

IF A = 2 THEN NOP ELSE SAY NO

IF A = 2 THEN NOP; ELSE SAY NO


IF A < 3 THEN SAY LESS THAN 3 ELSE NOP

REXX/WIPRO TECH

28

More than one instruction.....


Often we need to execute more than one instruction after the THEN or the ELSE. In that case we need to use the DO ...... END sequence. Every DO must have its END. Proper care should be taken to do the IF THEN ELSE ; DO END indentation for the program to remain readable.
A=5 B=5 IF A = B THEN DO SAY A is equal to B A=B-1 SAY but now it isnt END ELSE DO SAY A is not equal to B SAY how could that be? END
REXX/WIPRO TECH 29

SELECT CASE STRUCTURE...


SELECT is REXXs implementation of the structured programming construct CASE. It tests a series of conditions, one after the other, and as soon as it finds a true condition, it executes the instruction associated with it and exits from the structure. If none of the conditions are true, the OTHERWISE instruction is executed. The example given below shows SELECT in its simplest form. The following points can be noted : SELECT, WHEN, OTHERWISE, and END are separate REXX instructions and placed on separate lines. Each WHEN introduces a comparison that will be tested. As many WHENs as required may be coded. Each WHEN must have its THEN. Each THEN may have only one instruction (just like IF) The final END is required and OTHERWISE is optional. SELECT WHEN DEPTNO = 1 THEN SAY MARKETING WHEN DEPTNO = 2 THEN SAY R & D WHEN DEPTNO = 3 THEN SAY ACCOUNTS WHEN DEPTNO = 4 THEN SAY HRD OTHERWISE SAY UNKNOWN DEPTNO REXX/WIPRO TECH END

30

SELECT with several instructions and NOP


This example shows that allows you to execute more that one instruction after a WHEN that comes true. The following points are to be noted : The instructions are bounded by a DO and END. NOP means that no instruction is to be executed.
SELECT WHEN DAY = 1 THEN DO SAY HAPPY SAY MONDAY END WHEN DAY = 5 THEN DO SAY HAPPY SAY WEEKEND END OTHERWISE NOP END
REXX/WIPRO TECH 31

LOOPING (Different DO Loops....)


The DO control structure always begins with a DO and ends with an END. Between the DO and END will be found the instructions that are to be executed repeatedly.

THE GENERAL FORM OF THE DO AND END

modifiers
DO

modifiers
WHILE UNTIL

instruction instruction END

variable =
FOREVER FOR

number
REXX/WIPRO TECH 32

THE DO WHILE
WHILE continues the loop as long as something is true. It checks before doing the loop the first time and may not execute it even once.
The DO WHILE DO WHILE something is true instructions END An example of DO WHILE DO WHILE TIME ( ) <17:01:00 SAY WORK END

THE DO UNTIL
UNTIL loops up to the moment when something becomes true. It checks at the END, but doesnt check before the first time. It will normally do the loop at least once.

EXAMPLE OF DO UNTIL DO UNTIL TIME > 17:00:00 SAY WORK END REXX/WIPRO TECH

33

STEPPING THROUGH A VARIABLE


In the DO loop we can step through a variable, up to a limit. This puts a 1 into I, and adds 1 to I everytime it goes through the loop. When I is more than the condition specified, the loop stops.
DO I = 1 TO 10 SAY NUMBER OF TIMES THRU LOOP I END

As shown in the next example you can also step through a variable without a limit. You will have to stop the loop with LEAVE.
DO I = 1 SAY I IF I > 1000 THEN LEAVE END

If you ask REXX to do something impossible, it will just ignore and not do the loop even once.

DO I = 1 TO 10 BY -2 SAY YOU WONT SEE THIS END REXX/WIPRO TECH 34

LOOPING FOREVER
You can loop forever without any limit at all with FOREVER. However, you do have to get out sometime, and so will have to use LEAVE . Do not use SIGNAL to do this.As shown in example LEAVE sends control after the END.
DO FOREVER IF TIME ( ) > 12:01:00 THEN LEAVE SAY IS IT LUNCH YET? END

LOOPING A FIXED NUMBER OF TIMES


FOR provides a way to limit the number of times a loop will be stepped through. If you have a FOR, the loop will be executed that many times, unless another limiting condition comes true first.
DO I = 1000 TO 2000 BY .5 FOR 50 ...... END

Specifying a constant provides another way to loop a fixed number of times.


DO 10 ...... END REXX/WIPRO TECH 35

LOOPING DEPENDING ON A VARIABLE


Looping can be done based on the value in a variable - that is, as many times as the number in the variable.
SAY HOW MANY TIMES TO LOOP? PULL HOW_MANY DO HOW_MANY ....... END

SKIPPING BACK TO THE BEGINNING


You may want to skip back to the beginning of the loop. ITERATE says never mind the rest of the loop, skips the rest, and goes back to the DO for another pass around the loop.

DO I = 1 TO 10 IF I = 1 THEN ITERATE SAY I END

use of ITERATION continued in next slide...


REXX/WIPRO TECH 36

USAGE AND EXAMPLES OF ITERATE....


DO I = 1 TO 6 IF I = 3 THEN ITERATE SAY I IS I END /* the output is I IS 1 I IS 2 I IS 4 I IS 5 I IS 6

*/

ITERATE goes back to the beginning of the repetitive loop it is in. In the next example, control goes back to the DO I even though the ITERATE is a nonrepetitive DO END sequence.
DO I = 1 TO 4 IF I = 3 THEN DO SAY GOING TO ITERATE ITERATE SAY I END END I /* the output is 1 2 GOING TO ITERATE 4 REXX/WIPRO TECH

*/

37

USAGE AND EXAMPLES OF ITERATE...


If you are in a nested loop and you ITERATE, you go to the beginning of the inner loop, as seen here.
DO I = 1 TO 2 SAY IN I I DO J = 1 TO 3 IF J = 2 THEN ITERATE SAY IN J J END J END I /*the output is IN I 1 IN J 1 IN J 3 IN I 2 IN J 1 IN J 3

If you are in a nested loop, you can specify the control variable of the inner loop or outer loop. You will skip back to the beginning of whichever one you specify.
REXX/WIPRO TECH 38

STYLES IN LOOPING....
Where possible end a loop with the same variable you began it with.
DO I = 6 ..... END I

Use comments to match DOs and ENDs. Make the main line of your program a DO loop. If you need to exit from a loop, use LEAVE.
DO 1000 /* instructions */ IF condition THEN LEAVE END /* 1000 */

Nest loops if you wish, but not more than three levels
DO I = 1 TO 6 DO J = 1 TO 5 DO K = 1 TO 7 SAY I J K END K END J END I

Dont change the loop control variable. REXX/WIPRO TECH

39

SESSION FOUR
DATA HANDLING
STACK & QUEUE LIFO & FIFO COMPOUND VARIABLE INTERPRET INSTRUCTION PRECISION
REXX/WIPRO TECH 40

TSO STACK
STACK:
Stack is Temporary buffer like storage area managed by TSO. It is created at the moment you start running any REXX program and is available to any other REXX program you may call or execute from within your program. Note: It is not applicable to CLIST or COBOL programs. It can be used by TSO command that prompt for it. (Explained in macro session).

PUTTING INTO THE STACK:


The instruction that are used to put data into the stack. Queue (FIFO) Push(LIFO)

REXX/WIPRO TECH

41

FETCHING FROM THE STACK:


Instructions that are used to fetch data from the stack.

Pull

DESCRIPTION OF STACK:
TSO stack has two parts: Terminal buffer. Program buffer.

Terminal

Terminal buffer

Program stack

REXX/WIPRO TECH

42

LIFO (Last in first out)


LIFO has got only one end open and one end closed, so data can enter into the stack and come out of stack through only one way, if we put 5 data items data1, data2, data3. Into the stack, the last data item which entered the stack( data 5) will be the first to come out, and first data item(data1) which entered the stack will be the last to come out.

ENTERING
DATA 5 DATA 4

COMING OUT

DATA 3
DATA 2 DATA 1

STACK

REXX/WIPRO TECH

43

FIFO (First In First Out)


FIFO has got two end open so data entered into the stack first will come out first and data entered last will come last for eg., if we put 5 data items into the stack data1, data2 data1 will come out first and data5 will come out last.

ENTERING
DATA 5

DATA 4
DATA 3 DATA 2 DATA 1

COMING OUT

REXX/WIPRO TECH

44

Creating a New stack


If you wish to create a new stack, it can be done by using NEWSTACK command. The old stack will be kept protected. After the new stack command whatever references to the stack thereafter made, only new stack will be referred.

Isolating a stack
The stack create through new stack command can be deleted using DELSTACK command. So that data that was present in the new stack will also be deleted after the deletion of the old stack

REXX/WIPRO TECH

45

FUNCTIONS AND COMMANDS USED WITH STACK


QSTACK
QSTACK is used to find how many stacks have been created using Newstack. The reserved word RC will have the result(number of stacks). Always RC will be having the count of all the stacks( I.e. includes the old stack). To have the account of new stack that was created through NEWSTACK command decrement with one.

QUEUED( )
It is a function used to return number of elements in the stack.
REXX/WIPRO TECH 46

COMPOUND VARIABLE
Compound variable is a two part variable with parts separated by a period. Temperature.A is a compound variable. The left part before the period is the stem(which is the variable) and the right part after the period is a extension(which is a variable) First REXX checks the extension whether it is a variable if it is REXX treats the combination as a variable else it treats it as a single variable.

What are compound variables used for?


Compound variables are used to group related variables. In EXECIO command we can get the value using stem.

REXX/WIPRO TECH

47

STEPPING THROUGH THE EXTENSION


If you use numbers in your extensions, you can easily vary the extensions with a do loop. The example below explain how to step through the extension A.
Weekday.1 = mon Weekday.2 = tue . Weekday.7 = sun Do A = 1 to 7 say weekday.A End

Using two or more extension


You may use more than one extension with compound variables, this is Multidimensional Array.
REXX/WIPRO TECH 48

INTERPRET INSTRUCTION
Interpret makes REXX to process an Expression as an Instruction. Eg., A = say hello Interpret A ( If A is a valid REXX instruction, it is executed. ) HELLO ( This is displayed)

REXX/WIPRO TECH

49

PRECISION
REXX will normally carry out arithmetic with default precision of 9. If you give more than 9 digits, it will have to do some rounding. Eg., 1234567809 Actual number 10 digits. 1234567810 Rounded number. Displayed 1.23456781E+9

Changing the precision.


You can change the default precision 9 to any no of digits. Eg., Numeric digits 5 So any number after this instruction, which is having more than 5 digits will be rounded.
REXX/WIPRO TECH 50

SESSION FIVE
ADVANCE CONCEPTS
FUNCTIONS SUBROUTINES PASSING INFORMATION THROUGH A VARIABLE USING PROCEDURE INSTRUCTION EXAMPLES
REXX/WIPRO TECH 51

What are subroutines and Functions ?


Subroutines and functions are routines made up of sequence of instructions that can receive data, process that data, and return a value The routines can be

Internal :
The routine is with in the current exec, marked by a label and used only by the exec.

External : A program or exec in a member of a partitioned data set that can be


called by one or more execs. In order for an exec to call the routine, the exec and routine must be allocate to the system file, for example SYSEXEC or SYSPROC, or be in the same PDS. In many aspects, subroutines and functions are the same. Yet they are different in few major aspects, such as the way they are called and the way they return value.

REXX/WIPRO TECH

52

Calling a subroutine
To call a subroutine, use the CALL instruction followed by the subroutine name (label or exec member name) and optionally followed by up to 20 arguments separated by commas. The subroutine call is an entire instruction CALL subroutine_name arg1, arg2,...

Calling a Function
To call a function, use the function name (label or exec member name) immediately followed by parenthesis that can contain arguments. There can be no space between the function name and the parenthesis. The function call is a part of an instruction. Example : x = function(arg1,arg2,...)

REXX/WIPRO TECH

53

Returning a value from a subroutine


A subroutine does not have a return value, but when it does, it sends back the value with the RETURN instruction. RETURN value The calling exec receives the value in the REXX special variable named RESULT SAY The Answer is RESULT

Returning a value from a function


A function must return a value. When the function is a REXX exec, the value is returned with either RETURN or EXIT instruction. RETURN value The calling exec receives the value at the function call. The value replaces the function call, so that in the following example x = value x = function(arg1,arg2,...)

REXX/WIPRO TECH

54

When to write Subroutines Vs Functions


The actual instructions that make up a subroutine or a function can be identical. It is the way you want to use in an Exec that turns them into either a subroutine or a function

For example, the built in function SUBSTR can be called as either a function or a subroutine. As a function, you invoke it as follows to shorten a word to its first eight characters: x = SUBSTR(verylongWord,1,8) /* x is set to verylong*/
As a subroutine you would get the same results with the following instructions: CALL SUBSTR verylongWord,1,8 /* x is set to verylong*/ x = RESULT When deciding whether to write a subroutine or a function, ask yourself the following questions : Is a returned value optional ? If so, write a subroutine Do I need a value returned as an expression with in an instruction ? If so, write a REXX/WIPRO TECH 55 function.

Writing a Subroutine
A subroutine is a series of instructions that an exec invokes to perform a specific task. The instruction that invokes the subroutine is the CALL instruction. The CALL instruction may be used several times in an exec to invoke the same subroutine. When the subroutine ends, it can return control to the instruction that directly follows the subroutine call. The instruction that returns control is the RETURN instruction. instruction(s) CALL sub1 > instruction(s) EXIT sub1: < instruction(s) RETURN

REXX/WIPRO TECH

56

Subroutines may be internal and designated by a label, or external and designated by the dataset member name that contains the subroutine. The preceding example illustrates an internal subroutine named sub1. IMPORTANT NOTE Because internal subroutines generally appear after the main part of the exec, when you have an internal subroutine, it is important to end the main part of the exec with the EXIT instruction. The following illustrates an external subroutine named sub2.
>REXX.EXEC(MAIN) instruction(s) CALL sub2 instruction(s) . . REXX.EXEC(SUB2) < instruction(s) RETURN
REXX/WIPRO TECH 57

To determine whether to make a subroutine internal or external, you might consider factors such as : Size of the subroutine. Very large subroutines often are external, whereas small subroutines fit easily within the calling exec.

How you want to pass information. It is quicker to pass information through variables in an internal subroutine. Whether the subroutine might be of value to more than one exec or user. If so an external subroutine is preferable.

REXX/WIPRO TECH

58

Passing Information to a Subroutine


An internal subroutine can share variables with its caller. Therefore you can use commonly shared variables to pass information between caller and internal subroutine. You can also use arguments to pass information to and from an internal subroutine.External subroutines, however, cannot share the same variables, and information must pass between them through arguments or some other external way, such as the data stack.

REXX/WIPRO TECH

59

When an exec and its internal subroutine share the same variables, the value of a variable is what was last assigned, regardless of whether the assignment was in the main part of the exec or in the subroutine. In the following Example, the value of answer is assigned in the subroutine and displayed in the main part of the exec. The variables number1, number2 and answer are shared. /***** REXX *****/ number1 = 5 number2 = 10 CALL subroutine SAY answer /* Displays 15 ***/ EXIT subroutine: answer = number1 + number2 REXX/WIPRO TECH RETURN

60

Example of a Problem Caused by Passing Information in a variable


/**************REXX************************************************************/ /* Note : This exec contains an error */ /* It uses a DO loop to call an internal subroutine and the subroutine also uses a DO loop with the */ /* same control variable as the main exec. The DO loop in the main exec repeats only once. */ number1 = 5 number2 = 10 DO I = 1 to 5 CALL subroutine SAY answer /* Displays 105 */ END EXIT subroutine : Do I = 1 to 5 answer = number1 + number2 number1 = number2 number2 = answer END REXX/WIPRO TECH RETURN

61

USING PROCEDURE INSTRUCTION


To avoid this kind of problem in an internal subroutine, you can use the PROCEDURE instruction protecting variables with the PROCEDURE instruction. When you use the PROCEDURE instruction immediately after the subroutine label, all variables used in the subroutine become local to the subroutine and are shielded from the main part of exec. You can also use the PROCEDURE EXPOSE instruction to protect all but a few special variables.
Example Using the PROCEDURE instruction /**** REXX ***/ /* This exec uses a PROCEDURE instruction to protect the variables within its subroutine*/

number1 = 10 CALL subroutine SAY number1 number2 EXIT /* Displays 10 number2 subroutine: PROCEDURE number1 = 7 number2 = 5 RETURN

REXX/WIPRO TECH

62

Subroutine Without the PROCEDURE Instruction


/**********REXX**********/ /* This exec does not use a PROCEDURE instruction to protect the variables within its subroutine */ /****************************************/ number1 = 10 CALL subroutine SAY number1 number2 EXIT /* Displays 7 5 */ subroutine: number1 = 7 number2 = 5 RETURN
REXX/WIPRO TECH 63

USING PROCEDURE EXPOSE


Exposing Variables with PROCEDURE EXPOSE : To protect all but specific variables, Use the EXPOSE option with the PROCEDURE instruction, followed by the variables that are to remain exposed to the subroutine. Example Using PROCEDURE EXPOSE

/***********REXX************************************************/ /* This exec uses a PROCEDURE instruction with the EXPOSE option to */ /*expose one variable, number1 in its subroutine. The other variable, number2, */ /*is set to null and displays its name in uppercase */ /****************************************************************/ number1 = 10 CALL subroutine SAY number1 number2 EXIT /* Displays 7 number2 subroutine: PROCEDURE EXPOSE number1 number1 = 7 number2 = 5 RETURN REXX/WIPRO TECH 64

SESSION SIX
ADVANCE CONCEPTS
PASSING INFORMATION BY USING ARGUMENTS USING THE ARG BUILT-IN FUNCTION WRITING A FUNCTION PASSING INFORMATION TO A FUNCTION EXAMPLES
REXX/WIPRO TECH 65

Passing information by using Arguments


A way to pass information to either internal or external subroutines is through arguments. You can pass up to 20 arguments separated by commas on the CALL instruction as follows : CALL subroutine_name arg1, arg2, ....

Using ARG instruction :


The Subroutine can receive the arguments with the ARG instruction. Arguments are also separated by commas on the CALL instruction as follows: ARG argt1,argt2,.... The names of the arguments on the CALL and the ARG instructions do not have to be the same because information is not passed by argument name but by position. The first argument sent becomes the first argument received and so forth. You can also set up a template in the CALL instruction, which is then used in the corresponding ARG instruction.
REXX/WIPRO TECH 66

Example of Passing Arguments on the CALL Instruction


/***************************REXX***************************/ /* This exec receives as arguments the length and width of a rectangle */ /* rectangle and passes that information to an internal subroutine. The */ /* subroutine then calculates the perimeter of the rectangle. */ /***********************************************************/ PARSE ARG long wide CALL perimeter long, wide SAY The perimeter is RESULT inches. EXIT perimeter: ARG length, width perim = 2 * length + 2 * width RETURN perim

Notice the positional relationships between long and length, and wide and width. Also notice how information is received from variableTECH in the special variable RESULT. REXX/WIPRO perim 67

Using the ARG Built-in Function


Another way for a subroutine to receive arguments is with the ARG built-in function. This function returns the value of a particular argument specified by a number that represents the argument position. For instance, in the previous example, instead of the ARG instruction, ARG length, width you can use the ARG function as follows: length = ARG(1) width = ARG(2) /* puts the first argument into length */ /* puts the second argument into width */

REXX/WIPRO TECH

68

Receiving Information from a Subroutine


Although a subroutine can receive up to 20 arguments, it can specify only one expression on the return instruction. That expression can be a : Number RETURN 55 One or more variables whose values are substituted or when no values where assigned, return their names RETURN value1 value2 value3 Literal string RETURN Work Complete. Arithmetic, comparison, or logical expression whose value is substituted. RETURN 5 * number
REXX/WIPRO TECH 69

Example -Writing an Internal and External Subroutine


Write an exec that plays a simulated coin toss game of heads or tails between the computer and a user and displays the accumulated scores. Start off with the message, This is a game of chance. Type heads, tails, or quit and press ENTER. This means that there are four possible inputs: HEADS TAILS QUIT None of these three (invalid response) Write an internal subroutine without arguments to check for valid input. Send valid input to an external subroutine that compares the valid input with a random outcome. Use the RANDOM build-in functions as RANDOM(0,1), and equate HEADS = 0, TAILS = 1. Return the result to the main program where results are tallied and displayed.

Good Luck!
REXX/WIPRO TECH 70

Possible Solution (Main Exec)


/*******************************REXX*********************************/ /* This exec plays a simulated coin toss game between the computer and a user. The */ /* user enters heads, tails, or quit. The user is first checked for validity in an internal */ /* subroutine. An external subroutine uses the RANDOM build-in function to obtain */ /* a simulation of a throw of dice and compares the user input to the random outcome */ /* The main exec receives notification of who won the round. Scores are maintained */ /* and displayed after each round. */ /**********************************************************************/ SAY This is a game of chance. Type heads, tails, or quit and press ENTER PULL response computer = 0 ; user = 0 /* initialize scores to zero */ CALL check /* call internal subroutine, check */ DO FOREVER CALL throw response /* call internal subroutine, throw */

contd in next slide......


REXX/WIPRO TECH 71

contd from previous slide......

IF RESULT = machine THEN computer = computer + 1 ELSE user = user + 1

/* the computer won */ /* increase the computer score */ /* the user won */ /* increase the user score */

SAY Computer score = computer Your score = user SAY Heads, Tails, or quit? PULL response CALL check /* call internal subroutine, check */ END EXIT

REXX/WIPRO TECH

72

Possible Solution (Internal Subroutine named CHECK)


CHECK:
/*******************************REXX*********************************/ /* This internal subroutine checks for valid input of HEADS , TAILS or /* QUIT. If the user entered anything else, the subroutine tells the user that it is /* an invalid response and ask the user to try again. The subroutine keeps repeating /* until the user enters valid input. Information is returned to the main exec through /* commonly used variables . */ /**********************************************************************/ DO UNTIL outcome = correct SELECT WHEN response = HEADS THEN outcome = correct WHEN response = TAILS THEN outcome = correct

*/ */ */ */

contd in next slide......


REXX/WIPRO TECH 73

contd from previous slide......


WHEN response = TAILS THEN EXIT OTHERWISE outcome = incorrect SAY That is not a valid response. Try again! SAY Heads, tails, or quit? PULL response END END RETURN Possible Solution (External Subroutine named THROW) /*******************************REXX*********************************/ /* This external subroutine receives the valid input from the user, analyzes it, gets a */ /* random throw from the computer and compares the two values. If they are the */

contd in next slide......


REXX/WIPRO TECH 74

contd from previous slide......


/*
same, the user wins. If they are different, the computer wins. The outcome

is

*/

/* then returned to the calling exec. */ /**************************************************************************/ ARG input IF input = HEADS THEN userthrow = 0 ELSE userthrow = 1 compthrow = RANDOM(0,1)

/* /*

heads = 0 tails = 1

*/ */

/* choose a random number between 0 and 1 */

IF compthrow = userthrow THEN outcome = human ELSE outcome = machine RETURN outcome

/* user choose correctly */ /* user didnt choose correctly */


75

REXX/WIPRO TECH

Writing a Function
A function is a series of instructions that an exec invokes to perform a specific task and return a value. A function can be built-in or user-written. An exec invokes a user-written function the same way it invokes a built-in function -- by the function name immediately followed by parentheses with no blanks in between. The parentheses can contain up to 20 arguments or no arguments at all. function(argument1, argument2) or function() A function requires a returned value because the function call generally appears in an expression. X = function(arguments1,arguments2.....) When the function ends, it may use the RETURN instruction to send back a value to replace the function call. contd in next slide......
REXX/WIPRO TECH 76

contd from previous slide......


Instruction(s) x = func1(arg1,arg2) instruction(s) EXIT Func1: instruction(s) RETURN value Functions may be internal and designated by a label, or external and designated by the data set member name that contains the function. IMPORTANT NOTE Because internal functions generally appear after the main part of the exec, when you have an internal function, it is important to end the main part of the exec with the EXIT instruction.
REXX/WIPRO TECH 77

The following illustrates an external function named func2

REXX.EXEC(MAIN)
instruction(s) x=func2(arg1) instruction(s) . . . exit

REXX.EXEC(FUNC2)
ARG var1 instruction(s) RETURN value

REXX/WIPRO TECH

78

To determine whether to make a function internal or external, you might consider factors, such as:
Size of the function.: Very large functions often are external, whereas small functions fit easily within the calling exec.
How you want to pass information. It is quicker to pass information through variables in an internal function. Whether the function might be of value to more than one exec or user. If so, an external function is preferable. Performance. The language processor searches for an internal function before it searches for an external function.

REXX/WIPRO TECH

79

Passing Information to a Function


When an exec and its internal function share the same variables, you can use commonly shared variables to pass information between caller and internal function. The function does not need to pass arguments within the parentheses that follow the function call. However all functions, both internal and external must return a value.

Passing Information by Using Variables


When an exec and internal function share the same variables, the value of a variable is what was last assigned, regardless of whether the assignment was in main part of the exec or in the function.In the following example, the value of answer is assigned in the function and displayed in the main part of the exec. The variables number1, number2 and answer are shared. In addition the value of answer replaces the function call because answer follows the RETURN instruction.

REXX/WIPRO TECH

80

SESSION SEVEN
FILES
TOPICS COVERED
FILE HANDLING

WHAT THE PARTICIPANTS WILL BE ABLE TO DO AFTER THE COMPLETION OF THIS SESSION WILL BE ABLE TO READ AND WRITE INTO DISK FILE USING REXX EXECS.

REXX/WIPRO TECH

81

KEY POINTS....

ALLOCATING A FILE WHERE DO YOU READ FROM AND WRITE INTO WHERE DO YOU READ INTO AND WRITE FROM

REXX/WIPRO TECH

82

ALLOCATING A FILE
TSO ALLOCATE COMMAND IS REQUIRED WITHIN THE REXX EXEC TO SPECIFY THE DDNAME FOR THE DATASET THAT IS GOING TO BE USED IN THE FILE OPERATION. ALLOCATE DSN(DATASETNAME) DDN(DDNAME) DISP

DATASET NAME : THE DATASET WHICH CONTAINS THE DATA OR WHERE THE DATA IS TO BE INSERTED
DDNAME : THE LOGICAL NAME TO BE USED IN THE FILE I/O COMMAND : IT CAN HAVE ONE OF THE FOLLOWING CHOICES
NEW (IF THE DATASET IS NEW) OLD (IF THE DATASET IS EXISTING) REXX/WIPRO TECH MOD(IF THE RECORDS ARE TO BE APPENDED)

DISP

83

WHERE DO YOU READ FROM AND WRITE INTO & READ INTO AND WRITE FROM

WE CAN READ FROM AND WRITE INTO A PDS (PARTIONED DATASET) OR PS (PHYSICAL SEQUENTIAL)

WE CAN READ INTO AND WRITE FROM A STACK OR AN ARRAY (COMPOUND VARIABLE)

REXX/WIPRO TECH

84

FILE OPERATION COMMANDS


EXECIO IS THE COMMAND USED FOR DOING THE FILE OPERATION EXECIO IS A TSO COMMAND AND NOT A REXX INSTRUCTION

NOTE: ALTHOUGH IT IS A TSO COMMAND IT CAN BE USED ONLY IN A REXX EXEC (THIS MEANS IT CANNOT BE USED IN THE TSO NATIVE MODE OR AS COMMAND LINE COMMAND OR IN THE READY MODE).
REXX/WIPRO TECH 85

GENERAL FORM OF THE EXECIO COMMAND


ALLOCATE DSN(DATASETNAME) DDN(DDNAME) DISP EXECIO < HOW- MANY> <OPERATION> <DDNAME> < SEQ> <(OPTIONS) > HOW-MANY : THE NO OF RECORDS THAT ARE TO READ OR WRITTEN (THE * IN THIS PLACE MAY BE USED TO READ THE WHOLE FILE NOTE : CANNOT BE USED FOR WRITING )

OPERATION ANY OF

: OPERATIONS TO BE PERFORMED IT CAN HAVE THE CHOICES LISTED BELOW DISKR : READ ONLY DISKW : WRITE ONLY DISKRU: READ FOR UPDATE REXX/WIPRO TECH 86

EXECIO COMMAND Contd...

DDNAME

: STANDS FOR THE DDNAME YOU HAVE USED IN THE ALLOCATE COMMAND

SEQ

: SEQUENCE NUMBER STAND FOR THE DESIRED RECORD


( NOTE: THIS IS GENERALLY OMITTED IT ALLOWS YOU TO SKIP RECORDS FORWARD IT DOES NOT ALLOW TO SKIP RECORDS BACKWARD YOU CANNOT USE IT IN A WRITE)

REXX/WIPRO TECH

87

READING RECORDS FROM A FILE


SAMPLE PROGRAM FOR READING INTO A STACK

/************** REXX **********/ ALLOCATE DSN(T13066.REXX.TEST) DDN(INFILE) OLD /* THE DATASET T130066.REXX.TEST IS ALLOCATED TO DDNAME INFILE */ EXECIO * DISKR INFILE (FINIS) /* ALL RECORDS IN THE FILE ARE READ AND PUT INTO STACK */ DO QUEUED() /* QUEUED WILL GIVE THE NO OF RECORDS IN THE STACK */ PULL REC /* FETCHES THE RECORD FROM THE STACK SAY REC /* DISPLAYS THE RECORD ON TO THE SCREEN */ END FREE DDN(INFILE) REXX/WIPRO TECH 88

READING RECORDS FROM A FILE


SAMPLE PROGRAM FOR READING INTO AN ARRAY

/**************REXX***********/ ALLOCATE DSN(T13066.REXX.TEST) DDN(INFILE) OLD /* THE DATASET T130066.REXX.TEST IS ALLOCATED TO DDNAME INFILE */ EXECIO * DISKR INFILE (STEM REC.FINIS) /* ALL RECORDS IN THE FILE ARE READ AND PUT INTO AN ARRAY */ C = A.0 /* A.0 WILL HAVE THE NO OF ELEMENTS IN THE ARRAY */ DO I = 1 TO C SAY A.I END FREE DDN(INFILE) /* AFTER THE FILE OPERARTIONS ARE OVER THE DDNAME IS FREED */ REXX/WIPRO TECH

89

READING ONE RECORD AT A TIME


SAMPLE PROGRAM FOR READING ONE RECORD AT A TIME
/************REXX***********/ ALLOCATE DSN(T13066.REXX.TEST) DDN(INFILE) OLD /* THE DATASET T130066.REXX.TEST IS ALLOCATED TO DDNAME INFILE */ CONTINUE = YES /* INITIALIZING THE VARIABLE CONTINUE TO BE USED */ /* AS A COUNTER IN THE DO LOOP */ CALL READIT /* ISSUING A CALL TO SUBROUTINE READIT */ DO WHILE CONTINUE = YES PULL REC /* FETCHES THE RECORD FROM THE STACK */ SAY REC /* DISPLAYS THE RECORD ON TO THE SCREEN */ CALL READIT /* ISSUING A CALL TO SUBROUTINE READIT TO FETCH */ /* THE NEXT RECORD */ END REXX/WIPRO TECH

this program continues in next slide...

90

PROGRAM from previous slide...


SAMPLE PROGRAM FOR READING ONE RECORD AT A TIME contd from previous slide....
EXECIO 0 DISKR INFILE (FINIS) /* DUMMY READ IS PERFORMED TO CLOSE THE FILE */ EXIT READIT: EXECIO 1 DISKR INFILE /* READS ONLY ONE RECORD AT A TIME */ IF RC = 2 THEN /* RC = 2 GIVES THE EOF STATUS */ CONTINUE = NO /* REINITIALIZING THE VARIABLE CONTINUE TO NO */ ELSE NOP /* NO OPERATION */ RETURN /* PASSES CONTROL BACK TO CALLED PROGRAM TO THE INSTRUCTION NEXT REXX/WIPROINSTRUCTION */ TO CALLED TECH

91

WRITING MULTIPLE RECORD AT A TIME

Sample Program
/* REXX */ ALLOCATE DSN(T13066.IU46.REXX) DDN(INFILE) /* DATASET ALLOCATED TO INFILE */ DO FOREVER /* GATHERING RECORDS AND PUTTING INTO QUEUE */ PULL A QUEUE A END EXECIO QUEUED() DISKW INFILE (FINIS) /* WRITING MULTIPLE RECORDS INTO THE FILE */
REXX/WIPRO TECH 92

WRITING ONE RECORD AT A TIME

Sample Program
/* REXX */ ALLOCATE DSN(T13066.IU46.REXX) DDN(INFILE) /* DATASET ALLOCATED TO INFILE */ CONTINUE = YES DO WHILE CONTINUE = YES PULL REC PUSH REC /* PUSHING THE RECORD ONTO THE STACK */ SAY DO YOU WANT TO CONTINUE: YES/NO PULL CONTINUE EXECIO 1 DISKW INFILE /* WRITING ONE RECORD AT A TIME INTO THE FILE */ REXX/WIPRO TECH 93 END

UPDATING A RECORD
EXECIO CAN UPDATE A RECORD IN PLACE.
IT CAN READ A RECORD, ALLOW YOU TO CHANGE IT, AND THEN REWRITE IT. NOTE : YOU CANT JUMP RECORDS BACKWARDS IN A FILE YOU MAY SKIP RECORDS, BUT ONLY IF YOU GO FORWARD.
REXX/WIPRO TECH 94

UPDATING RECORD
Sample Program
/* REXX */ ALLOCATE DSN(T13066.INPUT.DATA) DDN(INFILE) OLD REUSE EOF = NO CALL READIT DO WHILE EOF =NO PULL REC /* HERE CHANGE RECORD */ PUSH REC CALL WRITEIT CALL READIT END EXECIO 0 DISKW INFILE (FINIS) FREE DDDN(INFILE) REXX/WIPRO TECH program continues in the next slide... 95

PROGRAM from previous slide...

READIT: EXECIO 1 DISKRU INFILE IF RC <> 0 THEN EOF = YES RETURN WRITEIT: EXECIO 1 DISKW INFILE RETURN

REXX/WIPRO TECH

96

SESSION EIGHT
HANDLE AID
DEBUGGING
What you will be able to do after this session ???
After the end of this session you will be able to use the tracing facilities that are available in rexx.

REXX/WIPRO TECH

97

TURN ON THE DEBUGGER BEFORE EXECUTION


TURN ON
To turn on the interactive debugger before executing your rexx exec. Type in the tso command executil ts in the command line commands or tso native mode. Which will turn on the debugger.

Note:
Interactive debugger will be active for a single exec that is going to be executed after the executil ts. It will not be available for the next exec that is going to follow . If you want the debugger to be switched on for the next exec you have to issue one more executil ts.
REXX/WIPRO TECH 98

Invoking the Debugger during exec execution


There are several things that you can do to affect your rexx exec execution. If you press any attention key ypu will interrupt the execution. After you press the attention key tso displays

enter hi to end , a null line to continue, or an immediate command Then you can type put into the interactive debug by typing ts stop the exec and return to tso hi cancel the output of a say or a trace by typing ht stop all the tracing by typing te continue the program execution by pressing enter
REXX/WIPRO TECH 99

What you can put in the exec


There some instructions you may have to put in your exec that affect debugging. You will most likely remove these instructions when your exec is put into production.
Trace off : nothing traced Trace scan : check syntax & does not execute Trace error : tso command that doesn't work Trace failure :tso command that doesn't exist Trace results: labels,commands Trace !results: same as above dont execute Trace commands :tso commands Trace label : labels only Trace all: label, commands, verbs
REXX/WIPRO TECH 100