231459160-rexx.ppt
TRANSCRIPT
![Page 1: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/1.jpg)
1REXX Fundamentals
A Property of IBM-HR Access development Project
REXXREXX
![Page 2: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/2.jpg)
2REXX Fundamentals
A Property of IBM-HR Access development Project
ObjectivesObjectives
Introduction to REXX
Syntax and Functions
Advanced Concepts
![Page 3: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/3.jpg)
3REXX Fundamentals
A Property of IBM-HR Access development Project
IntroductionIntroduction What is REXX ?
Restructured EXtended eXecutor Interpreted command language Very useful for linking TSO, ISPF and other functions Useful for developing custom-made utilities
![Page 4: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/4.jpg)
4REXX Fundamentals
A Property of IBM-HR Access development Project
Features of REXXFeatures of REXX
Ease of use
Free format
Convenient built-in functions
![Page 5: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/5.jpg)
5REXX Fundamentals
A Property of IBM-HR Access development Project
Features of REXX Features of REXX (Cont...)(Cont...)
Debugging capabilities
Interpreted language
Extensive parsing capabilities
![Page 6: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/6.jpg)
6REXX Fundamentals
A Property of IBM-HR Access development Project
Components of REXXComponents of REXX Instructions Built-in functions TSO/E external functions Data stack functions
![Page 7: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/7.jpg)
7REXX Fundamentals
A Property of IBM-HR Access development Project
InstructionInstruction Keyword
Tells the language processor to do something Assignment
Gives a value to a variable or changes the current value of a variable
Label A symbolic name followed by a colon Identifies a portion of the exec Commonly used in subroutines and functions, and with the
SIGNAL instruction
![Page 8: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/8.jpg)
8REXX Fundamentals
A Property of IBM-HR Access development Project
Instruction Instruction (Cont...)(Cont...)
Null Comment or a blank line Ignored by the language processor Makes an exec easier to read
Command (both REXX commands and host commands)
![Page 9: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/9.jpg)
9REXX Fundamentals
A Property of IBM-HR Access development Project
Built-in functionsBuilt-in functions These functions are built into the language processor Provide convenient processing options
![Page 10: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/10.jpg)
10REXX Fundamentals
A Property of IBM-HR Access development Project
TSO/E external functionsTSO/E external functions Interact with the system Do specific tasks for REXX
![Page 11: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/11.jpg)
11REXX Fundamentals
A Property of IBM-HR Access development Project
Data stack functionsData stack functions Store data for I/O Other types of processing
![Page 12: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/12.jpg)
12REXX Fundamentals
A Property of IBM-HR Access development Project
Syntax of REXXSyntax of REXX
![Page 13: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/13.jpg)
13REXX Fundamentals
A Property of IBM-HR Access development Project
Character Type of REXXCharacter Type of REXX A REXX instruction can be in lower case, upper case, or
mixed case Alphabetic characters are changed to uppercase, unless
enclosed in single or double quotation marks The two types of quotation marks cannot be mixed If any word in the statement is a variable, REXX
substitutes the value
![Page 14: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/14.jpg)
14REXX Fundamentals
A Property of IBM-HR Access development Project
FormatFormat REXX uses a free format A line usually contains one instruction except when it
ends with a comma (,) or contains a semi-colon (;). Comma is the continuation character Indicates that the instruction continues to the next line Semi-colon indicates the end of the instruction Used to separate multiple instructions on one line
![Page 15: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/15.jpg)
15REXX Fundamentals
A Property of IBM-HR Access development Project
Environment / AddressEnvironment / Address ADDRESS TSO for native TSO commands ADDRESS ISPEXEC for ISPF services ADDRESS ISREDIT for ISPF edit macros These are required to invoke the environment for
function calls
![Page 16: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/16.jpg)
16REXX Fundamentals
A Property of IBM-HR Access development Project
Variables and expressionsVariables and expressions
![Page 17: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/17.jpg)
17REXX Fundamentals
A Property of IBM-HR Access development Project
VariablesVariables Character or group of characters that represents a value
e.g. count = 1000 Variable names can consist of:
A....Z / a - Z alphabetic 0....9 numbers @ # $ ¢ ? ! . _ special characters
![Page 18: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/18.jpg)
18REXX Fundamentals
A Property of IBM-HR Access development Project
Variables Variables (Cont...)(Cont...)
Restrictions on the variable name are: The first character cannot be 0 through 9 or a period (.) The variable name cannot exceed 250 bytes The variable name should not be RC, SIGL, or RESULT,
which are REXX special variables
![Page 19: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/19.jpg)
19REXX Fundamentals
A Property of IBM-HR Access development Project
ParsingParsing Separates data by comparing the data to a template (or
pattern of variable names) Preserves the case of the input data PARSE UPPER converts data to uppercase Separators in a template can be
blank, string, variable, or number that represents column position
![Page 20: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/20.jpg)
20REXX Fundamentals
A Property of IBM-HR Access development Project
ParsingParsing Blank - an example
Each variable name gets one word of data in sequence except for the last, which gets the remainder of the data
PARSE VALUE ‘Value with Blanks.’ WITH pattern type pattern contains ‘Value’ type contains ‘ with Blanks.’
![Page 21: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/21.jpg)
21REXX Fundamentals
A Property of IBM-HR Access development Project
ParsingParsing Blank - another example
PARSE VALUE ‘Value with Extra Variables.’ WITH data1 data2 data3 data4 data5 data1 contains ‘Value’ data2 contains ‘with’ data3 contains ‘Extra’ data4 contains ‘Variables.’ data5 contains ‘’
![Page 22: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/22.jpg)
22REXX Fundamentals
A Property of IBM-HR Access development Project
ParsingParsing Substitution - an example
PARSE VALUE ‘Value with Periods in it.’ WITH pattern . type .
pattern contains ‘Value’ type contains ‘Periods’ the periods replace the words “with” and “in it.”
![Page 23: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/23.jpg)
23REXX Fundamentals
A Property of IBM-HR Access development Project
ParsingParsing Separators - an example
phrase = ‘Dun & Bradstreet’ PARSE VAR phrase part1 ‘&’ part2 part1 contains ‘Dun ’ part2 contains ‘ Bradstreet’
![Page 24: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/24.jpg)
24REXX Fundamentals
A Property of IBM-HR Access development Project
ParsingParsing Number: Numbers in a template to indicate the column
at which data must be separated Unsigned integer indicates an absolute column position and Signed integer indicates a relative column position
![Page 25: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/25.jpg)
25REXX Fundamentals
A Property of IBM-HR Access development Project
ParsingParsing Absolute column position
An unsigned integer or an integer prefixed with an equal sign (=) in a template
The first segment starts at column 1 and goes up to, but does not include, the information in the column number specified
The subsequent segments start at the column numbers specified
![Page 26: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/26.jpg)
26REXX Fundamentals
A Property of IBM-HR Access development Project
ParsingParsing Absolute column position - an example
quote = ‘Dun & Bradstreet’ PARSE VAR quote part1 6 part2
part1 contains ‘Dun &’ part2 contains ‘Bradstreet’
![Page 27: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/27.jpg)
27REXX Fundamentals
A Property of IBM-HR Access development Project
ParsingParsing Absolute column position - another example
quote = ‘Dun & Bradstreet’ PARSE VAR quote part1 5 part2 7 part3 1 part4 part1 contains ‘Dun’ part2 contains ‘&’ part3 contains ‘Bradstreet’ part4 contains ‘Dun & Bradstreet’
![Page 28: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/28.jpg)
28REXX Fundamentals
A Property of IBM-HR Access development Project
ParsingParsing Relative column position
A signed integer in a template separates the data according to relative column position
The starting position is relative to the starting position of the preceding part.
Can be either positive (+) or negative (-)
![Page 29: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/29.jpg)
29REXX Fundamentals
A Property of IBM-HR Access development Project
ParsingParsing Relative column position - an example
quote = ‘Dun & Bradstreet’ PARSE VAR quote part1 +5 part2 +5 part3 part1 contains ‘Dun &’ part2 contains ‘ Brad’ part3 contains ‘street’
![Page 30: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/30.jpg)
30REXX Fundamentals
A Property of IBM-HR Access development Project
ParsingParsing Variables
Define and use variables to provide further flexibility of a PARSE VAR instruction
Define the variable prior to the parse instruction Enclose the variable in parenthesis - this variable must be
an unsigned integer Use a sign outside the parenthesis to indicate how REXX is
to interpret the unsigned integer REXX substitutes the numeric value for the variable
![Page 31: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/31.jpg)
31REXX Fundamentals
A Property of IBM-HR Access development Project
ParsingParsing Variables - an example
quote = ‘Dun & Bradstreet’ movex = 4 PARSE VAR quote part5 +6 part6 +4 part7
-(movex) part8 part5 contains ‘Dun &’ part6 contains ‘Brad’ part7 contains ‘street’ part8 contains ‘Bradstreet’
![Page 32: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/32.jpg)
32REXX Fundamentals
A Property of IBM-HR Access development Project
ExpressionsExpressions Something that needs to be calculated/evaluated Consists of numbers, variables, or strings, and one or
more operators Four types of operators
Arithmetic Comparison Logical and Concatenation
![Page 33: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/33.jpg)
33REXX Fundamentals
A Property of IBM-HR Access development Project
Arithmetic OperatorsArithmetic Operators Work on valid numeric constants or on variables that
represent valid numeric constants + Add - Subtract -number Negate the number +number Add the number to 0
![Page 34: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/34.jpg)
34REXX Fundamentals
A Property of IBM-HR Access development Project
Arithmetic Operators Arithmetic Operators (Cont...)(Cont...)
* Multiply ** Raise a number to a whole number power / Divide % Divide and return a whole number without a
remainder (quotient only) // Divide and return the remainder only
![Page 35: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/35.jpg)
35REXX Fundamentals
A Property of IBM-HR Access development Project
Arithmetic Operators - Arithmetic Operators - PriorityPriority
Priority from maximum to minimum - + Prefix operators ** Power (exponential) * / % // Multiplication and division + - Addition and subtraction
![Page 36: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/36.jpg)
36REXX Fundamentals
A Property of IBM-HR Access development Project
Comparison operatorsComparison operators Do not return a number value Return either a true or false response in terms of 1 or 0
respectively == Strictly Equal = Equal > Greater than < Less than >= Greater than or equal to <= Less than or equal to
![Page 37: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/37.jpg)
37REXX Fundamentals
A Property of IBM-HR Access development Project
Comparison operators Comparison operators (Cont...)(Cont...)
\== Not strictly equal \= Not equal >< Greater than or less than (same as not equal) \< Not less than \> Not greater than
![Page 38: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/38.jpg)
38REXX Fundamentals
A Property of IBM-HR Access development Project
Strictly Equal and Equal Strictly Equal and Equal OperatorsOperators
When two expressions are strictly equal, everything including the blanks and case (when the expressions are characters) is exactly the same
When two expressions are equal, they are resolved to be the same
![Page 39: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/39.jpg)
39REXX Fundamentals
A Property of IBM-HR Access development Project
Logical OperatorsLogical Operators Return a true (1) or false (0) value when processed Combine two comparisons and return the true (1) or false
(0) value depending on the results of the comparisons Used in complex conditional instructions Can act as checkpoints to screen unwanted conditions
![Page 40: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/40.jpg)
40REXX Fundamentals
A Property of IBM-HR Access development Project
Logical Operators Logical Operators (Cont...)(Cont...)
The logical operators are & AND
Returns 1 if both comparisons are true | Inclusive OR
Returns 1 if at least one comparison is true && Exclusive OR
Returns 1 if only one comparison (but not both) is true Prefix \ Logical NOT
Returns the opposite response
![Page 41: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/41.jpg)
41REXX Fundamentals
A Property of IBM-HR Access development Project
Concatenation operatorsConcatenation operators Combine two terms into one Terms can be strings, variables, expressions, or constants Concatenation can be significant in formatting output
![Page 42: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/42.jpg)
42REXX Fundamentals
A Property of IBM-HR Access development Project
Concatenation operators Concatenation operators (Cont...)(Cont...)
blank concatenate terms, one blank in betweene.g. TRUE BLUE result is TRUE BLUE
|| concatenate terms, no blanks in betweene.g. “a”||”.b” result is a.b
abuttal concatenate terms, no blanks in betweene.g. per_cent‘%’ if per_cent = 50, result is 50%
![Page 43: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/43.jpg)
43REXX Fundamentals
A Property of IBM-HR Access development Project
Overall Operator PriorityOverall Operator Priority \ ¬ - + Prefix operators ** Power (exponential) * / % // Multiply and divide + - Add and subtract blank || abuttal Concatenation operators == = >< Comparison operators & Logical AND | && inclusive OR, exclusive OR
![Page 44: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/44.jpg)
44REXX Fundamentals
A Property of IBM-HR Access development Project
Control of Control of program flowprogram flow
![Page 45: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/45.jpg)
45REXX Fundamentals
A Property of IBM-HR Access development Project
Conditional instructionsConditional instructions Instructions which set up at least one condition in the
form of an expression
IF/THEN/ELSE, and
SELECT/WHEN/OTHERWISE
![Page 46: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/46.jpg)
46REXX Fundamentals
A Property of IBM-HR Access development Project
IF constructIF construct Can direct the execution of an exec to one of two choices IF expression
THEN instructionELSE instruction
for more than one instruction for a condition, begin the set of instructions with a DO and end them with an END
![Page 47: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/47.jpg)
47REXX Fundamentals
A Property of IBM-HR Access development Project
IF construct IF construct (Cont...)(Cont...)
IF expression THEN DOinstructioninstructionEND
ELSEDOinstructioninstructionEND
![Page 48: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/48.jpg)
48REXX Fundamentals
A Property of IBM-HR Access development Project
SELECT constructSELECT construct can direct the execution to one of many choices. SELECT
WHEN expression THEN instructionWHEN expression THEN instruction:OTHERWISEinstruction(s)
END
![Page 49: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/49.jpg)
49REXX Fundamentals
A Property of IBM-HR Access development Project
SELECT constructSELECT construct for more than one instruction for a possible path, begin
the set of instructions with a DO and end them with an END
However, if more than one instruction follows the OTHERWISE keyword, DO and END are not necessary
![Page 50: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/50.jpg)
50REXX Fundamentals
A Property of IBM-HR Access development Project
Looping instructionsLooping instructions Tell the language processor to repeat a set of instructions A loop can repeat a specified number of times or Can use a condition to control repeating Two types of loops
Repetitive repeat instructions a certain number of times Conditional use a condition to control repeating
![Page 51: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/51.jpg)
51REXX Fundamentals
A Property of IBM-HR Access development Project
Repetitive loopsRepetitive loops Repeat a set of instructions a specified number of times
e.g. DO i = 1 to 5SAY “Hello !”END
The step can also be controlled e.g. DO i = 1 to 10 STEP 2
SAY “Hello !”END
![Page 52: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/52.jpg)
52REXX Fundamentals
A Property of IBM-HR Access development Project
Repetitive loopsRepetitive loops DO FOREVER/END - infinite loops
EXIT when a condition is reached LEAVE instruction - leaves the loop
e.g. DO FOREVERIF X = 0 THEN LEAVE
![Page 53: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/53.jpg)
53REXX Fundamentals
A Property of IBM-HR Access development Project
Conditional loopsConditional loops DO WHILE
DO WHILE expressioninstruction(s)
END Test the expression before the loop executes the first time
and repeat only when the expression is true
![Page 54: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/54.jpg)
54REXX Fundamentals
A Property of IBM-HR Access development Project
Conditional loopsConditional loops DO UNTIL
DO UNTIL expressioninstruction(s)
END Test the expression after the loop executes at least once and
repeat only when the expression is false
![Page 55: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/55.jpg)
55REXX Fundamentals
A Property of IBM-HR Access development Project
Interrupt instructionsInterrupt instructions Tell the language processor to leave the exec entirely or leave one part of the exec and go to another part either
permanently or temporarily These are
EXIT SIGNAL CALL/RETURN
![Page 56: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/56.jpg)
56REXX Fundamentals
A Property of IBM-HR Access development Project
EXITEXIT Causes an exec to unconditionally end Return to where the exec was invoked Can also return a value to the caller of the exec
![Page 57: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/57.jpg)
57REXX Fundamentals
A Property of IBM-HR Access development Project
SIGNAL labelSIGNAL label Interrupts the normal flow of an exec Causes control to pass to a specified label Unlike CALL, SIGNAL does not return to a specific
instruction to resume execution When SIGNAL is issued from within a loop, the loop
automatically ends
![Page 58: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/58.jpg)
58REXX Fundamentals
A Property of IBM-HR Access development Project
SIGNAL labelSIGNAL label When SIGNAL is issued from an internal routine, the
internal routine will NOT return to its caller SIGNAL is useful for testing execs or to provide an
emergency course of action Should not be used as a convenient way to move (jump)
from one place in an exec to another
![Page 59: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/59.jpg)
59REXX Fundamentals
A Property of IBM-HR Access development Project
CALL / RETURNCALL / RETURN When calling an internal subroutine, CALL passes
control to a label specified after the CALL keyword When the subroutine ends with the RETURN instruction,
the instructions following CALL are executed
![Page 60: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/60.jpg)
60REXX Fundamentals
A Property of IBM-HR Access development Project
CALL / RETURNCALL / RETURN When calling an external subroutine, CALL passes
control to the exec name that is specified after the CALL keyword
When the external subroutine completes, the RETURN instruction returns to where you left off in the calling exec
![Page 61: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/61.jpg)
61REXX Fundamentals
A Property of IBM-HR Access development Project
Functions and SubroutinesFunctions and Subroutines
![Page 62: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/62.jpg)
62REXX Fundamentals
A Property of IBM-HR Access development Project
FunctionsFunctions Sequence of instructions that can
Receive data Process that data, and Return a value
All functions return a value to the exec that issued the function call
Syntax is function(arguments) No space between the function name and the left
parenthesis
![Page 63: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/63.jpg)
63REXX Fundamentals
A Property of IBM-HR Access development Project
Functions - parametersFunctions - parameters Up to 20 arguments separated by commas
Blank function( ) Constant function(55) Symbol function(symbol_name) Literal function(‘With a literal string’) function(function(arguments))
Another function function(‘With a literal string’, 55, option)
Combination of argument types
![Page 64: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/64.jpg)
64REXX Fundamentals
A Property of IBM-HR Access development Project
Functions - TypesFunctions - Types Built-in functions built into the language processor User-written functions --
Written by an individual user or supplied by an installation Internal function is part of the current exec that starts at a
label External function is a self-contained program or exec
outside of the calling exec
![Page 65: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/65.jpg)
65REXX Fundamentals
A Property of IBM-HR Access development Project
Built-in functionsBuilt-in functions
![Page 66: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/66.jpg)
66REXX Fundamentals
A Property of IBM-HR Access development Project
Arithmetic functionsArithmetic functions ABS Returns the absolute value of the input number DIGITS Returns the current setting of NUMERIC
DIGITS FORM Returns the current setting of NUMERIC
FORM FUZZ Returns the current setting of NUMERIC FUZZ MAX Returns the largest number from the list
![Page 67: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/67.jpg)
67REXX Fundamentals
A Property of IBM-HR Access development Project
Arithmetic functionsArithmetic functions MIN Returns the smallest number from the list specified
RANDOM Returns a quasi-random, non-negative whole number in the range specified
SIGN Returns a number that indicates the sign of the input number
TRUNC Returns the integer part of the input number, and optionally a specified number of decimal places
![Page 68: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/68.jpg)
68REXX Fundamentals
A Property of IBM-HR Access development Project
Comparison functionsComparison functions COMPARE
Returns 0 if the two input strings are identical Returns the position of the first character that does not
match
DATATYPE Returns a value indicating data type of the input string, such as a number or character
SYMBOL Returns this state of the symbol (variable, literal, or bad)
![Page 69: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/69.jpg)
69REXX Fundamentals
A Property of IBM-HR Access development Project
Conversion functionsConversion functions Convert one type of data representation to another type
of data representation B2X Binary to hexadecimal C2D Character to Decimal C2X Character to Hexadecimal D2C Decimal to Character
![Page 70: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/70.jpg)
70REXX Fundamentals
A Property of IBM-HR Access development Project
Conversion functionsConversion functions D2X Decimal to Hexadecimal X2B Hexadecimal to binary X2C Hexadecimal to Character X2D Hexadecimal to Decimal
![Page 71: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/71.jpg)
71REXX Fundamentals
A Property of IBM-HR Access development Project
Formatting functionsFormatting functions CENTER/CENTRE Returns a string of a specified
length with the input string centered in it, with pad characters added as necessary to make up the length
COPIES Returns the specified number of concatenated copies of the input string
FORMAT Returns the input number, rounded and formatted to the number of digits specified
![Page 72: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/72.jpg)
72REXX Fundamentals
A Property of IBM-HR Access development Project
Formatting functionsFormatting functions JUSTIFY Returns a specified string formatted by
adding pad characters between words to justify to both margins
LEFT Returns a string of the specified length, truncated or padded on the right as needed
![Page 73: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/73.jpg)
73REXX Fundamentals
A Property of IBM-HR Access development Project
Formatting functionsFormatting functions RIGHT Returns a string of the specified length,
truncated or padded on the left as needed
SPACE Returns the words in the input string with a specified number of pad characters between each word
![Page 74: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/74.jpg)
74REXX Fundamentals
A Property of IBM-HR Access development Project
String manipulating String manipulating functionsfunctions
ABBREV Returns a string indicating if one string is equal to the specified number of leading characters of another string
DELSTR Returns a string after deleting a specified number of characters, starting at a specified point in the input string
DELWORD Returns a string after deleting a specified number of words, starting at a specified word in the input string
![Page 75: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/75.jpg)
75REXX Fundamentals
A Property of IBM-HR Access development Project
String manipulating String manipulating functionsfunctions
FIND Returns the word number of the first word of a specified phrase found within the input string
INDEX Returns the character position of the first character of a specified string found in the input string
INSERT Returns a character string after inserting one input string into another string after a specified character position
![Page 76: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/76.jpg)
76REXX Fundamentals
A Property of IBM-HR Access development Project
String manipulating String manipulating functionsfunctions
LASTPOS Returns the starting character position of the last occurrence of one string in another
LENGTH Returns the length of the input string
OVERLAY Returns a string that is the target string overlaid by a second input string
![Page 77: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/77.jpg)
77REXX Fundamentals
A Property of IBM-HR Access development Project
String manipulating String manipulating functionsfunctions
POS Returns the character position of one string in another
REVERSE Returns a character string, the characters of which are in reverse order (swapped end for end)
STRIP Returns a character string after removing leading or trailing characters or both from the input string
![Page 78: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/78.jpg)
78REXX Fundamentals
A Property of IBM-HR Access development Project
String manipulating String manipulating functionsfunctions
SUBSTR Returns a portion of the input string beginning at a specified character position
SUBWORD Returns a portion of the input string starting at a specified word number
TRANSLATE Returns a character string with each character of the input string translated to another character or unchanged
![Page 79: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/79.jpg)
79REXX Fundamentals
A Property of IBM-HR Access development Project
String manipulating String manipulating functionsfunctions
VERIFY Returns a number indicating whether an input string is composed only of characters from another input string or returns the character position of the first unmatched character
WORD Returns a word from an input string as indicated by a specified number
WORDINDEX Returns the character position in an input string of the first character in the specified word
![Page 80: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/80.jpg)
80REXX Fundamentals
A Property of IBM-HR Access development Project
String manipulating String manipulating functionsfunctions
WORDLENGTH Returns the length of a specified word in the input string
WORDPOS Returns the word number of the first word of a specified phrase in the input string
WORDS Returns the number of words in the input string
![Page 81: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/81.jpg)
81REXX Fundamentals
A Property of IBM-HR Access development Project
Miscellaneous functionsMiscellaneous functions ADDRES Returns the name of the environment to
which commands are currently being sent
ARG Returns an argument string or information about the argument strings to a program or internal routine
BITAND Returns a string composed of the two input strings logically ANDed together, bit by bit
![Page 82: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/82.jpg)
82REXX Fundamentals
A Property of IBM-HR Access development Project
Miscellaneous functionsMiscellaneous functions BITOR Returns a string composed of the two input
strings logically ORed together, bit by bit
BITXOR Returns a string composed of the two input strings eXclusive ORed together, bit by bit
CONDITION Returns the condition information, such as name and status, associated with the current trapped condition
![Page 83: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/83.jpg)
83REXX Fundamentals
A Property of IBM-HR Access development Project
Miscellaneous functionsMiscellaneous functions DATE Returns the date in one of various optional
formats
ERRORTEXT Returns the error message associated with the specified error number
EXTERNALS Returns the number of elements in the terminal input buffer. In TSO/E, always a 0
LINESIZE Returns the current terminal line width minus 1
![Page 84: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/84.jpg)
84REXX Fundamentals
A Property of IBM-HR Access development Project
Miscellaneous functionsMiscellaneous functions QUEUED Returns the number of lines remaining in
the external data queue at the time when the function is invoked
SOURCELINE Returns either the line number of the last line in the source file or the source line specified by a number
TIME Returns the local time in the default 24-hour clock format (hh:mm:ss) or in one of various optional formats
![Page 85: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/85.jpg)
85REXX Fundamentals
A Property of IBM-HR Access development Project
Miscellaneous functionsMiscellaneous functions TRACE Returns the trace actions currently in effect
USERID Returns the TSO/E user ID, if the REXX exec is running in the TSO/E address space
VALUE Returns the value of a specified symbol and optionally assigns it a new value
XRANGE Returns a string of all 1-byte codes (in ascending order) between and including specified starting and ending values
![Page 86: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/86.jpg)
86REXX Fundamentals
A Property of IBM-HR Access development Project
Date formatsDate formats Syntax of the date function id DATE(option)
A variety of options are available The full option, or it’s first alphabet, can be passed as
argument A list of options follows
![Page 87: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/87.jpg)
87REXX Fundamentals
A Property of IBM-HR Access development Project
Date formatsDate formats Base(or Basedate) Returns the number of complete
days (that is, not including the current day) since and including the date, January 1, 0001, in the format: dddddd (no leading zeros or blanks) The expression DATE(‘B’)//7 returns a number in the range
0-6, where 0 is Monday and 6 is Sunday Thus, this function can be used to determine the day of the
week independent of the language
![Page 88: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/88.jpg)
88REXX Fundamentals
A Property of IBM-HR Access development Project
Date formatsDate formats Century Returns the number of days, including the
current day, since and including January 1 of the last year that is a multiple of 100 in the format: ddddd (no leading zeros)Example: A call to DATE(C) is made on March 13, 1992, so the number of days from January 1, 1900, to March 13, 1992, (33675) is returned
Days Returns the number of days, including the current day, so far in this year in the format: ddd (no leading zeros or blanks)
![Page 89: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/89.jpg)
89REXX Fundamentals
A Property of IBM-HR Access development Project
Date formatsDate formats European Returns date in dd/mm/yy format
Julian Returns date in yyddd format
Month Returns full English name of the current month, for example, August
Normal Returns date in the format: dd mon yyyy. This is the default
![Page 90: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/90.jpg)
90REXX Fundamentals
A Property of IBM-HR Access development Project
Date formatsDate formats Ordered Returns date in the format: yy/mm/dd
(suitable for sorting)
Standard / Sorted Returns date in the format: yyyymmdd (suitable for sorting)
USA Returns date in mm/dd/yy format
Weekday Returns the English name for the day of the week, in mixed case, for example, Tuesday
![Page 91: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/91.jpg)
91REXX Fundamentals
A Property of IBM-HR Access development Project
Time formatsTime formats Syntax of the Time function is TIME(option)
A variety of options are available The full option, or it’s first alphabet, can be passed as the
argument A list of options follows
![Page 92: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/92.jpg)
92REXX Fundamentals
A Property of IBM-HR Access development Project
Time formatsTime formats Civil
Returns the time in Civil format: hh:mmxx The hours take the values 1 through 12 The minutes take the values 00 through 59 The minutes are followed immediately by the letters am or
pm The hour has no leading zero The minute field shows the current minute (rather than the
nearest minute) for consistency with other TIME results
![Page 93: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/93.jpg)
93REXX Fundamentals
A Property of IBM-HR Access development Project
Time formatsTime formats Elapsed
Returns sssssssss.uuuuuu, the number of seconds.microseconds since the elapsed-time clock was started or reset
No leading zeros or blanks Setting of NUMERIC DIGITS does not affect the number The fractional part always has six digits
![Page 94: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/94.jpg)
94REXX Fundamentals
A Property of IBM-HR Access development Project
Time formatsTime formats Hours
Returns up to two characters Gives the number of hours since midnight Format is hh No leading zeros or blanks, except for a result of 0
![Page 95: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/95.jpg)
95REXX Fundamentals
A Property of IBM-HR Access development Project
Time formatsTime formats Long
Returns time in the format: hh:mm:ss.uuuuuu (uuuuuu is in microseconds)
The first eight characters of the result follow the same rules as for the Normal form
The fractional part is always six digits
![Page 96: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/96.jpg)
96REXX Fundamentals
A Property of IBM-HR Access development Project
Time formatsTime formats Minutes
Returns up to four characters Gives the number of minutes since midnight Format is mmmm No leading zeros or blanks, except for a result of 0
![Page 97: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/97.jpg)
97REXX Fundamentals
A Property of IBM-HR Access development Project
Time formatsTime formats Normal
This is the default Returns the time in the format hh:mm:ss Hours take the values 00 through 23 Minutes and seconds take 00 through 59 All these are always two digits Any fractions of seconds are ignored (times are never
rounded up)
![Page 98: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/98.jpg)
98REXX Fundamentals
A Property of IBM-HR Access development Project
Time formatsTime formats Reset
Returns sssssssss.uuuuuu, the number of seconds.microseconds since the elapsed-time clock was started or reset
Also resets the elapsed-time clock to zero The number has no leading zeros or blanks Setting of NUMERIC DIGITS does not affect the number The fractional part always has six digits
![Page 99: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/99.jpg)
99REXX Fundamentals
A Property of IBM-HR Access development Project
Time formatsTime formats Seconds
Returns up to five characters Gives the number of seconds since midnight Format is sssss No leading zeros or blanks, except for a result of 0
![Page 100: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/100.jpg)
100REXX Fundamentals
A Property of IBM-HR Access development Project
SubroutinesSubroutines
![Page 101: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/101.jpg)
101REXX Fundamentals
A Property of IBM-HR Access development Project
SubroutinesSubroutines Series of instructions that an exec invokes Performs a specific task The subroutine is invoked by the CALL instruction When the subroutine ends, it returns control to the
instruction that directly follows the subroutine call The instruction that returns control is the RETURN
instruction
![Page 102: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/102.jpg)
102REXX Fundamentals
A Property of IBM-HR Access development Project
SubroutinesSubroutines Subroutines may be
Internal and designated by a label, or external and designated by the member name that contains
the subroutine
IMPORTANT NOTE Internal subroutines generally appear after the main part of
the exec. So, when there is an internal subroutine, it is important to end the main part of the exec with the EXIT instruction
![Page 103: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/103.jpg)
103REXX Fundamentals
A Property of IBM-HR Access development Project
Using subroutinesUsing subroutines
Sharing information can be done by
Passing variables
Passing arguments
![Page 104: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/104.jpg)
104REXX Fundamentals
A Property of IBM-HR Access development Project
Passing VariablesPassing Variables
Main exec and subroutine share the same variables by name
Value of the variable is the same irrespective of where it has been set
![Page 105: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/105.jpg)
105REXX Fundamentals
A Property of IBM-HR Access development Project
An exampleAn example number1 = 5 number2 = 10 CALL sub1 SAY answer
(Displays 15) EXIT
sub1: answer = number1 +
number2 RETURN
![Page 106: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/106.jpg)
106REXX Fundamentals
A Property of IBM-HR Access development Project
Shielding VariablesShielding Variables Done by using PROCEDURE instruction immediately
after the subroutine label All variables used in the subroutine become local to the
subroutine Shielded from the main part of the exec
![Page 107: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/107.jpg)
107REXX Fundamentals
A Property of IBM-HR Access development Project
An exampleAn example number1 = 10
CALL sub2 SAY number1 number2
(displays 10 NUMBER2) EXIT
sub2: PROCEDURE number1 = 7 number2 = 5 RETURN
![Page 108: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/108.jpg)
108REXX Fundamentals
A Property of IBM-HR Access development Project
Exposing VariablesExposing Variables To protect specific variables
use the EXPOSE option with the PROCEDURE instruction followed by the variables that are to remain exposed to the subroutine
![Page 109: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/109.jpg)
109REXX Fundamentals
A Property of IBM-HR Access development Project
An exampleAn example number1 = 10 CALL sub3 SAY number1 number2
(displays 7 NUMBER2) EXIT
sub3: PROCEDURE EXPOSE number1
number1 = 7 number2 = 5 RETURN
![Page 110: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/110.jpg)
110REXX Fundamentals
A Property of IBM-HR Access development Project
Passing ArgumentsPassing Arguments Passed in main EXEC by
CALL subroutine_name argument1, argument2, argument3, etc.
Up to 20 arguments can be passed
Received in subroutine by ARG arg1, arg2, arg3, etc. The names of the arguments on the CALL and the ARG
instructions need not be the same information is passed by position, and not by name
![Page 111: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/111.jpg)
111REXX Fundamentals
A Property of IBM-HR Access development Project
An exampleAn example length = 10 width = 7 CALL sub4 length, width SAY ‘The perimeter is ‘
RESULT ‘Meters’ EXIT
sub4: ARG len, wid perim = 2 * ( len + wid) RETURN perim
![Page 112: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/112.jpg)
112REXX Fundamentals
A Property of IBM-HR Access development Project
Compound variablesCompound variables Compound variable is a single-dimensional array,
denoted by <variable name>. The variable name itself can be more than one level The rules that apply to a variable name also apply to a
compound variable Very useful in array manipulation, input/output etc.
![Page 113: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/113.jpg)
113REXX Fundamentals
A Property of IBM-HR Access development Project
Using REXXUsing REXX
![Page 114: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/114.jpg)
114REXX Fundamentals
A Property of IBM-HR Access development Project
ConventionsConventions Datasets are named as
<high level qualifier>.REXX.EXEC The last level .EXEC is optional Each member must have the first line as /* REXX */ This makes the command processor (TSO) invoke the
REXX interpreter
![Page 115: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/115.jpg)
115REXX Fundamentals
A Property of IBM-HR Access development Project
ConcatenationsConcatenations Datasets containing REXX EXECs must be concatenated
to SYSEXEC or SYSPROC
Concatenation to SYSEXEC makes execution faster, as it is above SYSPROC in the search order
![Page 116: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/116.jpg)
116REXX Fundamentals
A Property of IBM-HR Access development Project
MODEL commandMODEL command Useful for giving an on-line model for ISPF function
calls Edit a member in a REXX dataset, and issue the MODEL
command A list of all ISPF services is displayed Choose the desired service A copy of the syntax is embedded Change it as required
![Page 117: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/117.jpg)
117REXX Fundamentals
A Property of IBM-HR Access development Project
ExecutionExecution How and where can REXX execs be executed
From TSO READY prompt (if no ISPF services are used) From inside ISPF From inside another exec
![Page 118: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/118.jpg)
118REXX Fundamentals
A Property of IBM-HR Access development Project
Debugging REXX ExecsDebugging REXX Execs TRACE C
any command that follows is traced before it is executed then it is executed, and the return code from the command
is displayed
TRACE E any host command that results in a non-zero return code is
traced after it executes the return code from the command is displayed
![Page 119: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/119.jpg)
119REXX Fundamentals
A Property of IBM-HR Access development Project
Debugging REXX ExecsDebugging REXX Execs Trace ?I (Intermediates)
Stops execution after each instruction Trace ?R (Results)
Displays the result of execution of each step, but runs continuously
These help to trace the progress of the EXEC EXECUTIL TS (Trace start) and TE (trace end) can also
be used to start and end the tracing of a REXX
![Page 120: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/120.jpg)
120REXX Fundamentals
A Property of IBM-HR Access development Project
Debugging REXX ExecsDebugging REXX Execs RC Return code of the last instruction executed SIGL Set to the line number from where the transfer
occurred These variables can also be used to trace the exec
![Page 121: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/121.jpg)
121REXX Fundamentals
A Property of IBM-HR Access development Project
TSO/E External functionsTSO/E External functions All TSO commands can be issued Enclose them within quotation marks
e.g. "LISTDS ‘my.dataset’ STATUS" Variables can also be passed
e.g. "LISTDS" name "STATUS" here, name is a variable used in the REXX
![Page 122: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/122.jpg)
122REXX Fundamentals
A Property of IBM-HR Access development Project
ISPF functionsISPF functions
![Page 123: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/123.jpg)
123REXX Fundamentals
A Property of IBM-HR Access development Project
PanelsPanels Display panels, accept data and pass on data for
processing Syntax is
ADDRESS ISPEXEC “Display panel(XXXXXX)”
![Page 124: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/124.jpg)
124REXX Fundamentals
A Property of IBM-HR Access development Project
TablesTables All table services like TBCREATE, TBADD,
TBUPDATE, TBDELETE etc. Syntax is
ADDRESS ISPEXEC “TBADD tbl-name ....” “TBDELETE tbl-name...” etc.
![Page 125: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/125.jpg)
125REXX Fundamentals
A Property of IBM-HR Access development Project
SkeletonsSkeletons ISPF Skeleton services like generating JCLs from
skeletons Syntax is
ADDRESS ISPEXEC “ftopen” “ftincl skelname” “ftclose temp” ADDRESS TSO “submit ztempf”
![Page 126: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/126.jpg)
126REXX Fundamentals
A Property of IBM-HR Access development Project
LM FunctionsLM Functions Dataset list Member list
Copy members Delete members manipulate statistics of members
![Page 127: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/127.jpg)
127REXX Fundamentals
A Property of IBM-HR Access development Project
Data stackData stack Place for storing variables temporarily Manipulated using PUSH and QUEUE No limits on the length and format of the data items Theoretically no limit on the number of items to be
stacked - limited only by practical considerations
![Page 128: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/128.jpg)
128REXX Fundamentals
A Property of IBM-HR Access development Project
Data stackData stack PUSH works LIFO (Last-In-First-Out)
puts items to the top of the stack
QUEUE works FIFO (First-In-First-Out) puts items on the bottom of the stack
In both cases, elements are removed by PULL QUEUED() gives the number of items put on a stack in
a single EXEC
![Page 129: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/129.jpg)
129REXX Fundamentals
A Property of IBM-HR Access development Project
Input/Output processingInput/Output processing Operations with datasets All datasets with a defined record format are allowed
(except RECFM=U)
![Page 130: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/130.jpg)
130REXX Fundamentals
A Property of IBM-HR Access development Project
DISKRDISKR EXECIO DISKR for reading the dataset/member
“EXECIO 0 DISKR mydd (OPEN” - just opens the dataset “EXECIO 25 ...”- reads 25 lines “EXECIO * ...” - reads all the lines “EXECIO * DISKR myindd 100 (FINIS” - reads all
lines from line 100 In all the above cases, the lines are read on to the STACK
“EXECIO * DISKR myindd (STEM newvar.” - reads into a stem of variables called newvar
![Page 131: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/131.jpg)
131REXX Fundamentals
A Property of IBM-HR Access development Project
DISKWDISKW Options for DISKR also hold for DISKW Writes to dataset/member Can be written from stem/stack Numerous other options available for positioning,
skipping, LIFO/FIFO etc.
![Page 132: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/132.jpg)
132REXX Fundamentals
A Property of IBM-HR Access development Project
An exampleAn example Use REXX to
List all datasets following a particular pattern For each dataset, list all the members starting with a
particular pattern
This can be done by Using LMDLIST to get the dataset list Then using LMMLIST on each dataset to get the member
list Match patterns, and display appropriate members
![Page 133: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/133.jpg)
133REXX Fundamentals
A Property of IBM-HR Access development Project
ReferencesReferences TSO/E Version 2 REXX/MVS User’s Guide TSO/E Version 2 REXX/MVS Reference Both these books are available on our file server
(IBM Book Manager for Windows) Programming in REXX by Charles Daney, J.Ranade
IBM series
![Page 134: 231459160-REXX.ppt](https://reader037.vdocument.in/reader037/viewer/2022110216/577cc46c1a28aba711993de1/html5/thumbnails/134.jpg)
134REXX Fundamentals
A Property of IBM-HR Access development Project
Thank Thank You!You!