Summary of TSO/E REXX

  • Page 1

    Z/os tso/e rexx user’s guide sa22-7791-00

  • Page 3

    Z/os tso/e rexx user’s guide sa22-7791-00

  • Page 4

    Note before using this information and the product it supports, be sure to read the general information under “appendix d. Notices” on page 205. First edition, march 2001 this edition applies to version 1 release 1 of z/os (5694-a01) and to all subsequent releases and modifications until otherwise i...

  • Page 5: Contents

    Contents figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ix tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . Xi about this book . . . . . . . . . . . . . . . . . . . . . . . Xiii who should use this book . . . . . . . . . . . . . . . . . . . . Xiii how this book is orga...

  • Page 6

    Specifying values when invoking an exec . . . . . . . . . . . . . . 22 preventing translation of input to uppercase . . . . . . . . . . . . . 23 passing arguments . . . . . . . . . . . . . . . . . . . . . . 24 chapter 3. Using variables and expressions . . . . . . . . . . . . . 25 using variables. ....

  • Page 7

    Chapter 7. Manipulating data . . . . . . . . . . . . . . . . . . . 85 using compound variables and stems . . . . . . . . . . . . . . . . 85 what is a compound variable? . . . . . . . . . . . . . . . . . . 85 using stems . . . . . . . . . . . . . . . . . . . . . . . . . 86 parsing data. . . . . . . ....

  • Page 8

    Creating a buffer on the data stack. . . . . . . . . . . . . . . . . 142 creating a buffer with the makebuf command . . . . . . . . . . . 143 dropping a buffer with the dropbuf command . . . . . . . . . . . 144 finding the number of buffers with the qbuf command . . . . . . . . 144 finding the numbe...

  • Page 9

    Controlling program flow . . . . . . . . . . . . . . . . . . . . 199 debugging . . . . . . . . . . . . . . . . . . . . . . . . . . 200 execution . . . . . . . . . . . . . . . . . . . . . . . . . . 200 interactive communication . . . . . . . . . . . . . . . . . . . . 201 passing information. . . . . ...

  • Page 10

    Viii z/os v1r1.0 tso/e rexx user’s guide.

  • Page 11: Figures

    Figures 1. Execio example 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 2. Execio example 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 3. Execio example 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 4. Execio example 4 . . . . . . . . . . . . . ...

  • Page 12

    X z/os v1r1.0 tso/e rexx user’s guide.

  • Page 13: Tables

    Tables 1. Language codes for setlang function that replace the function call . . . . . . . . . 125 © copyright ibm corp. 1988, 2001 xi.

  • Page 14

    Xii z/os v1r1.0 tso/e rexx user’s guide.

  • Page 15: About This Book

    About this book this book describes how to use the tso/e procedures language mvs/rexx processor (called the language processor) and the restructured extended executor (rexx) language. Together, the language processor and the rexx language are known as tso/e rexx. Tso/e rexx is the implementation of ...

  • Page 16

    Purpose of each chapter at the beginning of each chapter is a statement about the purpose of the chapter. Following that are headings and page numbers where you can find specific information. Examples throughout the book, you will find examples that you can try as you read. If the example is a rexx ...

  • Page 17

    If you supplied the correct key code you will receive confirmation that your request is being processed. After your request is processed you will receive an e-mail confirmation. Note: you cannot access the z/os licensed books unless you have registered for access to them and received an e-mail confi...

  • Page 18

    Xvi z/os v1r1.0 tso/e rexx user’s guide.

  • Page 19

    Part 1. Learning the rexx language the rexx language is a versatile general-purpose programming language that can be used by new and experienced programmers. This part of the book is for programmers who want to learn the rexx language. The chapters in this part cover the following topics. V “chapter...

  • Page 20

    2 z/os v1r1.0 tso/e rexx user’s guide.

  • Page 21: Chapter 1. Introduction

    Chapter 1. Introduction what is rexx? . . . . . . . . . . . . . . . . . . . . . . . . . 3 features of rexx . . . . . . . . . . . . . . . . . . . . . . . . 3 ease of use . . . . . . . . . . . . . . . . . . . . . . . . . 3 free format . . . . . . . . . . . . . . . . . . . . . . . . . 3 convenient buil...

  • Page 22

    Do not need to be predefined, and you can type instructions in upper, lower, or mixed case. The few rules about rexx format are covered in “syntax of rexx instructions” on page 9. Convenient built-in functions rexx supplies built-in functions that perform various processing, searching, and compariso...

  • Page 23

    The saa solution: v defines a common programming interface you can use to develop applications that can be integrated with each other and transported to run in multiple saa environments. V defines common communications support that you can use to connect applications, systems, networks, and devices....

  • Page 24

    Protection for source code and programs your rexx programs and algorithms are assets that you want to protect. The compiler produces object code, which helps you protect these assets by discouraging people from making unauthorized changes to your programs. You can distribute your rexx programs in ob...

  • Page 25

    Chapter 2. Writing and running a rexx exec before you begin . . . . . . . . . . . . . . . . . . . . . . . . 7 what is a rexx exec? . . . . . . . . . . . . . . . . . . . . . . 8 syntax of rexx instructions . . . . . . . . . . . . . . . . . . . . 9 the character type of rexx instructions . . . . . . ....

  • Page 26

    Tso/e allocate command. For specific information about allocating a data set for an exec, see “appendix a. Allocating data sets” on page 185. What is a rexx exec? A rexx exec consists of rexx language instructions that are interpreted directly by the rexx interpreter or compiled directly by a rexx l...

  • Page 27

    When you type a number, for example 42, and press the enter key, the variable number1 is assigned the value 42. You then see another sentence on the screen. Now enter a number to add to the first number. When you enter another number, for example 21, the variable number2 is assigned the value 21. Th...

  • Page 28

    If a string contains an apostrophe, you can enclose the literal string in double quotation marks. Say "this isn't a clist instruction." you can also use two single quotation marks in place of the apostrophe, because a pair of single quotation marks is processed as one. Say 'this isn't a clist instru...

  • Page 29

    This is a string. In the first example, the comma at the end of line 1 adds a space when the two lines are concatenated for display. In the second example, the space between the two separate strings is preserved when the line is displayed. Continuing a literal string without adding a space if you ne...

  • Page 30

    Example of free format /************************* rexx ************************************/ say 'this is a rexx literal string.' say 'this is a rexx literal string.' say 'this is a rexx literal string.' say, 'this', 'is', 'a', 'rexx', 'literal', 'string.' say'this is a rexx literal string.';say'thi...

  • Page 31

    Edit ---- userid.Rexx.Exec(timegame)------------------- columns 009 080 command ===> scroll ===> half ****** ************************ top ofdata ************************************ 000001 /************************** rexx ****************************/ 000002 /* this is an interactive rexx exec that ...

  • Page 32

    In the first of the two examples, the value of number is 8. If the second example directly followed the first in an exec, the value of number would become 12. More about expressions is covered in “using expressions” on page 28. Label a label, such as game1: (line 5), is a symbolic name followed by a...

  • Page 33

    Be checked as being valid dbcs strings. Dbcs characters must be enclosed within shift-out (x'0e') and shift-in (x'0f') delimiters. In the following example, the shift-out (so) and shift-in (si) delimiters are represented by the less than symbol ( the greater than symbol ( > ) respectively. 1 for exa...

  • Page 34

    /* which is a dbcs variable name. The linkmvs host command */ /* environment routine will look up the value of the two */ /* variables and pass their values to the address linkmvs */ /* command, "proca29". */ /*******************************************************************/ address linkmvs "proc...

  • Page 35

    ------------------------------ edit - entry panel --------------------------- command ===> tso exec rexx.Exec(timegame) exec ispflibrary: project ===> prefix group ===> rexx ===> ===> ===> type ===> exec member ===> timegame (blank for member selection list) other partitioned or sequential data set:...

  • Page 36

    ----------------------------- tso command processor ------------------------- enter tso command or clist below: ===> timegame enter session manager mode ===> no (yes or no) – on the command line of any ispf/pdf panel as long as the member name is preceded by "tso". ------------------------------ edi...

  • Page 37

    Interpreting error messages when you run an exec that contains an error, an error message often displays the line on which the error occurred and gives an explanation of the error. Error messages can result from syntax errors and from computational errors. For example, the following exec has a synta...

  • Page 38

    Preventing translation to uppercase as a rule, all alphabetic characters processed by the language processor are translated to uppercase before they are processed. These alphabetic characters can be from within an exec, such as words in a rexx instruction, or they can be external to an exec and proc...

  • Page 39

    Tyrannosaurus to cause the language processor to read input exactly as it is presented, use the parse pull instruction. Parse pull animal then if you responded to the example with tyrannosaurus, you would see on the screen: tyrannosaurus exercises - running and modifying the example execs write and ...

  • Page 40

    Note: for the pull instruction to extract information from the terminal, the data stack must be empty. More information about the data stack appears in “chapter 11. Storing information in the data stack” on page 135. Specifying values when invoking an exec another way for an exec to receive input is...

  • Page 41

    Exec rexx.Exec(add) '42 21 10' exec the first variable following the arg instruction, number1, is assigned the value 42. The second variable gets both '21 10'. In this situation, the exec ends with an error when it tries to add the two variables. In other situations, the exec might not end in error....

  • Page 42

    3. First = 13, second = 13, third = 13, fourth = 13, fifth = null 4. Lastname = weber, firstname = joe, score = 91 5. Lastname = baker, firstname = amanda, score = marie 95 6. Lastname = callahan, firstname = eunice, score = 88 passing arguments values passed to an exec are usually called arguments....

  • Page 43

    Chapter 3. Using variables and expressions using variables. . . . . . . . . . . . . . . . . . . . . . . . . 25 variable names . . . . . . . . . . . . . . . . . . . . . . . 26 variable values . . . . . . . . . . . . . . . . . . . . . . . . 27 exercises - identifying valid variable names . . . . . . ....

  • Page 44

    Big = 1000000 variables can refer to different values at different times. If you assign a different value to big, it gets the value of the new assignment, until it is changed again. Big = 999999999 variables can also represent a value that is unknown when the exec is written. In the following exampl...

  • Page 45

    Also, if etmode is set on, the following are valid dbcs variable names, where represents shift-out, and > represents shift-in, ‘.X’, ‘.Y’, and ‘.Z’ represent dbcs characters, and lowercase letters and numbers represent themselves. Number_ 1234 variable values the value of the variable, which is the ...

  • Page 46

    Using expressions an expression is something that needs to be calculated and consists of numbers, variables, or strings, and one or more operators. The operators determine the kind of calculation to be done on the numbers, variables, and strings. There are four types of operators: arithmetic, compar...

  • Page 47

    Using numeric constants and arithmetic operators, you can write arithmetic expressions as follows: 7 + 2 /* result is 9 */ 7 - 2 /* result is 5 */ 7 * 2 /* result is 14 */ 7 ** 2 /* result is 49 */ 7 ** 2.5 /* result is an error */ division notice that three operators represent division. Each operat...

  • Page 48

    Using arithmetic expressions you can use arithmetic expressions in an exec many different ways. The following example uses several arithmetic operators to round and remove extra decimal places from a dollar and cents value. Example using arithmetic expressions /****************************** rexx **...

  • Page 49

    Comparison operators can compare numbers or strings and ask questions, such as: are the terms equal? (a = b) is the first term greater than the second? (a > b) is the first term less than the second? (a for example, if a = 4 and b = 3, then the results of the previous comparison questions are: (a = ...

  • Page 50

    Example using a comparison expression /****************************** rexx *******************************/ /* this exec compares what you paid for lunch for two */ /* days in a row and then comments on the comparison. */ /*******************************************************************/ say 'wha...

  • Page 53

    e...

  • Page 55

    Tracing expressions with the trace instruction you can use the trace instruction to display how the language processor evaluates each operation of an expression as it reads it, or to display the final result of an expression. These two types of tracing are useful for debugging execs. Tracing operati...

  • Page 56

    Tracing results to trace only the final result of an expression, use the trace r (trace results) form of the trace instruction. All expressions that follow the instruction are analyzed and the results are displayed as: >>> final result of an expression if you changed the trace instruction operand in...

  • Page 58

    Tracing expressions with the trace instruction 40 z/os v1r1.0 tso/e rexx user’s guide.

  • Page 59

    Chapter 4. Controlling the flow within an exec using conditional instructions . . . . . . . . . . . . . . . . . . . 42 if/then/else instructions . . . . . . . . . . . . . . . . . . . 42 nested if/then/else instructions . . . . . . . . . . . . . . . . 43 exercise - using the if/then/else instruction ...

  • Page 60

    V interrupt instructions, which 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. The rexx interrupt instructions are: exit signal label call label/return using conditional instructions there are two types ...

  • Page 61

    Ifexpression then instruction else nop if you have more than one instruction for a condition, begin the set of instructions with a do and end them with an end. Ifweather = rainy then say 'find a good book.' else do say 'would you like to play tennis or golf?' pull answer end without the enclosing do...

  • Page 62

    Exercise - using the if/then/else instruction write the rexx instructions for the following flowchart: answer possible solution ifa = 0 then ifc = 2 then b = 1 else nop else ifb = 2 then ifc = 3 then a = 1 else a = 3 else nop select/when/otherwise/end instruction to select one of any number of choic...

  • Page 63

    As a rexx instruction, the flowchart example looks like: select when expression then instruction when expression then instruction when expression then instruction .. . Otherwise instruction(s) end the language processor scans the when clauses starting at the beginning until it finds a true expressio...

  • Page 64

    Example using select/when/otherwise/end /******************************** rexx *****************************/ /* this exec receives input with a person's age and sex. In */ /* reply it displays a person's status as follows: */ /* babies - under 5 */ /* girls - female 5 to 12 */ /* boys - male 5 to 1...

  • Page 65

    Possible solution /******************************** rexx *****************************/ /* this exec requests the user to enter a month as a whole number */ /* from 1 to 12 and responds with the number of days in that */ /* month. */ /*****************************************************************...

  • Page 66

    A variable that controls the number of times a loop repeats is called a control variable. Unless you specify otherwise, the control variable increases by 1 each time the loop repeats. Do number = 1 to 5 say 'loop' number say 'hello!' end say 'dropped out of the loop when number reached' number this ...

  • Page 67

    Important - stopping an infinite loop when you suspect an exec is in an infinite loop, you can end the exec by pressing the attention interrupt key, sometimes labeled pa1. You will then see message irx0920i. In response to this message, type hi for halt interpretation and press the enter key. If tha...

  • Page 68

    Example using a do forever loop /****************************** rexx *******************************/ /* this exec prints data sets named by a user until the user enters*/ /* a null line. */ /*******************************************************************/ do forever say 'enter the name of the n...

  • Page 69

    Iterate else say 'number' count end this example results in a list of numbers from 1 to 10 with the exception of number 8. Number 1 number 2 number 3 number 4 number 5 number 6 number 7 number 9 number 10 exercises - using loops 1. What are the results of the following loops? A. Do digit = 1 to 3 sa...

  • Page 70

    Regardless of whether the user enters "quit", "quit", or "quit", the language processor translates the input to uppercase before comparing it to "quit". Conditional loops there are two types of conditional loops, do while and do until. Both types of loops are controlled by one or more expressions. H...

  • Page 71

    Exercise - using a do while loop write an exec with a do while loop that asks passengers on a commuter airline if they want a window seat and keeps track of their responses. The flight has 8 passengers and 4 window seats. Discontinue the loop when all the window seats are taken. After the loop ends,...

  • Page 72

    Do until expression /* expression must be false */ instruction(s) end use do until loops when a condition is not true and you want to execute the loop until the condition is true. The do until loop tests the condition at the end of the loop and repeats only when the condition is false. Otherwise the...

  • Page 73

    Combining types of loops you can combine repetitive and conditional loops to create a compound loop. The following loop is set to repeat 10 times while a certain condition is met, at which point it stops. Quantity = 20 do number = 1 to 10 while quantity quantity = quantity + number say 'quantity = '...

  • Page 74

    Else say 'hip' end say 'hurrah' end the result is as follows: hip hurrah hip hurrah exercises - combining loops 1. What happens when the following exec runs? Do outer = 1 to 3 say /* write a blank line */ do inner = 1 to 3 say 'outer' outer 'inner' inner end end 2. Now what happens when the leave in...

  • Page 75

    V go temporarily to a subroutine either within the exec or outside the exec (call/return). Exit instruction the exit instruction causes an exec to unconditionally end and return to where the exec was invoked. If the exec was initiated from the proc section of an ispf selection panel, exit returns to...

  • Page 76

    When calling an external subroutine, call passes control to the exec name that is specified after the call keyword. When the external subroutine completes, you can use the return instruction to return to where you left off in the calling exec. For more information about calling subroutines, see “cha...

  • Page 77

    Signal is useful for testing execs or to provide an emergency course of action. It should not be used as a convenient way to move from one place in an exec to another. Signal does not provide a way to return as does the call instruction described in “call/return instructions” on page 57. For more in...

  • Page 78

    60 z/os v1r1.0 tso/e rexx user’s guide.

  • Page 79

    Chapter 5. Using functions what is a function? . . . . . . . . . . . . . . . . . . . . . . . 61 example of a function . . . . . . . . . . . . . . . . . . . . . 62 built-in functions . . . . . . . . . . . . . . . . . . . . . . . . 63 arithmetic functions . . . . . . . . . . . . . . . . . . . . . . 63...

  • Page 80

    Function(option) v another function function(function(arguments)) v combination of argument types function('with a literal string', 55, option) when the function returns a value, and all functions must return values, the value replaces the function call. In the following example, the value returned ...

  • Page 81

    Built-in functions over 50 functions are built into the language processor. The built-in functions fall into the following categories: v arithmetic functions these functions evaluate numbers from the argument and return a particular value. V comparison functions these functions compare numbers and/o...

  • Page 82

    Function description symbol returns this state of the symbol (variable, literal, or bad). Conversion functions function description b2x returns a string, in character format, that represents the input binary string converted to hexadecimal. (binary to hexadecimal) c2d returns the decimal value of th...

  • Page 83

    Function description delword returns a string after deleting a specified number of words, starting at a specified word in the input string. 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 charac...

  • Page 84

    Function description 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. Date returns the date in the default format ( dd mon yyyy) or in on...

  • Page 85

    The user a message indicating the shortened name. Use the length and the substr built-in functions as described in z/os tso/e rexx reference. Answer possible solution /**************************** rexx *********************************/ /* this exec tests the length of a name for a data set member. ...

  • Page 86

    Built-in functions 68 z/os v1r1.0 tso/e rexx user’s guide.

  • Page 87

    Chapter 6. Writing subroutines and functions what are subroutines and functions? . . . . . . . . . . . . . . . . 69 when to write subroutines vs. Functions . . . . . . . . . . . . . . . 70 writing a subroutine . . . . . . . . . . . . . . . . . . . . . . . 70 passing information to a subroutine . . ....

  • Page 88

    A subroutine does not have to return a 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 v returning a value from a function a function must return a val...

  • Page 89

    Subroutines may be internal and designated by a label, or external and designated by the data set 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 e...

  • Page 90

    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 subr...

  • Page 91

    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 same control variable ...

  • Page 92

    Example without the procedure instruction /******************************* rexx ******************************/ /* this exec does not use a procedure instruction to protect the */ /* variables within its subroutine. */ /*******************************************************************/ number1 = 1...

  • Page 93

    The following exec sends information to an internal subroutine that computes the perimeter of a rectangle. The subroutine returns a value in the variable perim that is specified after the return instruction. The main exec receives the value in the special variable "result". Notice the positional rel...

  • Page 94

    Example - writing an internal and an 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 the en...

  • Page 95

    Possible solution (internal subroutine named check) check: /*******************************************************************/ /* 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 ...

  • Page 96

    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, argum...

  • Page 97

    To determine whether to make a function internal or external, you might consider factors, such as: v size of the function. Very large functions often are external, whereas small functions fit easily within the calling exec. V how you want to pass information. It is quicker to pass information throug...

  • Page 98

    Example of passing information in a variable /****************************** rexx *******************************/ /* this exec receives a calculated value from an internal */ /* function and displays that value. */ /*******************************************************************/ number1 = 5 nu...

  • Page 99

    The following two examples show the differing results when a function uses the procedure instruction and when it doesn’t. Example using the procedure instruction /****************************** rexx *******************************/ /* this exec uses a procedure instruction to protect the variables *...

  • Page 100

    Function(argument1,argument2,argument3,..........) using the arg instruction: the function can receive the arguments with the arg instruction. Arguments are also separated by commas in the arg instruction. Arg arg1,arg2,arg3 ....... The names of the arguments on the function call and the arg instruc...

  • Page 101

    Receiving information from a function although a function can receive up to 20 arguments in a function call, it can specify only one expression on the return instruction. That expression can be a: v number return 55 v one or more variables whose values are substituted or when no values were assigned...

  • Page 102

    Subroutines functions can be internal or external internal – can pass information by using common variables – can protect variables with the procedure instruction – can pass information by using arguments external – must pass information by using arguments – can use the arg instruction or the arg bu...

  • Page 103

    Chapter 7. Manipulating data using compound variables and stems . . . . . . . . . . . . . . . . 85 what is a compound variable? . . . . . . . . . . . . . . . . . . 85 using stems . . . . . . . . . . . . . . . . . . . . . . . . . 86 exercises - using compound variables and stems . . . . . . . . . 87 ...

  • Page 104

    First = 'fred' last = 'higgins' employee = first.Last /* employee is assigned first.Higgins */ say employee.First.Middle.Last /* displays employee.Fred.Middle.Higgins */ you can use a do loop to initialize a group of compound variables and set up an array. Do i = 1 to 6 say 'enter an employee name.'...

  • Page 105

    With the outtrap external function when trapping command output. For information about outtrap, see “using the outtrap function” on page 123. Exercises - using compound variables and stems 1. After these assignment instructions, what is displayed in the following say instructions? A = 3 /* assigns '...

  • Page 106

    Instructions that parse there are several rexx instructions and variations of instructions that parse data. Pull instruction in earlier chapters pull was described as an instruction that reads input from the terminal and assigns it to one or more variables. If however, the data stack contains inform...

  • Page 107

    Parse var instruction the parse var instruction parses a specified variable into one or more variable names that follow it. If the variable contains character information, it is not changed to uppercase. Quote = 'knowledge is power.' parse var quote word1 word2 word3 /* word1 contains 'knowledge' */...

  • Page 108

    A period in a template acts as a place holder. The data that corresponds to the period is not assigned to a variable name. You can use a period as a "dummy variable" within a group of variables or at the end of a template to collect unwanted information. Parse value 'value with periods in it.' with ...

  • Page 109

    Parse var quote 1 part1 =5 part2 /* part1 contains 'igno' */ /* part2 contains 'rance is bliss.' */ when a template has more than one number, and a number at the end of the template is lower than an earlier number, parse loops back to the beginning of the data. Quote = 'ignorance is bliss.' ....+......

  • Page 110

    You can define and use variables to provide further flexibility of a parse var instruction. Define the variable prior to the parse instruction, such as the movex variable in the following example. With the parse instruction, enclose the variable in parenthesis, in place of a number. This variable mu...

  • Page 111

    1. Quote = 'experience is the best teacher.' parse var quote word1 word2 word3 a) word1 = b) word2 = c) word3 = 2. Quote = 'experience is the best teacher.' parse var quote word1 word2 word3 word4 word5 word6 a) word1 = b) word2 = c) word3 = d) word4 = e) word5 = f) word6 = 3. Parse value 'experienc...

  • Page 112

    A) word1 = b) word2 = c) word3 = answers 1. A) word1 = experience b) word2 = is c) word3 = the best teacher. 2. A) word1 = experience b) word2 = is c) word3 = the d) word4 = best e) word5 = teacher. F) word6 = '' 3. A) word1 = experience b) word2 = is c) word3 = teacher. 4. A) v1 = expe b) v2 = rien...

  • Page 113: Part 2. Using Rexx

    Part 2. Using rexx in addition to being a versatile general-purpose programming language, rexx can interact with tso/e, mvs, appc/mvs, and ispf, which expands its capabilities. This part of the book is for programmers already familiar with the rexx language and experienced in tso/e. The chapters in ...

  • Page 114

    Tso) is available to the exec with some limitations. For more information about the tso/e environment service, limitations on the environment it creates, and the different considerations for running rexx execs within the environment, see z/os tso/e programming services. 96 z/os v1r1.0 tso/e rexx use...

  • Page 115

    Chapter 8. Entering commands from an exec types of commands . . . . . . . . . . . . . . . . . . . . . . . 97 issuing tso/e commands from an exec . . . . . . . . . . . . . . . 98 using quotations marks in commands . . . . . . . . . . . . . . . 98 passing data set names as arguments. . . . . . . . . ....

  • Page 116

    Issuing tso/e commands from an exec like a clist, a rexx exec can contain tso/e commands to be executed when the exec runs. An exec can consist of nothing but tso/e commands, such as an exec that sets up a user’s terminal environment by allocating the appropriate libraries of data sets, or the exec ...

  • Page 117

    A non fully-qualified data set name can eliminate the prefix and is not enclosed within quotation marks. Myrexx.Exec if you use the exec command to explicitly invoke an exec, the exec command processor requires a set of single quotation marks around the argument. When passing a non fully-qualified d...

  • Page 118

    Causing interactive commands to prompt the user if your tso/e profile allows prompting, when you issue an interactive command without operands, you are prompted for operands. For example, when you issue the listds command from ready, you are prompted for a data set name. Ready listds enter data set ...

  • Page 119

    Invoking another exec with the exec command to explicitly invoke another exec from within an exec, issue the exec command as you would any other tso/e command. The called exec should end with a return or exit instruction, ensuring that control returns to the caller. The rexx special variable rc is s...

  • Page 120

    When a rexx exec runs on a host system, there is at least one default environment available for executing commands. The default host command environments available in tso/e rexx are as follows: tso - the environment in which tso/e commands and tso/e rexx commands execute in the tso/e address space. ...

  • Page 121

    V cpicomm v lu62 v appcmvs from tso/e ready mode, tso/e rexx provides the following host command environments: v tso (the initial host command environment) v mvs v link v linkmvs v linkpgm v attach v attchmvs v attchpgm v console v cpicomm v lu62 v appcmvs in ispf, tso/e rexx provides the following ...

  • Page 122

    Appc/mvs host command environments the cpicomm environment enables you to invoke the saa cpi communications calls and the lu62 and appcmvs environments enable you to invoke appc/mvs calls. You can write transaction programs in the rexx language, using the lu62, cpicomm, or appcmvs host command envir...

  • Page 123

    V cmrts (request_to_send) v cmsct (set_conversation_type) v cmsdt (set_deallocate_type) v cmsed (set_error_direction) v cmsend (send_data) v cmserr (send_error) v cmsf (set_fill) v cmsld (set_log_data) v cmsmn (set_mode_name) v cmspln (set_partner_lu_name) v cmsptr (set_prepare_to_receive_type) v cm...

  • Page 124

    2 mvs sp4.3 service. For example, atbalc2 therefore, your z/os base control program (bcp) must be at least at the indicated level to take advantage of these services. The parameters for these services and the requirements for using them in appc/mvs transaction programs are described in z/os mvs prog...

  • Page 125

    When an address instruction includes only the name of the host command environment, all commands issued afterward within that exec are processed as that environment’s commands. Address ispexec /* change the host command environment to ispf*/ "edit dataset("dsname")" the address instruction affects o...

  • Page 126

    Address example 2 /****************************** rexx *******************************/ /* this exec must be run in ispf. It blanks out previous data set */ /* name information from the fields of an ispfpanel named newtool.*/ /* it then displays the panel to the user. */ /***************************...

  • Page 127

    Address example 3 /****************************** rexx *******************************/ /* this exec must be run in ispf. It displays panel named newtool */ /* and gets the name of a data set from input fields named ntproj, */ /* ntgroup, nttype, and ntmem. If no member name is specified (the*/ /* d...

  • Page 128

    Issuing other types of commands from an exec 110 z/os v1r1.0 tso/e rexx user’s guide.

  • Page 129

    Chapter 9. Diagnosing problems within an exec debugging execs . . . . . . . . . . . . . . . . . . . . . . . 111 tracing commands with the trace instruction . . . . . . . . . . . 111 trace c . . . . . . . . . . . . . . . . . . . . . . . . 111 trace e . . . . . . . . . . . . . . . . . . . . . . . . 11...

  • Page 130

    Missing data set name invalid keyword, ? *** if an exec includes "trace c" and again incorrectly issues the listds command, the exec displays the line number and the command, executes it, and displays the error message and the return code from the command, as follows: 3 *-* "listds ?" >>> "listds ?"...

  • Page 131

    The rc variable can be especially useful in an if instruction to determine which path an exec should take. 'alloc da('dsname') f(sysproc) shr reuse' ifrc \= 0 then call error1 else nop note: the value of rc is set by every command and might not remain the same for the duration of an exec. When using...

  • Page 132

    Starting interactive tracing you can start interactive tracing with either the ? Option of the trace instruction or with the tso/e executil ts command. When interactive tracing is initiated with the trace instruction, interactive tracing is not carried over into external routines that are called but...

  • Page 133

    Executil ts command: another way to start interactive tracing is to issue the executil ts (trace start) command or cause an attention interrupt and type ts. The type of interactive tracing begun is equivalent to that of the trace ?R instruction, except that tracing continues through all routines inv...

  • Page 134

    The type of tracing is the same as that initiated by issuing the executil ts command. Options within interactive trace when you are operating in the interactive debug facility, you have several options during the pauses that occur between each traced instruction. You can: v continue tracing by enter...

  • Page 135

    Trace off: the trace off instruction ends tracing as stated in the message displayed at the beginning of interactive trace. +++ interactive trace. Trace off to end debug, enter to continue. +++ you can enter the trace off instruction only during a pause while interactively tracing an exec. End the e...

  • Page 136

    Debugging execs 118 z/os v1r1.0 tso/e rexx user’s guide.

  • Page 137

    Chapter 10. Using tso/e external functions tso/e external functions . . . . . . . . . . . . . . . . . . . . 119 using the getmsg function . . . . . . . . . . . . . . . . . . 120 using the listdsi function . . . . . . . . . . . . . . . . . . 120 using the msg function . . . . . . . . . . . . . . . . ...

  • Page 138

    V syscpus - returns in a stem variable information about all cpus that are on-line. V sysdsn - returns ok if the specified data set exists; otherwise, it returns an appropriate error message. V sysvar - uses specific argument values to return information about the user, terminal, language, exec, sys...

  • Page 139

    X = listdsi('my.Data') /* x is set to a function code */ x = listdsi(my.Data) /* x is set to a function code */ when you specify a variable that was previously set to a data set name, do not enclose the variable in quotation marks. Quotation marks would prevent the data set name from being substitut...

  • Page 140

    Variable contents sysrefdate last referenced date: year/day format, for example: 1985/107 (specifying directory causes the date to be updated.) sysexdate expiration date: year/day format, for example: 1985/365 syspassword password indication: none, read, write sysracfa racf indication: none, generic...

  • Page 141

    Using the mvsvar function the mvsvar function retrieves information about mvs, tso/e, and the current session, such as the symbolic name of the mvs system, or the security label of the tso/e session. The information retrieved depends on the argument specified. To retrieve the information, use the mv...

  • Page 142

    Long as there is output. Output from the most recent command is placed after the previous command’s output. The total number of lines trapped is stored in var0. X = outtrap('var') "listc" say 'the number of lines trapped is' var0 to limit the number of lines of output saved, you can specify a limit,...

  • Page 143

    X = prompt() /* x is set to on or off */ the prompt function overrides the noprompt operand of the exec command, but it cannot override a noprompt operand in your tso/e profile. To display your profile, issue the profile command. To change a profile from noprompt to prompt, issue: profile prompt usi...

  • Page 144

    The setlang function can be used in rexx execs that run in any mvs address space. Using the storage function you can use the storage function to retrieve data from a particular address in storage. You can also use the storage function to place data into a particular address in storage. The storage f...

  • Page 145

    V invalid dataset name, data-set-name: v missing dataset name after a data set is available for use, you may find it useful to get more detailed information. For example, if you later need to invoke a service that requires a specific data set organization, then use the listdsi function. For a descri...

  • Page 146

    Proc = sysvar(sysproc) the sysvar function can be used only in rexx execs that run in the tso/e address space. Many of the sysvar arguments retrieve the same information as do clist control variables. The following tables divide the argument values into categories pertaining to user, terminal, langu...

  • Page 147

    Argument value description syshsm level of data facility hierarchical storage manager (dfhsm) installed sysjes name and level of jes installed syslracf level of racf installed sysracf whether racf is available sysnode network node name of the installation’s jes syssrv number of system resource manag...

  • Page 148

    Additional examples example 1 - using the listdsi and sysdsn functions /***************************** rexx ********************************/ /* this exec reallocates a data set with more space. It receives */ /* as arguments the names of a base data set and a new data set. */ /* it uses the sysdsn f...

  • Page 149

    Example 2 part 1 - using the outtrap function /**************************** rexx *********************************/ /* this exec adds a data set to the front of the data sets in the */ /* sysproc concatenation. It first asks for the name of the data */ /* set to add, then it finds all data sets curr...

  • Page 150

    Example 2 part 2 - using the outtrap function /*******************************************************************/ /* when sysproc is found, loop through data sets until another file*/ /* name is encountered or until all lines are processed. Append */ /* data set names to the one in variable "conca...

  • Page 151

    Example 3 - using the outtrap function /******************************* rexx ******************************/ /* this exec lists datasets allocated to a ddname that is passed */ /* as an argument when the exec is invoked. It uses the outtrap */ /* function to trap output from the lista status command...

  • Page 152

    V user packages — user-written external functions that are available to an individual. These functions are searched before other types of function packages and are often written to replace the other types of function packages. V local packages — application or system support functions that are gener...

  • Page 153

    Chapter 11. Storing information in the data stack what is a data stack? . . . . . . . . . . . . . . . . . . . . . 135 manipulating the data stack . . . . . . . . . . . . . . . . . . . 136 adding elements to the data stack . . . . . . . . . . . . . . . . 136 removing elements from the stack . . . . ....

  • Page 154

    As shown in the following figure, the data stack that rexx uses combines the techniques used in adding elements to stacks and queues. Elements can be placed on the top or the bottom of a data stack. Removal of elements from the data stack, however, occurs from the top of the stack only. Manipulating...

  • Page 155

    Note: some people find it less confusing when adding elements in a particular order to the data stack, to consistently use the same instruction, either push or queue, but not both. Removing elements from the stack to remove information from the data stack, use the pull and parse pull instructions, t...

  • Page 156

    Number = queued() do number pull element say element end exercise - using the data stack write an exec that puts the letters t, s, o, e on the data stack in such a way that they spell “tsoe” when removed. Use the queued built-in function and the pull and say instructions to help remove the letters a...

  • Page 157

    Possible solution 3 /******************************** rexx *****************************/ /* this exec uses the push and queue instructions to put t,s,o,e */ /* on the data stack. */ /*******************************************************************/ push 's' /***************************/ queue 'o...

  • Page 158

    Note: to prevent the language processor from searching the data stack, you can issue the parse external instruction instead of pull. Parse external gets input directly from the terminal and bypasses the data stack. V responses to commands a tso/e interactive command (such as listds, transmit, and al...

  • Page 159

    Example of using the data stack to pass information /***************************** rexx ********************************/ /* this exec helps an inexperienced user allocate a new pds. It */ /* prompts the user for the data set name and approximate size, */ /* and queues that information on the data s...

  • Page 160

    Passing information to interactive commands when your tso/e profile allows prompting, most tso/e commands prompt you for missing operands. For example, the transmit command prompts you for a node and user id when you do not include the destination with the command. An exec can put responses to comma...

  • Page 161

    Although the buffer does not prevent the pull instruction from accessing elements placed on the stack before the buffer was created, it is a way for an exec to create a temporary extension to the stack. The buffer allows an exec to: 1. Use the queue instruction to insert elements in fifo order on a ...

  • Page 162

    To prevent a routine from accessing elements below the buffer, you can use the queued built-in function as follows: olditems = queued() 'makebuf' push ... Queue ... Do while queued() > olditems /* total items > old number of items */ pull .... ... End 'dropbuf' dropping a buffer with the dropbuf com...

  • Page 163

    Qbuf returns the total number of buffers created, not just the ones created by a single exec. Thus if an exec issued two makebuf commands and called a routine that issued two more, when the routine issues a qbuf command, rc returns the total number of buffers created, which is four. Finding the numb...

  • Page 164

    Sub1: 'makebuf' return e. What is rc? Queue a 'makebuf' push b push c 'makebuf' push d 'qelem' say rc f. What is rc? Queue a queue b queue c 'qelem' say rc 2. Given the data stack below and the instructions that created it, what are the results of the subsequent instructions that follow? 'makebuf' q...

  • Page 165

    'dropbuf2' 'qbuf' say rc 'qelem' say rc say queued() answers 1. A. C b. B c. B (b was changed to uppercase because it was queued without quotes and pulled without parse.) d. 2 e. 1 f. 0 2. A. 4 b. 3 c. 0 d. 1, 1, 1 protecting elements in the data stack in certain environments, particularly mvs, wher...

  • Page 166

    To protect elements on the data stack, you can create a new data stack with the tso/e rexx newstack command. Read the next section to see how the exec in the previous example can safely issue an interactive tso/e command. To delete the new data stack and all elements in it, use the tso/e rexx delsta...

  • Page 167

    Example of using newstack with an interactive command exec1 push prompt1 push prompt2 call sub1 .. . Exit sub1: 'newstack' 'allocate' .. . Note: to have an interactive command prompt the user for input from the terminal, run an exec explicitly with the exec command and specify prompt or include the ...

  • Page 168

    Additional examples data stack example 1 /********************************* rexx ****************************/ /* this exec tests several of the stack functions to see how they */ /* work together. It uses the newstack and delstack commands, puts */ /* an element on the stack that exceeds 255 charac...

  • Page 169

    Data stack example 2 /******************************** rexx *****************************/ /* this exec runs another exec implicitly and then sends a message */ /* when the called exec finishes. It receives as an argument the */ /* name of a pds member to run. It activates the system procedure */ /*...

  • Page 170

    Protecting elements in the data stack 152 z/os v1r1.0 tso/e rexx user’s guide.

  • Page 171

    Chapter 12. Processing data and input/output processing types of processing . . . . . . . . . . . . . . . . . . . . . . 153 dynamic modification of a single rexx expression . . . . . . . . . . . 153 using the interpret instruction . . . . . . . . . . . . . . . . 153 using execio to process informati...

  • Page 172

    Answer = 5 + 5 interpret 'say' answer '"= 5 + 5"' /* displays 10 = 5 + 5 */ you can also group a number of instructions within a string, assign the string to a variable, and use the interpret instruction to execute the instructions assigned to the variable. Action = 'do 3; say "hello!"; end' interpr...

  • Page 173

    Default. If you use execio to read information from a data set and to a list of variables, the first data set line is stored in variable1, the second data set line is stored in variable2, and so on. Data read into a list of variables can be accessed randomly. After the information is in the data sta...

  • Page 174

    "execio 1 diskru ..." more about using diskru appears in “updating information in a data set” on page 162. How to access the data set: an i/o data set must first be allocated to a ddname. The ddname need not exist previously. In fact, it might be better to allocate it to a new ddname, such as myindd...

  • Page 175

    To avoid confusion as to whether a residual stem variable value is meaningful, you may want to clear the entire stem variable prior to entering the execio command. To clear all stem variables, you can either: – use the drop instruction as follows, which sets all stem variables to their uninitialized...

  • Page 176

    When you specify *, the execio command will continue to pull items off the data stack until it finds a null line. If the stack becomes empty before a null line is found, execio will prompt the terminal for input until the user enters a null line. Thus when you do not want to have terminal i/o, queue...

  • Page 177

    See execio example 6 under the heading figure 7 on page 168, which shows the usage of the execio command with stem variables. Return codes from execio after an execio command runs, it sets the rexx special variable "rc" to a return code. Valid return codes from execio are: return code meaning 0 norm...

  • Page 178

    Copying an entire data set "alloc da(my.Input) f(datain) shr reuse" "alloc da(new.Input) f(dataout) like(my.Input) new" "newstack" /* create a new data stack for input only */ "execio * diskr datain (finis" queue '' /* add a null line to indicate the end of the information */ "execio * diskw dataout...

  • Page 179

    Appending 5 lines of data to an existing data set "alloc da(weekly.Input(mar28)) f(myindd) shr reuse" "alloc da(yearly.Output) f(myoutdd) mod" "execio 5 diskr myindd (finis" "execio 5 diskw myoutdd (finis" note: do not use the mod attribute when allocating a member of a pds to which you want to appe...

  • Page 180

    Copying from compound variables "alloc da(new.Data) f(outdd) like(old.Data) new" "execio 10 diskw outdd (stem newvar." updating information in a data set you can update a single line of a data set with the execio command, or you can update multiple lines. Use the diskru form of the execio command to...

  • Page 181

    Updating multiple specific lines in a data set "alloc da('dept5.Employee.List') f(updatedd) old" "execio 1 diskru updatedd 2 (lifo" pull line push 'crandall, amy amy 5500' "execio 1 diskw updatedd" "execio 1 diskru updatedd 5 (lifo" pull line push 'leone, mary maryl 5530' "execio 1 diskw updatedd (f...

  • Page 182

    Execio example 1 /***************************** rexx ********************************/ /* this exec reads from the data set allocated to indd to find the */ /* first occurrence of the string "jones". Upper and lowercase */ /* distinctions are ignored. */ /********************************************...

  • Page 183

    Execio example 3 /**************************** rexx *********************************/ /* this exec reads five records from the data set allocated to */ /* myindd starting with the third record. It strips trailing blanks*/ /* from the records, and then writes any record that is longer than*/ /* 20 c...

  • Page 184

    Execio example 5 /**************************** rexx *********************************/ /* this exec illustrates the use of "execio 0 ..." to open, empty, */ /* or close a file. It reads records from file indd, allocated */ /* to 'sams.Input.Dataset', and writes selected records to file */ /* outdd, ...

  • Page 185

    Execio example 5 (continued) /****************************************************************/ /* since the outdd file is already open at this point, the */ /* following "execio 0 diskw ..." command will close the file, */ /* but will not empty it of the lines that have already been */ /* written. ...

  • Page 186

    Execio example 6 /***************************** rexx ********************************/ /* this exec uses execio to successively append the records from */ /* 'sample1.Data' and then from 'sample2.Data' to the end of the */ /* data set 'all.Sample.Data'. It illustrates the effect of */ /* residual da...

  • Page 187

    : execio example 6 (continued) ifrc = 0 then /* if write was successful */ do say say newvar.0 "records were written to 'all.Sample.Data'" end else do exec_rc = rc /* save exec return code */ say say "error during 1st execio ... Diskw, return code is " rc say end end else do exec_rc = rc /* save exe...

  • Page 188

    Execio example 6 (continued) say say say "-----------------------------------------------------" say newvar.0 "records have been read from 'sample2.Data': " say do i = 1 to newvar.0 /* loop through all records */ say newvar.I /* display the ith record */ end "execio" newvar.0 "diskw myoutdd (stem ne...

  • Page 189: Spaces

    Chapter 13. Using rexx in tso/e and other mvs address spaces services available to rexx execs . . . . . . . . . . . . . . . . . 171 running execs in a tso/e address space . . . . . . . . . . . . . . 173 running an exec in the foreground. . . . . . . . . . . . . . . . 173 things to consider when allo...

  • Page 190

    Service non-tso/e address space tso/e address space qbuf x x qelem x x qstack x x v other commands — execio — controls i/o processing x x executil — changes how an exec runs x immediate commands: hi (from attention mode only) x he (from attention mode only) x ht (from attention mode only) x rt (from...

  • Page 191

    Service non-tso/e address space tso/e address space v setlang — controls the language in which rexx messages are displayed x x v storage — retrieves and optionally changes the value in a storage address x x v syscpus — returns information about cpus that are online x x v sysdsn — returns information...

  • Page 192

    Things to consider when allocating to a system file (sysproc or sysexec) allocating a partitioned data set containing execs to a system file allows you to: v run execs implicitly - after a pds is allocated to a system file, you can run the exec by simply entering the member name, which requires fewe...

  • Page 193

    Running an exec from a clist a clist can invoke an exec with the exec command explicitly or implicitly. If it invokes an exec implicitly, the exec must be in a pds allocated to sysexec or sysproc. The clist that invokes the exec does not have to be allocated to sysproc. After the invoked exec and ot...

  • Page 194

    We are now in exec1. Exec2 speaking. The result from exec2 is a ok the result is 100% correct. The result from the execs is 100 sending a return code back to the calling clist: as demonstrated in the previous example, an exec can return a number to a clist with the exit instruction followed by the n...

  • Page 195

    Running an exec in the background is the same as running a clist in the background. The program ikjeft01 sets up a tso/e environment from which you can invoke execs and clists and issue tso/e commands. For example, to run an exec named setup contained in a partitioned data set userid.Myrexx.Exec, su...

  • Page 196

    You can also use an exec processing routine to invoke an exec in a tso/e address space. Two reasons to use them in tso/e are: v to pass more than one argument to an exec. When invoking an exec implicitly or explicitly, you can pass only one argument string. With irxexec, you can pass multiple argume...

  • Page 197

    Userid.Myrexx.Exec(jcltest) /****************************** rexx ******************************/ /* this exec receives input from its invocation in jcl.Exec, pulls*/ /* data from the input stream and sends back a condition code of */ /* 137. */ /******************************************************...

  • Page 198

    Segment of output from the jcl listing alloc. For userida mvsbach 224 allocated to outdd 954 allocated to systsprt 7e0 allocated to sysexec jes2 allocated to systsin userida mvsbach - step was executed - cond code 0137 userid.Trace.Output kept vol ser nos= tso032. Userid.Irxjcl.Output kept vol ser n...

  • Page 199

    Tso/e background (ikjeft01) mvs batch (irxjcl) messages are displayed in the output file. Messages may appear in two places; the jcl output listing and in the output file. To suppress messages in the output file, use the trace off instruction. Requirements tso/e background (ikjeft01) mvs batch (irxj...

  • Page 200

    For more information about defining language processor environments, see z/os tso/e rexx reference. Customizing a language processor environment an individual or an installation can customize a language processor environment in two ways: v change the values in the three default parameters modules, i...

  • Page 201: Part 3. Appendixes

    Part 3. Appendixes © copyright ibm corp. 1988, 2001 183.

  • Page 202

    184 z/os v1r1.0 tso/e rexx user’s guide.

  • Page 203

    Appendix a. Allocating data sets what is allocation? . . . . . . . . . . . . . . . . . . . . . . . 185 where to begin . . . . . . . . . . . . . . . . . . . . . . . . 186 preliminary checklist . . . . . . . . . . . . . . . . . . . . . . 186 checklist #1: creating and editing a data set using ispf/pdf...

  • Page 204

    Where to begin before creating a pds in which to store your execs, use the “preliminary checklist” to find out information that you can use to make your pds compatible with other pdss at your installation. Then create a pds with either “checklist #1: creating and editing a data set using ispf/pdf” o...

  • Page 205

    ______________________________________________ ______________________________________________ 3. Write down the names of the data sets at your installation that are allocated to sysproc. First data set: ______________________________________________ remaining data sets: _____________________________...

  • Page 206

    ------------------------ ispf/pdf primary option menu ------------------------- option ===> 3 userid - yourid 0 ispfparms - specify terminal and user parameters time - 12:47 1 browse - display source data or output listings terminal - 3277 2 edit - create or change source data pfkeys - 12 3 utilitie...

  • Page 207

    After you name the data set, a panel appears on which you define the attributes of the data set. Use the attributes recommended by your installation for rexx libraries, and include the record format (recfm), record length (lrecl), and block size (blksize) from the appropriate system file from the pr...

  • Page 208

    ------------------------------ edit - entry panel --------------------------- command ===> ispflibrary: project ===> userid group ===> rexx ===> ===> ===> type ===> exec member ===> timegame (blank for member selection list) other partitioned or sequential data set: data set name ===> volume serial ...

  • Page 209

    Allocate da(rexx.Exec) new dir(10) space(50,20) dsorg(po) recfm(v,b) lrecl(255) blksize(6120) for more information about the allocate command, see z/os tso/e rexx user’s guide and z/os tso/e command reference. 2. Edit a member of the newly created pds by selecting the ispf/pdf edit option (option 2)...

  • Page 210

    Allocation to sysexec completed. To have setup execute when you log on and automatically allocate your data set to sysexec, type the same exec command in the command field of your logon panel. ------------------------------- tso/e logon ---------------------------------- pf1/pf13 ==> help pf3/pf15 =...

  • Page 211

    Note: the order in which you list data sets in an allocate command is the order in which they are concatenated and searched. To give your execs priority in the search order, list your data set of execs before other data sets. Generally all the data sets in the list should have the same record format...

  • Page 212

    ------------------------------- tso/e logon ---------------------------------- pf1/pf13 ==> help pf3/pf15 ==> logoff pa1 ==> attention pa2 ==> reshow you may request specific help information by entering a '?' in any entry field. Enter logon parameters below: racflogon parameters: userid ===> yourid...

  • Page 213: Command

    Appendix b. Specifying alternate libraries with the altlib command specifying alternative exec libraries with the altlib command . . . . . . 195 using the altlib command . . . . . . . . . . . . . . . . . . 195 stacking altlib requests . . . . . . . . . . . . . . . . . . . 196 using altlib with ispf ...

  • Page 214

    2. At the application and system levels, altlib uses the virtual lookaside facility (vlf) to provide potential increases in library search speed. Stacking altlib requests on the application level, you can stack up to eight activate requests with the top, or current, request active. Application-level...

  • Page 215

    Appendix c. Comparisons between clist and rexx accessing system information . . . . . . . . . . . . . . . . . . . 198 controlling program flow . . . . . . . . . . . . . . . . . . . . 199 debugging . . . . . . . . . . . . . . . . . . . . . . . . . . 200 execution . . . . . . . . . . . . . . . . . . ....

  • Page 216

    Accessing system information clist rexx listdsi statement listdsi &baseds listdsi external function x = listdsi(baseds) &sysouttrap and &sysoutline set sysouttrap = 100 outtrap external function x = outtrap(var,100) control statement control prompt prompt external function x = prompt(on) &sysdsn bui...

  • Page 217

    Clist rexx control variables: for system information &sysappclu &sysdfp &sysmvs &sysname &sysseclab &syssmfid &syssms &sysclone &sysplex &syssymdef arguments of the mvsvar external function: for system information sysappclu sysdfp sysmvs sysname sysseclab syssmfid syssms sysclone sysplex symdef cont...

  • Page 218

    Clist rexx syscall statement .. . Syscall somesub var .. . End somesub: proc 1 var .. . Exit call instruction .. . Call sub1 var .. . Exit sub1: arg var .. . Return debugging clist rexx debugging a clist debugging an exec control symlist list conlist msg trace instruction trace i interactive debug f...

  • Page 219

    Clist rexx 1. Allocate/concatenate to sysproc 2. Specify member name of pds with or without % 1. Allocate/concatenate to sysproc or sysexec 2. Specify member name of pds with or without % interactive communication clist rexx reading from the terminal reading from the terminal read, readdval statemen...

  • Page 220

    Clist rexx syscall statement syscall somesub &var call instruction call somsub var sending information from a subprocedure sending information from a subroutine return statement .. . Syscall somesub &var set answer = &lastcc .. . End somesub: proc 1 v1 .. . Return code(33) /* code goes to &lastcc */...

  • Page 221

    Clist rexx separating statements within a line separating instructions within a line no more than one statement per line use ; do 5; say 'hello'; end character set of statements character set of instructions must be in uppercase can be upper, lower, or mixed case comments comments enclose between /*...

  • Page 222

    Using variables 204 z/os v1r1.0 tso/e rexx user’s guide.

  • Page 223: Appendix D. Notices

    Appendix d. Notices this information was developed for products and services offered in the u.S.A. Ibm may not offer the products, services, or features discussed in this document in other countries. Consult your local ibm representative for information on the products and services currently availab...

  • Page 224

    Licensees of this program who wish to have information about it for the purpose of enabling: (i) the exchange of information between independently created programs and other programs (including this one) and (ii) the mutual use of the information which has been exchanged, should contact: ibm corpora...

  • Page 225

    If you are viewing this information softcopy, the photographs and color illustrations may not appear. Programming interface information this book documents intended programming interfaces that allow the customer to write programs to obtain the services of z/os tso/e rexx language processor. Trademar...

  • Page 226

    208 z/os v1r1.0 tso/e rexx user’s guide.

  • Page 227: Bibliography

    Bibliography this section lists the books in the tso/e library and related publications. Tso/e publications tso/e publications v z/os tso/e administration, sa22-7780 v z/os tso/e clists, sa22-7781 v z/os tso/e command reference, sa22-7782 v z/os tso/e customization, sa22-7783 v z/os tso/e general in...

  • Page 228

    V z/os mvs data areas, vol 3 (ivt-rcwk), ga22-7583 v z/os mvs data areas, vol 4 (rd-srra), ga22-7584 v z/os mvs data areas, vol 5 (ssag-xtlst), ga22-7585 ispf publications v z/os ispf services guide, sc34-4819 v z/os ispf dialog developer’s guide and reference, sc34-4821 bibliography 210 z/os v1r1.0...

  • Page 230

    Checklist #3 - writing an exec to allocate to sysexec 191 checklist #4 - writing an exec to allocate to sysproc 192 clause as a subset of an instruction 13 clist comparison to rexx 197 invoking an exec 175 returning information to an exec 176 running from an exec 175 comma to continue an instruction...

  • Page 231

    Data stack (continued) protecting an element 147 removing an element 137 removing an element from a stack with a buffer 143 search order for processing 139 type of input 139 using in mvs batch 180 using in tso/e background 180 datatype built-in function 66 dbcs 14 ddname allocating to for i/o 156, 1...

  • Page 232

    External function tso/e description 119 getmsg 120 listdsi 120 msg 122 outtrap 123 prompt 124 setlang 125 storage 126 sysdsn 126 sysvar 127 external subroutine 71 f fifo (first in first out) 135 file 195 file i/o 154 foreground processing explicit execution 173 implicit execution 173 of an exec 173 ...

  • Page 233

    Input passing argument 24 preventing translation to uppercase 23 receiving with arg 22 receiving with pull 21 sending with exec command 22 to an exec preventing translation to uppercase 20, 23 using a period as a place holder 23 input/output (i/o) allocating a ddname 156, 158 reading from a data set...

  • Page 234

    Library (continued) sysexec 17, 174 sysproc 17, 174 system level 195 user-level 195 lifo (last in first out) 135 link host command environment 102 linkmvs host command environment 102 linkpgm host command environment 102 listalc status command 186 listds command 187 listdsi external function 120 lit...

  • Page 235

    Parsing (continued) template 89 partitioned data set creating in ispf/pdf 187 creating with allocate 190 description 185 for an exec 7 passing arguments 24 pds 7 period as place holder 23 portability of compiled rexx programs 6 prefix in a data set name 7, 98 preliminary checklist 186 procedure inst...

  • Page 236

    Rexx language (continued) description 3 example use of uppercase and lowercase xiv exec description xiii, 8 feature of 3 program (exec) xiii restructured extended executor xiii saa (systems application architecture) xiii, 4 rexx program portability of 6 rexx special variable rc for debugging 112 use...

  • Page 237

    System file (continued) sysexec 17, 174, 195 sysproc 14, 17, 174, 195 sysuexec 195 sysuproc 195 systems application architecture (saa) procedures language xiii systermid 129 systsoe 129 sysuexec 195 sysuid 128 sysuproc 195 sysvar external function 127 syswterm 128 t template 89 trace 116 trace instr...

  • Page 238

    220 z/os v1r1.0 tso/e rexx user’s guide.

  • Page 239

    Readers’ comments — we’d like to hear from you z/os tso/e rexx user’s guide publication no. Sa22-7791-00 overall, how satisfied are you with the information in this book? Very satisfied satisfied neutral dissatisfied very dissatisfied overall satisfaction h h h h h how satisfied are you that the inf...

  • Page 240: Business Reply Mail

    Readers’ comments — we’d like to hear from you sa22-7791-00 sa22-7791-00 cut or fold along line cut or fold along line fold and tape please do not staple fold and tape fold and tape please do not staple fold and tape no postage necessary if mailed in the united states business reply mail first-class...

  • Page 242

    Program number: 5694-a01 printed in the united states of america on recycled paper containing 10% recovered post-consumer fiber. Sa22-7791-00