background image

z/OS

TSO/E

REXX User’s Guide

SA22-7791-00

Summary of Contents for TSO/E REXX

Page 1: ...z OS TSO E REXX User s Guide SA22 7791 00 ...

Page 2: ......

Page 3: ...z OS TSO E REXX User s Guide SA22 7791 00 ...

Page 4: ...ie NY 12601 5400 United States of America FAX United States Canada 1 845 432 9405 FAX Other Countries Your International Access Code 1 845 432 9405 IBMLink United States customers only IBMUSM10 MHVRCFS Internet e mail mhvrcfs us ibm com World Wide Web http www ibm com servers eserver zseries zos webqs html If you would like a reply be sure to include your name address telephone number or FAX numbe...

Page 5: ...on 4 Benefits of Using a Compiler 5 Improved Performance 5 Reduced System Load 5 Protection for Source Code and Programs 6 Improved Productivity and Quality 6 Portability of Compiled Programs 6 SAA Compliance Checking 6 Chapter 2 Writing and Running a REXX Exec 7 Before You Begin 7 What is a REXX Exec 8 Syntax of REXX Instructions 9 The Character Type of REXX Instructions 9 The Format of REXX Inst...

Page 6: ...ructions 47 Repetitive Loops 47 Conditional Loops 52 Combining Types of Loops 55 Nested DO Loops 55 Using Interrupt Instructions 56 EXIT Instruction 57 CALL RETURN Instructions 57 SIGNAL Instruction 58 Chapter 5 Using Functions 61 What is a Function 61 Example of a Function 62 Built In Functions 63 Arithmetic Functions 63 Comparison Functions 63 Conversion Functions 64 Formatting Functions 64 Stri...

Page 7: ... 112 Tracing with the Interactive Debug Facility 113 Chapter 10 Using TSO E External Functions 119 TSO E External Functions 119 Using the GETMSG Function 120 Using the LISTDSI Function 120 Using the MSG Function 122 Using the MVSVAR Function 123 Using the OUTTRAP Function 123 Using the PROMPT Function 124 Using the SETLANG Function 125 Using the STORAGE Function 126 Using the SYSCPUS Function 126 ...

Page 8: ...6 Running Execs in a Non TSO E Address Space 177 Using an Exec Processing Routine to Invoke an Exec from a Program 177 Using IRXJCL to Run an Exec in MVS Batch 178 Using the Data Stack in TSO E Background and MVS Batch 180 Summary of TSO E Background and MVS Batch 180 CAPABILITIES 180 REQUIREMENTS 181 Defining Language Processor Environments 181 What is a Language Processor Environment 181 Customi...

Page 9: ...nication 201 Passing Information 201 Performing File I O 202 Syntax 202 Using Functions 203 Using Variables 203 Appendix D Notices 205 Programming Interface Information 207 Trademarks 207 Bibliography 209 TSO E Publications 209 Related Publications 209 Index 211 Contents vii ...

Page 10: ...viii z OS V1R1 0 TSO E REXX User s Guide ...

Page 11: ...IO Example 2 164 3 EXECIO Example 3 165 4 EXECIO Example 4 165 5 EXECIO Example 5 166 6 EXECIO Example 5 continued 167 7 EXECIO Example 6 168 8 EXECIO Example 6 continued 169 9 EXECIO Example 6 continued 170 Copyright IBM Corp 1988 2001 ix ...

Page 12: ...x z OS V1R1 0 TSO E REXX User s Guide ...

Page 13: ...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: ...liar with the REXX language and experienced with the workings of TSO E It describes more complex aspects of the REXX language and how they work in TSO E as well as in other MVS address spaces If you are a new programmer you might want to concentrate on the first part If you are an experienced TSO E programmer you might want to read the first part and concentrate on the second part How This Book Is...

Page 16: ...ds with certain words in uppercase and others in lowercase Exercises Periodically you will find sections with exercises you can do to test your understanding of the information Answers to the exercises are included when appropriate Where to Find More Information Please see z OS Information Roadmap for an overview of the documentation associated with z OS including the documentation available for z...

Page 17: ... search because LookAt goes directly to the explanation LookAt can be accessed from the Internet or from a TSO command line You can use LookAt on the Internet at http www ibm com servers eserver zseries zos bkserv lookat lookat html To use LookAt as a TSO command LookAt must be installed on your host system You can obtain the LookAt code for TSO from the LookAt Web site by clicking on News and Hel...

Page 18: ...xvi z OS V1R1 0 TSO E REXX User s Guide ...

Page 19: ...ou want to write execs that run outside of a TSO E address space keep in mind the following exceptions to information in Part 1 v An exec that runs outside of TSO E cannot include TSO E commands unless you use the TSO E environment service see note v In TSO E several REXX instructions either display information on the terminal or retrieve information that the user enters at the terminal In a non T...

Page 20: ...2 z OS V1R1 0 TSO E REXX User s Guide ...

Page 21: ...l capabilities it is also suitable for more experienced computer professionals The TSO E implementation of the REXX language allows REXX execs to run in any MVS address space You can write a REXX exec that includes TSO E services and run it in a TSO E address space or you can write an application in REXX to run outside of a TSO E address space For more information see Chapter 13 Using REXX in TSO ...

Page 22: ... includes extensive parsing capabilities for character manipulation This parsing capability allows you to set up a pattern to separate characters numbers and mixed input Components of REXX The various components of REXX are what make it a powerful tool for programmers REXX is made up of v Instructions There are five types of instructions All but commands are processed by the language processor Key...

Page 23: ... for programmers during program development and for users when a program is run The benefits are v Improved performance v Reduced system load v Protection for source code and programs v Improved productivity and quality v Portability of compiled programs v Checking for compliance to SAA Improved Performance The performance improvements that you can expect when you run compiled REXX programs depend...

Page 24: ... Portability of Compiled Programs A REXX program compiled under MVS ESA can run under CMS Similarly a REXX program compiled under CMS can run under MVS ESA SAA Compliance Checking The Systems Application Architecture SAA definitions of software interfaces conventions and protocols provide a framework for designing and developing applications that are consistent within and across several operating ...

Page 25: ... Specifying Values when Invoking an Exec 22 Specifying Too Few Values 22 Specifying Too Many Values 22 Preventing Translation of Input to Uppercase 23 Exercises Using the ARG Instruction 23 Passing Arguments 24 Passing Arguments Using the CALL Instruction or REXX Function Call 24 Passing Arguments Using the EXEC Command 24 This chapter introduces execs and their syntax describes the steps involved...

Page 26: ...e to identify the program as a REXX exec A comment begins with and ends with To prevent incompatibilities with CLISTs IBM recommends that all REXX execs start with a comment that includes the characters REXX within the first line line 1 of the exec Failure to do so can lead to unexpected or unintended results in your REXX exec More about comments and why you might need a REXX exec identifier appea...

Page 27: ...rdless of where it begins or where it ends The Character Type of REXX Instructions You can enter a REXX instruction in lowercase uppercase or mixed case However alphabetic characters are changed to uppercase unless you enclose them in single or double quotation marks Using Quotation Marks in an Instruction A series of characters enclosed in matching quotation marks is called a literal string The f...

Page 28: ...ted A semicolon indicates the end of the instruction and is used to separate multiple instructions on one line Beginning an instruction An instruction can begin in any column on any line The following are all valid instructions SAY This is a literal string SAY This is a literal string SAY This is a literal string This example appears on the screen as follows This is a literal string This is a lite...

Page 29: ...t when displayed on the screen SAY This is a string is functionally identical to SAY This is a string These examples appear on the screen as This isa string In the first example the concatenation operator at the end of line 1 causes the deletion of any spaces when the two lines are concatenated for display In the second example the concatenation operator also concatenates the two strings without s...

Page 30: ...d you can insert extra spaces between words in an instruction because the language processor ignores blank lines and spaces that are greater than one This flexibility of format allows you to insert blank lines and spaces to make an exec easier to read Only when words are parsed do blanks and spaces take on significance More about parsing is covered in Parsing Data on page 87 Types of REXX Instruct...

Page 31: ...tion If the expression that follows the IF keyword is true the instruction that follows the THEN keyword is processed Otherwise the instruction that follows the ELSE keyword is processed If more than one instruction follows a THEN or an ELSE the instructions are preceded by a DO line 14 and followed by an END line 17 More information about the IF THEN ELSE instruction appears in Using Conditional ...

Page 32: ... comment that includes the characters REXX within the first line line 1 of the exec Failure to do so can lead to unexpected or unintended results in your REXX exec This type of comment is called the REXX exec identifier and immediately identifies the program to readers as a REXX exec and also distinguishes it from a CLIST It is necessary to distinguish execs from CLISTs when they are both stored i...

Page 33: ...ariable s value SAY Value of the DBCS variable is S Y D M END EXIT 0 Example 2 The following example shows some other uses of DBCS variable names with the EXECIO stem option as DBCS parameters passed to a program invoked through LINKMVS and with built in function LENGTH REXX OPTIONS ETMODE ETMODE to enable DBCS variable names ALLOC FI INDD DA DEPTA29 DATA SHR REU Use EXECIO to read lines into DBCS...

Page 34: ... You can specify a data set name according to the TSO E data set naming conventions in several different ways For example the data set name USERID REXX EXEC TIMEGAME can be specified as v A fully qualified data set which appears within quotation marks EXEC userid rexx exec timegame exec v A non fully qualified data set which has no quotation marks can eliminate your profile prefix usually your use...

Page 35: ...n might have changed the name to something other than SYSEXEC but for the purposes of this book we will call it SYSEXEC When both system files are available SYSEXEC is searched before SYSPROC Allocating a PDS to a System File To allocate the PDS that contains your execs to a system file you need to do the following v Decide if you want to use the separate file for execs SYSEXEC or combine CLISTs a...

Page 36: ...de the member name with a READY timegame When a member name is preceded by TSO E searches a limited number of system files for the name thus reducing the search time Without the TSO E searches several files before it searches SYSEXEC and SYSPROC to ensure that the name you entered is not a TSO E command Exercises Running the Example Execs Create a PDS exec library using Checklist 1 or Checklist 2 ...

Page 37: ...the error a missing at the end of the comment As a result the SAY instruction displays the question but doesn t wait for your response because the next line of the exec contains the syntax error The exec ends and the language processor displays error messages The first error message begins with the line number of the statement where the error was detected followed by three pluses and the contents ...

Page 38: ...mation from within an exec is processed exactly as typed This is important in the following situations v For output when it must be lowercase or a mixture of uppercase and lowercase v To ensure that commands are processed correctly For example if a variable name in an exec is the same as a command name the exec ends in error when the command is issued It is good programming practice to avoid using...

Page 39: ... invoking the exec Using Terminal Interaction The PULL instruction is one way for an exec to receive input as shown by a previous example repeated here Example of an Exec that Uses PULL REXX This exec adds two numbers and displays their sum SAY Please enter a number PULL number1 SAY Now enter a number to add to the first number PULL number2 sum number1 number2 SAY The sum of the two numbers is sum...

Page 40: ...sum ARG number1 number2 sum number1 number2 SAY The sum of the two numbers is sum ARG assigns the first number 42 to number1 and the second number 21 to number2 If the number of values is fewer or more than the number of variable names after the PULL or the ARG instruction errors can occur as described in the following sections Specifying Too Few Values When you specify fewer values than the numbe...

Page 41: ...habetic characters to uppercase To prevent translation to uppercase precede ARG with PARSE as demonstrated in the following example Example of an Exec that Uses PARSE ARG REXX This exec receives the last name first name and score of a student and displays a sentence reporting the name and score PARSE ARG lastname firstname score SAY firstname lastname received a score of score Exercises Using the ...

Page 42: ...sing the EXEC command special consideration must be given For example if you specify GETARG 1 2 or ex sam rexx exec getarg 1 2 the exec receives a single argument string consisting of 1 2 The exec could then use a PARSE ARG instruction to break the argument string into the comma separated values like the following PARSE ARG A B SAY A is A Will say A is 1 SAY B is B Will say B is 2 However because ...

Page 43: ...pects of computer programming is the ability to process variable data to achieve a result The variable data could be as simple as two numbers the process could be subtraction and the result could be the answer answer number1 number2 Or the variable data could be input to a series of complex mathematical computations that result in a 3 dimensional animated figure Regardless of the complexity of a p...

Page 44: ...een 5 Variable names can consist of A Z uppercase alphabetic a z lowercase alphabetic 0 9 numbers _ special characters X 41 X FE double byte character set DBCS characters ETMODE must be on for these characters to be valid in a variable name Restrictions on the variable name are v The first character cannot be 0 through 9 or a period v The variable name cannot exceed 250 bytes For names containing ...

Page 45: ...r variable such as variable1 variable2 In the above example variable1 changes to the value of variable2 but variable2 remains the same v An expression which is something that needs to be calculated such as variable2 12 12 6 variable2 becomes 23 4 Before a variable is assigned a value the variable displays the value of its own name translated to uppercase In the following example if the variable ne...

Page 46: ...fault before and after the decimal Examples of decimal numbers are 123456 789 0 888888888 1 25E2 A floating point number in exponential notation is sometimes called scientific notation The number after the E represents the number of places the decimal point moves Thus 1 25E2 also written as 1 25E 2 moves the decimal point to the right two places and results in 125 When an E is followed by a minus ...

Page 47: ...rator in an arithmetic expression the order of numbers and operators can be critical For example in the following expression which operation does the language processor perform first 7 2 9 3 1 Proceeding from left to right it is evaluated as follows v Expressions within parentheses are evaluated first v Expressions with operators of higher priority are evaluated before expressions with operators o...

Page 48: ...x to cost price total 100 5 1 100 Round and remove extra decimal places SAY Your total cost is price Exercises Calculating Arithmetic Expressions 1 What will the following program display on the screen Exercise REXX pa 1 ma 1 kids 3 SAY There are pa ma kids people in this family 2 What is the value of a 6 4 1 b 6 4 1 c 6 4 2 d 6 4 2 e 24 5 2 ANSWERS 1 There are 5 people in this family 2 The values...

Page 49: ...h the backslash The two characters may be used interchangeably according to availability and personal preference This book uses the backslash character The Strictly Equal and Equal Operators 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 The foll...

Page 50: ...nd to the prompts with the following lunch costs Yesterday s Lunch Today s Lunch 4 42 3 75 3 50 3 50 3 75 4 42 2 What is the result 0 or 1 of the following expressions a Apples Oranges b Apples Apples c Apples Apples d 100 1E2 e 100 1E2 f 100 1E2 ANSWERS 1 The following sentences appear a Today s lunch cost the same or less than yesterday s b Today s lunch cost the same or less than yesterday s c ...

Page 51: ... Logical Expressions Logical expressions are used in complex conditional instructions and can act as checkpoints to screen unwanted conditions When you have a series of logical expressions for clarification use one or more sets of parentheses to enclose each expression IF A B J D M Q M D THEN The following example uses logical operators to make a decision Example Using Logical Expressions REXX Thi...

Page 52: ...________________ true Concatenation Operators Concatenation operators combine two terms into one The terms can be strings variables expressions or constants Concatenation can be significant in formatting output The operators that indicate how to join two terms are as follows Operator Meaning blank Concatenate terms and place one blank in between Terms that are separated by more than one blank defa...

Page 53: ...an overall priority that includes all operators The priority of operators is as follows with the highest first Overall Operator Priority or Prefix operators Power exponential Multiply and divide Add and subtract blank abuttal Concatenation operators etc Comparison operators Logical AND Inclusive OR and exclusive OR Thus the previous example presented again below IF A 7 B B 3 A B C THEN given the f...

Page 54: ... parentheses were removed from the student s formula what would be the outcome for the college IF inexpensive scholarship reputable nearby THEN SAY I ll consider it ELSE SAY Forget it Remember the college is inexpensive did not offer a scholarship is reputable but is 1000 miles away ANSWERS 1 The results are as follows a 34 22 12 34 b 1 true 3 3 1 c 32 20 2 15 1 2 I ll consider it The operator has...

Page 55: ...two terms The following example uses the TRACE I instruction EDIT USERID REXX EXEC SAMPLE COLUMNS 009 080 COMMAND SCROLL HALF TOP OF DATA 000001 REXX 000002 This exec uses the TRACE instruction to show how an 000003 expression is evaluated operation by operation 000004 000005 x 9 000006 y 2 000007 TRACE I 000008 000009 IF x 1 5 y THEN 000010 SAY x is big enough 000011 ELSE NOP No operation on the ...

Page 56: ...types of tracing For information about the other types of tracing with the TRACE instruction see z OS TSO E REXX Reference Exercises Using the TRACE Instruction Write an exec with a complex expression such as IF A B C 2 D THEN Define A B C and D in the exec and use the TRACE I instruction ANSWER Possible Solution REXX This exec uses the TRACE instruction to show how an expression is evaluated oper...

Page 57: ... V 3 L 2 V 4 O 8 O 1 O 1 THEN 13 SAY At least one expression was true L At least one expression was true At least one expression was true Tracing Expressions with the TRACE Instruction Chapter 3 Using Variables and Expressions 39 ...

Page 58: ...Tracing Expressions with the TRACE Instruction 40 z OS V1R1 0 TSO E REXX User s Guide ...

Page 59: ...exec runs one instruction after another executes starting with the first and ending with the last The language processor unless told otherwise executes instructions sequentially You can alter the order of execution within an exec by using specific REXX instructions that cause the language processor to skip some instructions repeat others or jump to another part of the exec These specific REXX inst...

Page 60: ...art this appears as follows As a REXX instruction the flowchart example looks like IF expression THEN instruction ELSE instruction You can also arrange the clauses in one of the following ways to enhance readability IF expression THEN instruction ELSE instruction or IF expression THEN instruction ELSE instruction When you put the entire instruction on one line you must separate the THEN clause fro...

Page 61: ... lovely day IF tenniscourt free THEN SAY Shall we play tennis ELSE NOP END ELSE SAY Shall we take our raincoats Not matching nested IFs to ELSEs and DOs to ENDs can have some surprising results If you eliminate the DOs and ENDs and the ELSE NOP as in the following example what is the outcome Example of Missing Instructions REXX This exec demonstrates what can happen when you do not include DOs END...

Page 62: ...ELSE IF B 2 THEN IF C 3 THEN A 1 ELSE A 3 ELSE NOP SELECT WHEN OTHERWISE END Instruction To select one of any number of choices use the SELECT WHEN OTHERWISE END instruction In a flowchart it appears as follows False False False True True True IF A 0 A 3 B 2 C 3 A 1 C 2 False True B 1 IF IF IF Using Conditional Instructions 44 z OS V1R1 0 TSO E REXX User s Guide ...

Page 63: ...ight also be true If no WHEN expressions are true it processes the instructions following the OTHERWISE clause As with the IF THEN ELSE instruction when you have 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 SELECT WHEN False WHEN False WH...

Page 64: ...NAGER OTHERWISE IF sex M THEN man 20 or older status MAN ELSE woman 20 or older status WOMAN END SAY This person should be counted as a status Each SELECT must end with an END Indenting each WHEN makes an exec easier to read Exercises Using the SELECT WHEN OTHERWISE END Instruction Thirty days hath September April June and November all the rest have thirty one save February alone Write an exec tha...

Page 65: ...ops and conditional loops Repetitive loops allow you to repeat instructions a certain number of times and conditional loops use a condition to control repeating All loops regardless of the type begin with the DO keyword and end with the END keyword Repetitive Loops The simplest loop tells the language processor to repeat a group of instructions a specific number of times using a constant following...

Page 66: ...ble with the keyword BY as follows DO number 1 TO 10 BY 2 SAY Loop number SAY Hello END SAY Dropped out of the loop when number reached number This example has results similar to the previous example except the loops are numbered in increments of two Loop 1 Hello Loop 3 Hello Loop 5 Hello Loop 7 Hello Loop 9 Hello Dropped out of the loop when number reached 11 Infinite Loops What happens when the ...

Page 67: ...ll not stop myfunct However pressing the attention interrupt key and then entering HE will stop the function and the exec EXEC1 that called it HE does not automatically stop any exec that called EXEC1 unless you are running under ISPF For more information about the HE condition see z OS TSO E REXX Reference Note HE does not alter the halt condition which is raised by HI If you entered HI before yo...

Page 68: ...he END keyword of the loop An example of using the LEAVE instruction follows Example Using the LEAVE Instruction REXX This exec uses the LEAVE instruction to exit from a DO FOREVER loop that sends data sets to the printer DO FOREVER SAY Enter the name of the next data set SAY When there are no more data sets enter QUIT PULL dataset_name IF dataset_name QUIT THEN LEAVE ELSE DO PRINTDS DA dataset_na...

Page 69: ... 2 Sometimes an infinite loop can occur when input to end the loop doesn t match what is expected For instance in the previous example using the LEAVE Instruction on page 50 what happens when the user enters Quit and the PULL instruction is changed to a PARSE PULL instruction PARSE PULL dataset_name ANSWERS 1 The results of the repetitive loops are as follows a 1 2 3 Digit is now 4 b 10 8 6 Count ...

Page 70: ...a condition is true DO WHILE tests the condition at the top of the loop If the condition is initially false the loop is never executed You can use a DO WHILE loop instead of the DO FOREVER loop in the example using the LEAVE Instruction on page 50 However you need to initialize the loop with a first case so the condition can be tested before you get into the loop Notice the first case initializati...

Page 71: ...ats to 0 passenger 0 Initialize passengers to 0 DO WHILE passenger 8 window_seats 4 Continue while you have not questioned all 8 passengers and while all the window seats are not taken SAY Do you want a window seat Please answer Y or N PULL answer passenger passenger 1 Increase the number of passengers by 1 IF answer Y THEN window_seats window_seats 1 Increase the number of window seats by 1 ELSE ...

Page 72: ... to a DO UNTIL loop and achieve the same results Remember that DO WHILE loops check for true expressions and DO UNTIL loops check for false expressions which means their logical operators are often reversed ANSWER Possible Solution REXX This exec uses a DO UNTIL loop to keep track of window seats in an 8 seat commuter airline window_seats 0 Initialize window seats to 0 passenger 0 Initialize passe...

Page 73: ...antity number SAY Quantity quantity Loop number END Nested DO Loops Like nested IF THEN ELSE instructions DO loops can also be within other DO loops A simple example follows DO outer 1 TO 2 DO inner 1 TO 2 SAY HIP END SAY HURRAH END The output from this example is HIP HIP HURRAH HIP HIP HURRAH If you need to leave a loop when a certain condition arises use the LEAVE instruction followed by the con...

Page 74: ... outer Inner inner END END ANSWERS 1 When this example runs you see on your screen the following Outer 1 Inner 1 Outer 1 Inner 2 Outer 1 Inner 3 Outer 2 Inner 1 Outer 2 Inner 2 Outer 2 Inner 3 Outer 3 Inner 1 Outer 3 Inner 2 Outer 3 Inner 3 2 The result is one line of output for each of the inner loops Outer 1 Inner 1 Outer 2 Inner 1 Outer 3 Inner 1 Using Interrupt Instructions Instructions that i...

Page 75: ...EXX This exec uses the EXIT instruction to end the exec and return a value that indicates whether or not a job applicant gets the job A value of 0 means the applicant does not qualify for the job but a value of 1 means the applicant gets the job The value is placed in the REXX special variable RESULT SAY How many months of experience do you have Please enter SAY the months as a number PULL month S...

Page 76: ...l to which control passes can appear before or after the SIGNAL instruction Unlike CALL SIGNAL does not return to a specific instruction to resume execution When you use SIGNAL from within a loop the loop automatically ends and when you use SIGNAL from an internal routine the internal routine will not return to its caller In the following example if the expression is true then the language process...

Page 77: ...SIGNAL does not provide a way to return as does the CALL instruction described in CALL RETURN Instructions on page 57 For more information about the SIGNAL instruction see page 113 and z OS TSO E REXX Reference IF expression THEN SIGNAL Emergency ELSE instruction s Emergency instruction s Using Interrupt Instructions Chapter 4 Controlling the Flow Within an Exec 59 ...

Page 78: ...60 z OS V1R1 0 TSO E REXX User s Guide ...

Page 79: ... external function is a self contained program or exec outside of the calling exec More information about user written functions appears in Writing a Function on page 77 v Function packages These are groups of functions and subroutines written by an individual user or supplied by an installation They are link edited into load modules and categorized as user local and system TSO E external function...

Page 80: ...n a group of three numbers might be written as follows Finding a Maximum Number REXX This exec receives three numbers from a user and analyzes which number is the greatest PARSE ARG number1 number2 number3 IF number1 number2 THEN IF number1 number3 THEN greatest number1 ELSE greatest number3 ELSE IF number2 number3 THEN greatest number2 ELSE greatest number3 RETURN greatest Rather than writing mul...

Page 81: ...cription of these functions see z OS TSO E REXX Reference Arithmetic Functions Function Description 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 specified formatted according to the current NUMERIC ...

Page 82: ... decimal representation of the input hexadecimal string Hexadecimal to Decimal Formatting Functions Function Description 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 forma...

Page 83: ...he 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 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...

Page 84: ...codes in ascending order between and including specified starting and ending values Indicates a non SAA built in function provided only by TSO E Testing Input with Built In Functions Some of the built in functions provide a convenient way to test input When an interactive exec requests input the user might respond with input that is not valid For instance in the example Using Comparison Expression...

Page 85: ...ger than 8 characters the exec truncates the extra characters and sends the user a message indicating the shortened member name SAY Please enter a member name PULL membername IF LENGTH membername 8 THEN Name is longer than 8 characters DO membername SUBSTR membername 1 8 Shorten the name to the first 8 characters SAY The member name you entered was too long SAY membername will be used END ELSE NOP...

Page 86: ...Built In Functions 68 z OS V1R1 0 TSO E REXX User s Guide ...

Page 87: ...e or more execs In order for an exec to call the routine the exec and the routine must be allocated to a system file for example SYSEXEC or SYSPROC or be in the same PDS For more information about allocating to a system file see Appendix A Allocating Data Sets on page 185 In many aspects subroutines and functions are the same yet they are different in a few major aspects such as the way they are c...

Page 88: ...rten a word to its first eight characters x SUBSTR verylongword 1 8 x is set to verylong As a subroutine you would get the same results with the following instructions CALL SUBSTR verylongword 1 8 x is set to verylong x RESULT When deciding whether to write a subroutine or a function ask yourself the following questions v Is a returned value optional If so write a subroutine v Do I need a value re...

Page 89: ...nternal or external you might consider factors such as v Size of the subroutine Very large subroutines often are external whereas small subroutines fit easily within the calling exec v How you want to pass information It is quicker to pass information through variables in an internal subroutine This method is described in Passing Information by Using Variables on page 72 v Whether the subroutine m...

Page 90: ...the main part of the exec or in the subroutine In the following example the value of answer is assigned in the subroutine and displayed in the main part of the exec The variables number1 number2 and answer are shared Example of Passing Information in a Variable REXX This exec receives a calculated value from an internal subroutine and displays that value number1 5 number2 10 CALL subroutine SAY an...

Page 91: ...truction as described in Passing Information by Using Arguments on page 74 Protecting Variables with the PROCEDURE Instruction When you use the PROCEDURE instruction immediately after the subroutine label all variables used in the subroutine become local to the subroutine and are shielded from the main part of the exec You can also use the PROCEDURE EXPOSE instruction to protect all but a few spec...

Page 92: ...TURN For more information about the PROCEDURE instruction see z OS TSO E REXX Reference Passing Information by Using Arguments A way to pass information to either internal or external subroutines is through arguments You can pass up to 20 arguments separated by commas on the CALL instruction as follows CALL subroutine_name argument1 argument2 argument3 Using the ARG Instruction The subroutine can ...

Page 93: ...h width ARG 2 puts the second argument into width More information about the ARG function appears in z OS TSO E REXX Reference Receiving Information from a Subroutine Although a subroutine can receive up to 20 arguments it can specify only one expression on the RETURN instruction That expression can be v A number RETURN 55 v One or more variables whose values are substituted or when no values were...

Page 94: ... a simulated coin toss game between the computer and a user The user enters heads tails or quit The user is first checked for validity in an internal subroutine An external subroutine uses the RANDOM build in function to obtain a simulation of a throw of dice and compares the user input to the random outcome The main exec receives notification of who won the round Scores are maintained and display...

Page 95: ...l subroutine receives the valid input from the user analyzes it gets a random throw from the computer and compares the two values If they are the same the user wins If they are different the computer wins The outcome is then returned to the calling exec ARG input IF input HEADS THEN userthrow 0 heads 0 ELSE userthrow 1 tails 1 compthrow RANDOM 0 1 choose a random number between 0 and 1 IF compthro...

Page 96: ...unctions may be internal and designated by a label or external and designated by the data set member name that contains the function The previous example illustrates an internal function named func1 IMPORTANT NOTE Because internal functions generally appear after the main part of the exec when you have an internal function it is important to end the main part of the exec with the EXIT instruction ...

Page 97: ...al function share the same variables you can use commonly shared variables to pass information between caller and internal function The function does not need to pass arguments within the parentheses that follow the function call However all functions both internal and external must return a value Passing Information by Using Variables When an exec and its internal function share the same variable...

Page 98: ...o call an internal function A problem occurs because the function also uses a DO loop with the same control variable as the main exec The DO loop in the main exec repeats only once number1 5 number2 10 DO i 1 TO 5 SAY add Displays 105 END EXIT add DO i 1 TO 5 answer number1 number2 number1 number2 number2 answer END RETURN answer To avoid this kind of problem in an internal function you can use v ...

Page 99: ...iables with PROCEDURE EXPOSE To protect all but specific variables use the EXPOSE option with the PROCEDURE instruction followed by the variables that are to remain exposed to the function Example Using PROCEDURE EXPOSE REXX This exec uses a PROCEDURE instruction with the EXPOSE option to expose one variable number1 in its function number1 10 SAY pass number1 displays 5 7 EXIT pass PROCEDURE EXPOS...

Page 100: ...al relationships between long and length and wide and width Also notice that information is received from variable perim to replace the function call Using the ARG Built in Function Another way for a function to receive arguments is with the ARG built in function This built in function returns the value of a particular argument specified by a number that represents the argument position For instan...

Page 101: ...d WORD built in functions For more information about these built in functions see z OS TSO E REXX Reference ANSWER Possible Solution REXX This function receives a list of numbers adds them computes their average and returns the average to the calling exec ARG numlist receive the numbers in a single variable sum 0 initialize sum to zero DO n 1 TO WORDS numlist Repeat for as many times as there are ...

Page 102: ...iables 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 built in function to receive arguments Uses the RETURN instruction to return to the caller Uses the RETURN instruction to return to the caller Might return a value to the caller Must return a value to the caller...

Page 103: ...ore dimensions identified by a single name You could have an array called employee that contains names as follows EMPLOYEE 1 Adams Joe 2 Crandall Amy 3 Devon David 4 Garrison Donna 5 Leone Mary 6 Sebastian Isaac In some computer languages you access an element in the array by the number of the element such as employee 1 which retrieves Adams Joe In REXX you use compound variables What is a Compoun...

Page 104: ...ialize an entire collection of variables to the same value You can do this easily with a stem A stem is the first variable name and first period of the compound variable Thus every compound variable begins with a stem The following are stems FRED Array employee You can alter all the compound variables in an array through the stem For example to change all employee names to Nobody issue the followi...

Page 105: ... d SAY a a e SAY A B f SAY b c g SAY c a h SAY a first i SAY x a 4 2 After these assignment instructions what is displayed hole 1 full hole empty hole s full a SAY hole 1 b SAY hole s c SAY hole mouse ANSWERS 1 a 3 b 4 c last d A 3 e 2 f B last g C 3 h A FIRST i cv3d 2 a empty b full c empty Parsing Data Parsing in REXX is separating data into one or more variable names An exec can parse an argume...

Page 106: ...ains Knowledge word2 contains is word3 contains power PARSE UPPER PULL causes the same result as PULL in that it changes character information to uppercase before assigning it to one or more variables ARG Instruction The ARG instruction takes information passed as arguments to an exec function or subroutine and puts it into one or more variable names Before character information is put into a vari...

Page 107: ...ins Knowledge word2 contains is word3 contains power The PARSE UPPER VALUE instruction changes character information to uppercase before assigning it to the variable names PARSE UPPER VALUE Knowledge is power WITH word1 word2 word3 word1 contains KNOWLEDGE word2 contains IS word3 contains POWER Ways of Parsing Parsing separates data by comparing the data to a template or pattern of variable names ...

Page 108: ...included in the data separator phrase To be or not to be PARSE VAR phrase part1 separator part2 part1 contains To be part2 contains or not to be Again in this example notice that the comma is not included with To be because the comma is the string separator Number You can use numbers in a template to indicate the column at which to separate data An unsigned integer indicates an absolute column pos...

Page 109: ...integer can be either positive or negative causing the part to be parsed to shift either to the right with a or to the left with a part1 starts at column 1 the preceding 1 is not coded but implied In the following example therefore the 5 part2 causes part2 to start in column 1 5 6 the 5 part3 causes part3 to start in column 6 5 11 and so on quote Ignorance is bliss 1 2 PARSE VAR quote part1 5 part...

Page 110: ... position For more information about parsing see z OS TSO E REXX Reference Parsing Multiple Strings as Arguments When passing arguments to a function or a subroutine you can specify multiple strings to be parsed Arguments are parsed with the ARG PARSE ARG and PARSE UPPER ARG instructions To pass multiple strings separate each string with a comma This comma is not a string separator as illustrated ...

Page 111: ...te Experience is the best teacher 1 2 3 PARSE VAR quote v1 v2 15 v3 3 v4 a v1 b v2 c v3 d v4 6 quote Experience is the best teacher 1 2 3 PARSE UPPER VAR quote 15 v1 16 12 v2 2 1 v3 10 a v1 b v2 c v3 7 quote Experience is the best teacher 1 2 3 PARSE VAR quote 1 v1 11 v2 6 v3 4 v4 a v1 b v2 c v3 d v4 8 first 7 quote Experience is the best teacher 1 2 3 PARSE VAR quote 1 v1 first v2 6 v3 a v1 b v2 ...

Page 112: ... teacher 4 a v1 Expe b v2 rience is the best teacher 5 a v1 Experience b v2 is c v3 the best teacher d v4 perience is the best teacher 6 a v1 THE BEST TEACHER b v2 IS c v3 EXPERIENCE 7 a v1 Experience b v2 is the c v3 best teacher d v4 the best teacher 8 a v1 Experi b v2 ence i c v3 s the best teacher 9 a word1 Knowledge b word2 Ignorance c word3 Experience Parsing Data 94 z OS V1R1 0 TSO E REXX U...

Page 113: ... space keep in mind the following exceptions to information in this part of the book v An exec that runs outside of a TSO E address space cannot include TSO E commands ISPF commands or ISPF PDF edit commands An exec that runs outside of a TSO E address space can include TSO E commands if you use the TSO E environment service see note v An exec that runs outside of TSO E cannot include most of the ...

Page 114: ...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 User s Guide ...

Page 115: ...ands The two main categories of commands are v TSO E REXX commands Commands provided with the TSO E implementation of the language These commands do REXX related tasks in an exec such as Control I O processing of information to and from data sets EXECIO Perform data stack services MAKEBUF DROPBUF QBUF QELEM NEWSTACK DELSTACK QSTACK Change characteristics that control the execution of an exec EXECU...

Page 116: ...mple the EXEC command encloses an argument within single quotation marks and other commands such as ALLOCATE require single quotation marks around fully qualified data set names EXEC myrexx exec add 25 78 33 exec ALLOC DA USERID MYREXX EXEC F SYSEXEC SHR REUSE As REXX instructions these commands can be entirely enclosed in double quotation marks and still retain the single quotation marks for the ...

Page 117: ...fully qualified data set name READY EXEC myrexx exec test2 userid rexx input exec When passing a non fully qualified data set name as an argument while implicitly invoking the exec you need no quotation marks READY test2 rexx input To pass a fully qualified data set name as an argument while implicitly invoking an exec enclose the data set name in a single set of quotation marks READY test2 userid...

Page 118: ...ther there are elements in the data stack If the data stack contains an element the user at the terminal is not prompted because the data stack element is used in response to the prompt For more information about the data stack see Chapter 11 Storing Information in the Data Stack on page 135 Invoking Another Exec as a Command Previously this book discussed how to invoke another exec as an external...

Page 119: ...is treated as a command enclose the member name and the argument if any within quotation marks As with any other implicitly invoked exec the PDSs containing the calling exec and the called exec must be allocated to either SYSEXEC or SYSPROC Remember that a before the member name reduces the search time because fewer files are searched For example to implicitly invoke an exec named MYREXX EXEC CALC...

Page 120: ...ngth identifier ATTCHPGM an environment that attaches modules on a different task level This environment allows you to pass multiple parameters to an invoked module and allows the invoked module to update the parameters The parameters you pass to the module do not include a length identifier ISPEXEC the environment in which ISPF commands execute ISREDIT the environment in which ISPF PDF EDIT comma...

Page 121: ...ote These lists of host command environments represent the defaults Your installation may have added or deleted environments The default host command environment for execs running in TSO E and ISPF is TSO Thus all commands are sent to TSO E for processing unless the exec changes the host command environment When an exec runs in an MVS environment TSO E command processors and services are not avail...

Page 122: ...perating systems in an SNA network The following APPC MVS calls are supported under the APPCMVS host command environment v ATBCUC1 Cleanup_TP Unauthorized v ATBGTE2 Get_Event v ATBPOR2 Post_on_Receipt v ATBQAQ2 Query_Allocate_Query v ATBRAL2 Receive_Allocate v ATBRFA2 Register_for_Allocate v ATBRJC2 Reject_Conversation v ATBSAQ2 Set_Allocate_Queue_Attributes v ATBSCA2 Set_Conversation_Accounting_I...

Page 123: ...rted under the LU62 host command environment v ATBALC2 Allocate v ATBALLC Allocate v ATBCFM Confirm v ATBCFMD Confirmed v ATBDEAL Deallocate v ATBFLUS Flush v ATBGETA Get_Attributes v ATBGETC Get_Conversation v ATBGETP Get_TP_Properties v ATBGETT Get_Type v ATBGTA2 Get_Attribute v ATBPTR Prepare_To_Receive v ATBRCVI Receive_Immediate v ATBRCVW Receive_And_Wait v ATBRTS Request_To_Send v ATBSEND Se...

Page 124: ...MVS calls can use pseudonyms rather than integer values In the CPICOMM example instead of comparing the variable return_code to an integer value of 0 the example compares return_code to the pseudonym value CM_OK The integer value for CM_OK is 0 TSO E provides two pseudonym files one for the LU62 host command environment and one for the CPICOMM host command environment These files define the pseudo...

Page 125: ...the default TSO host command environment ALLOC DA dsname F SYSEXEC SHR REUSE Note Keywords such as DATASET within an ISPF command must be in uppercase when used in a REXX instruction Determining the Active Host Command Environment To find out what host command environment is currently active use the ADDRESS built in function x ADDRESS In this example x is set to the active host command environment...

Page 126: ...msg MSG nt001 Send an error message EXIT blankem vget ZUSER ntgroup nttype ntmem RETURN RC ADDRESS Example 1 REXX This exec must be run in ISPF It asks users if they know the PF keys and when the answer is a variation of no it displays the panel with the PF key definitions SAY Do you know your PF keys PULL answer IF answer NO answer N THEN ADDRESS ispexec display PANEL ispopt3c ELSE SAY O K Never ...

Page 127: ...tination which was received from an input field named ntdest ADDRESS ispexec DISPLAY PANEL newtool ADDRESS tso re establish the TSO host command environment IF ntmem THEN member name is blank DO dsname ntproj ntgroup nttype TRANSMIT ntdest DA dsname END ELSE DO dsname ntproj ntgroup nttype ntmem TRANSMIT ntdest DA dsname END ADDRESS Example 4 To link to or attach a logoff routine named MYLOGOFF an...

Page 128: ...Issuing Other Types of Commands from an Exec 110 z OS V1R1 0 TSO E REXX User s Guide ...

Page 129: ...n v Special variables RC and SIGL are set by the system to indicate The return code from a command RC The line number from which there was a transfer of control because of a function call a SIGNAL instruction or a CALL instruction SIGL v The TSO E command EXECUTIL TS Trace Start and EXECUTIL TE Trace End control the interactive debug facility as do various options of the TRACE instruction For more...

Page 130: ...TSO E REXX Reference Using REXX Special Variables RC and SIGL As mentioned earlier the REXX language has three special variables RC SIGL and RESULT These variables are set by the system during particular situations and can be used in an expression at any time If the system did not set a value a special variable displays its name as do other variables in REXX You can use two of these special variab...

Page 131: ...ON ERROR instruction can help determine what command caused an error and what the error was When SIGNAL ON ERROR is included in an exec any host command that returns a nonzero return code causes a transfer of control to a routine named error The error routine runs regardless of other actions that would normally take place such as the display of error messages 000001 REXX 000002 SIGNAL ON ERROR 000...

Page 132: ... example includes a TRACE R TRACE Results instruction to interactively trace the result of each instruction Example of Interactive Trace REXX This exec receives as arguments the destination and the name of a data set It then interactively traces the transmitting that data set to the destination and the returning of a message that indicates whether the transmit was successful TRACE R ARG dest dsnam...

Page 133: ... TS from within a CLIST to initiate tracing in execs that the CLIST invokes v From READY Mode You can issue the command from READY mode READY executil ts The next exec invoked from READY mode is then interactively traced If that exec invokes another exec the invoked exec is also interactively traced v From an ISPF Panel You can also issue EXECUTIL TS from the ISPF COMMAND option or from the comman...

Page 134: ...ec or CLIST You can also enter a TRACE instruction which alters the type of tracing After you enter the instruction you might need to press the Enter key again to resume tracing TRACE L Makes the language processor pause at labels only The instruction can also change the course of an exec such as by assigning a different value to a variable to force the execution of a particular branch in an IF TH...

Page 135: ...ctive tracing both to end TRACE The question mark prefix before a TRACE option can end interactive tracing as well as begin it The question mark reverses the previous setting for interactive tracing While interactively tracing an exec you can also enter the TRACE instruction with any operand to discontinue the interactive debug facility but continue the type of tracing specified by the operand EXE...

Page 136: ...Debugging Execs 118 z OS V1R1 0 TSO E REXX User s Guide ...

Page 137: ...nal functions are v GETMSG returns in variables a system message issued during an extended MCS console session It also returns in variables associated information about the message The function call is replaced by a function code that indicates whether the call was successful v LISTDSI returns in variables the data set attributes of a specified data set The function call is replaced by a function ...

Page 138: ...re you activate a console session and during a console session if values need to be changed v Use the TSO E CONSOLE command to activate an extended MCS console session The GETMSG function can be used only in REXX execs that run in the TSO E address space Using the LISTDSI Function You can use the LISTDSI list data set information function to retrieve detailed information about a data set s attribu...

Page 139: ...r than directory information can be considered valid 16 Severe error occurred None of the variables containing information about the data set can be considered valid The following variables are set to the attributes of the data set specified Variable Contents SYSDSNAME Data set name SYSVOLUME Volume serial ID SYSUNIT Device unit on which volume resides SYSDSORG Data set organization PS PSU DA DAU ...

Page 140: ...nd level message if an error occurred SYSDSSMS Information about the type of a data set provided by DFSMS MVS SYSDATACLASS SMS data class name SYSSTORCLASS SMS storage class name SYSMGMTCLASS SMS management class name Using the MSG Function The MSG function can control the display of TSO E messages When the MSG function is not used both error and non error messages are displayed as an exec runs Th...

Page 141: ... BCP component of z OS SYSNAME the name of the system your REXX exec is running on as specified in the SYSNAME statement in SYS1 PARMLIB member IEASYSxx SYSSECLAB the security label SECLABEL name of the TSO E session SYSSMFID identification of the system on which System Management Facilities SMF is active SYSSMS indicator whether DFSMS MVS is available to your REXX exec SYSCLONE MVS system symbol ...

Page 142: ...isplay 210 DO i lines TO var 0 SAY var i displays 5 members END To turn trapping off reissue the OUTTRAP function with the word OFF x OUTTRAP OFF turns trapping OFF The OUTTRAP function can be used only in REXX execs that run in the TSO E address space The OUTTRAP function does not trap all lines of command output from all TSO E commands For more information see z OS TSO E REXX Reference Using the...

Page 143: ...e language to the code specified and returns the language code of the previous language setting The language codes you can specify on SETLANG depend on the language features that are installed on your system Table 1 Language Codes for SETLANG Function That Replace the Function Call Language Code Language CHS Simplified Chinese CHT Traditional Chinese DAN Danish DEU German ENP US English all upperc...

Page 144: ... if function performed okay x SAY Number of on line CPUs is cpus 0 DO i 1 TO CPUS 0 SAY CPU i has CPU info cpus i END you get the following output 0 if function performed okay 0 Number of on line CPUs is 2 CPU 1 has CPU info FF0000149221 CPU 2 has CPU info FF1000149221 4 digits model number 6 digits CPU ID Using the SYSDSN Function The SYSDSN function determines if a specified data set is availabl...

Page 145: ...set to a data set name do not enclose the variable in quotation marks Quotation marks would prevent the data set name from being substituted for the variable name variable myrexx exec x SYSDSN variable The following example uses the SYSDSN function together with the LISTDSI function to test whether a data set exists and whether it is a partitioned data set DO FOREVER SAY Enter a Data Set Name PARS...

Page 146: ...ber of lines available on screen SYSWTERM Width of screen Language Information Argument Value Description SYSPLANG Primary language for translated messages SYSSLANG Secondary language for translated messages SYSDTERM Whether DBCS is supported for this terminal SYSKTERM Whether Katakana is supported for this terminal Exec Information Argument Value Description SYSENV Whether exec is running in fore...

Page 147: ...n Argument Value Description SOLDISP Whether solicited messages command responses should be displayed at terminal UNSDISP Whether unsolicited messages should be displayed at terminal SOLNUM The number of solicited messages command responses to be held in message table UNSNUM The number of unsolicited messages to be held in message table MFTIME Whether time stamp should be displayed with messages M...

Page 148: ... IF SYSDSN baseds OK THEN DO If the base data set exists x LISTDSI baseds use the LISTDSI function IF x 0 THEN If the function code is 0 CALL alc call an internal subroutine ELSE DO Else display the system SAY sysmsglvl1 messages and codes for LISTDS SAY sysmsglvl2 SAY Function code from LISTDSI is x SAY Sysreason code from LISTDSI is sysreason END END ELSE SAY Data set baseds not found EXIT alc n...

Page 149: ...ping lines of output from commands Output goes to variables beginning with name LISTA ST List the status of your currently allocations found NO Set the found flag to no i 1 Set the index variable to 1 Loop through the lines of trapped command output to find lines 9 characters long or longer Check those lines for the word SYSPROC until it is found or until all lines have been checked If SYSPROC is ...

Page 150: ...es are processed Append data set names to the one in variable concat IF found YES THEN DO WHILE i 3 name 0 i i 3 IF SUBSTR name i 1 3 THEN DO i i 1 concat concat name i END ELSE i name 0 END ELSE NOP Allocate the new concatenation to SYSPROC ALLOC F sysproc DA addname concat SHR REUSE Additional Examples 132 z OS V1R1 0 TSO E REXX User s Guide ...

Page 151: ...ame word ddlist i 1 THEN DO if there is a DDNAME it matches firstdataset i 1 back up to first dataset name SAY ddlist firstdataset Give the first dataset allocated DO j i 1 TO ddlist 0 BY 2 WHILE done NO next j 1 IF next ddlist 0 words ddlist next 1 THEN done YES if we reach the end of the command output or the next DDNAME we are done ELSE SAY ddlist j Give the next dataset allocated END END END I...

Page 152: ...r function packages can be named in a parameter block set up by a system programmer For more information about function packages see z OS TSO E REXX Reference Search Order for Functions When the language processor encounters a function call if defaults have not been changed it goes through the following search order v Internal functions Labels in the exec that issued the function call are searched...

Page 153: ... REXX data stack to store information Also this chapter describes how to add a buffer to a data stack and how to create a private data stack in TSO E What is a Data Stack REXX in TSO E uses an expandable data structure called a data stack to store information The data stack combines characteristics of a conventional stack and queue Stacks and queues are similar types of data structures used to tem...

Page 154: ...emoves elements from the data stack Adding Elements to the Data Stack You can store information on the data stack with two instructions PUSH and QUEUE PUSH puts one item of data on the top of the data stack There is virtually no limit to the length of the data item elem1 String 1 for the data stack PUSH elem1 QUEUE puts one item of data on the bottom of the data stack Again there is virtually no l...

Page 155: ...kitem then contains the value of elem1 with the characters translated to uppercase SAY stackitem displays STRING 1 FOR THE DATA STACK When you add PARSE to the preceding instruction the value is not translated to uppercase PARSE PULL stackitem SAY stackitem displays String 1 for the data stack After either of the preceding examples the data stack appears as follows Determining the Number of Elemen...

Page 156: ...Possible Solution 1 REXX This exec uses the PUSH instruction to put the letters T S O E on the data stack in reverse order PUSH E PUSH O Data in stack is PUSH S fourth push T PUSH T third push S second push O number QUEUED first push E DO number PULL stackitem SAY stackitem END Possible Solution 2 REXX This exec uses the QUEUE instruction to put the letters T S O E on the data stack in that order ...

Page 157: ... you split the screen in ISPF When an exec issues a PULL instruction and when it issues an interactive TSO E command the data stack is searched first for information and if that is empty information is retrieved from the terminal Some types of input that can be stored on the data stack are v Data for the PULL and PARSE PULL instructions When an exec issues a PULL instruction the language processor...

Page 158: ...rtually unlimited size v It can contain commands to be issued after the exec ends v It can pass information between REXX execs and other types of programs in a TSO E or non TSO E address space Because of the data stack s unique characteristics you can use the data stack specifically to v Store a large number of data items for a single exec s use v Pass a large number of arguments or an unknown num...

Page 159: ...a set name If you are unsure about SAY naming data sets type To end type QUIT PULL name DO WHILE name name QUIT IF name THEN DO SAY message PULL name END ELSE EXIT END SAY Approximately how many members will the data set have SAY 6 12 18 24 30 36 42 48 54 60 PULL number QUEUE name QUEUE number CALL newdata IF RESULT 0 THEN SAY An error prevented name from being allocated ELSE SAY Your data set nam...

Page 160: ...gets the user ID from a built in function It then calls an external subroutine to check if the user s job is finished The TRANSMIT command and its operands including a message with the status of the job are queued on the data stack to run after the exec terminates SAY What is your node PULL node id USERID dest node id CALL jobcheck userid Go to a subroutine that checks job status IF RESULT done TH...

Page 161: ...ACK command see Protecting Elements in the Data Stack on page 147 Creating a Buffer with the MAKEBUF Command To create a buffer on the data stack before adding more elements to the stack use the TSO E REXX MAKEBUF command All elements added to the data stack after the MAKEBUF command are placed in the buffer Below the buffer are elements placed on the stack before the MAKEBUF command Instructions ...

Page 162: ...s and all elements within them are removed To remove all elements from the entire data stack including elements placed on the data stack before buffers were added issue DROPBUF 0 DROPBUF 0 creates an empty data stack and should be used with caution Note When an element is removed below a buffer the buffer disappears Thus when elements are unintentionally removed below a buffer the corresponding DR...

Page 163: ...e number of elements is RC RC 2 QELEM does not return the number of elements on a data stack with no buffers created by the MAKEBUF command If QBUF returns 0 no matter how many elements are on the stack QELEM also returns 0 For more information about these stack commands see z OS TSO E REXX Reference Exercises Creating a Buffer on the Data Stack 1 What are the results of the following instructions...

Page 164: ...tions that created it what are the results of the subsequent instructions that follow MAKEBUF QUEUE prompt MAKEBUF QUEUE data QUEUE info QUEUE item MAKEBUF a What is returned to the function SAY QUEUED b What is RC QBUF SAY RC c What is RC QELEM SAY RC d What are both RCs and the result of the QUEUED function Creating a Buffer on the Data Stack 146 z OS V1R1 0 TSO E REXX User s Guide ...

Page 165: ...ls For example if an exec puts elements on the data stack for its own use and then calls a subroutine that issues an interactive TSO E command such as ALLOCATE the command goes to the data stack first for input to the command Because the stack input is incorrect for the command prompt the exec ends in error Example of an Interactive Command Error EXEC1 PUSH prompt1 PUSH prompt2 CALL sub1 7invellip...

Page 166: ...ck The elements on the original data stack cannot be accessed by an exec or the routines that it calls until a DELSTACK command is issued When there are no more elements in the new data stack information is taken from the terminal Note When you issue the NEWSTACK it is your responsibility to issue a corresponding DELSTACK command All elements added to the data stack after the NEWSTACK command are ...

Page 167: ...reated data stack If no stack was previously created with the NEWSTACK command DELSTACK removes all the elements from the original stack Finding the Number of Stacks To find out how many stacks exist use the TSO E REXX QSTACK command QSTACK returns in the REXX special variable RC the total number of stacks including the original data stack NEWSTACK NEWSTACK QSTACK SAY The number of stacks is RC RC...

Page 168: ...signing and developing applications with cross system consistency The Systems Application Architecture defines a common programming interface you can use to develop applications and defines common communications support that you can use to connect those applications SAY The length of the element is LENGTH longitem characters The length of the element is 379 characters QUEUE longitem PULL anyitem S...

Page 169: ...e over USER Put a message on the stack PUSH TIME Push the time command PUSH FREE F SYSEXEC Push command to free SYSEXEC PARSE VAR dsn name member Separate the data set name from the member name ALLOC DA name F SYSEXEC SHR REUSE execname STRIP member t Remove the last parentheses from the member name PUSH execname Put the member name on the stack The output from this exec depends on the exec that i...

Page 170: ...Protecting Elements in the Data Stack 152 z OS V1R1 0 TSO E REXX User s Guide ...

Page 171: ...describes two special types of REXX processing v Dynamic modification of a single REXX expression The INTERPRET instruction evaluates an expression and then treats it as a REXX instruction v Processing information to and from data sets The TSO E REXX EXECIO command in an exec reads information from a data set to the data stack or a list of variables and writes information from the data stack or li...

Page 172: ...variables v Add information to the end of a sequential data set v Update information in a data set one line at a time Using the EXECIO Command EXECIO reads information from a data set with either the DISKR or DISKRU operands Using these operands you can also open a data set without reading its records Refer to Reading Information from a Data Set for more information about the DISKR and DISKRU oper...

Page 173: ...ta set put an asterisk immediately following the EXECIO command EXECIO When all the information is on the data stack either queue a null line to indicate the end of the information or if there are null lines throughout the data assign the built in QUEUED function to a variable to indicate the number of items on the stack How to read the data set Depending on the purpose you have for the input data...

Page 174: ...et and positions the file position pointer before the first record EXECIO 0 DISKR myindd OPEN Note If the data set is already open no operation is performed for OPEN v FINIS To close the data set after reading it Closing the data set allows other execs to access it and its ddname It also resets the current positional pointer to the beginning of the data set v STEM To read the information to either...

Page 175: ... all lines to the data set allocated to the ddname MYOUTDD might appear as EXECIO DISKW myoutdd FINIS The rest of this topic describes the types of information you can specify with EXECIO DISKW For further information see z OS TSO E REXX Reference How to specify the number of lines to write To open a data set without writing records to it put a zero immediately following the EXECIO command and spe...

Page 176: ...d OPEN Note If the data set is already open no operation is performed for OPEN v FINIS To close the data set after writing to it Closing the data set allows other execs to access it and its ddname When you specify FINIS it forces the completion of all I O operations by physically writing the contents of any partially filled I O buffers to the data set EXECIO DISKW myoutdd FINIS v STEM To write the...

Page 177: ...operands of the EXECIO command permit you to do many types of I O For example you can use the EXECIO command to v Copy information from one data set to another Copy an entire data set Copy parts of a data set Add information to the end of a sequential data set v Copy information to and from a list of compound variables v Update information in a data set Copying Information From One Data Set to Ano...

Page 178: ...To copy 10 lines of data from an existing sequential data set named DEPT5 STANDARD HEADING to a new member in an existing PDS named USERID OFFICE MEMO JAN15 and use the ddnames INDD and OUTDD respectively you could use the following instructions Remember that a data set name that does not begin with your prefix must be enclosed in single quotes Copying 10 Lines of Data to a New Data Set ALLOC DA d...

Page 179: ...copy an entire data set into compound variables with the stem newvar and then display the list write the following instructions Copying an Entire Data Set into Compound Variables ALLOC DA old data F indd SHR REUSE EXECIO DISKR indd STEM newvar DO i 1 to newvar 0 SAY newvar i END When you want to copy a varying number of lines to compound variables you can use a variable within the EXECIO command a...

Page 180: ...e stack locate and change the line and then write all the lines back For example you have a data set named DEPT5 EMPLOYEE LIST that contains a list of employee names user IDs and phone extensions Adams Joe JADAMS 5532 Crandall Amy AMY 5421 Devon David DAVIDD 5512 Garrison Donna DONNAG 5514 Leone Mary LEONE1 5530 Sebastian Isaac ISAAC 5488 To change a phone extension to 5500 on a particular line su...

Page 181: ...e are specified by a user The user is given the option of changing each line as it appears If there is no change to the line the user presses Enter key to indicate that there is no change If there is a change to the line the user types the entire line with the change and the new line is returned to the data set PARSE ARG name numlines Get data set name and size from user ALLOC DA name F updatedd O...

Page 182: ...P END ELSE done yes END EXIT 0 Figure 1 EXECIO Example 1 EXECIO Example 2 REXX This exec copies records from data set my input to the end of data set my output Neither data set has been allocated to a ddname It assumes that the input data set has no null lines ALLOC DA my input F indd SHR REUSE ALLOC DA my output F outdd MOD REUSE SAY Copying EXECIO DISKR indd FINIS QUEUE Insert a null line at the...

Page 183: ...long ELSE NOP END The file is still open for processing EXIT 0 Figure 3 EXECIO Example 3 EXECIO Example 4 REXX This exec reads first 100 records or until EOF of the data set allocated to INVNTORY Records are placed on data stack in LIFO order If fewer than 100 records are read a message is issued eofflag 2 Return code to indicate end of file EXECIO 100 DISKR invntory LIFO return_code RC IF return_...

Page 184: ...ds yet All records will be read and processed within the loop body EXECIO 0 DISKR indd OPEN Open indd Now read all lines from indd starting at line 1 and copy selected lines to outdd DO WHILE return_code eofflag Loop while not end of file EXECIO 1 DISKR indd Read 1 line to the data stack return_code rc Save execio rc IF return_code 0 THEN Get a line ok DO Yes in_ctr in_ctr 1 Increment input line c...

Page 185: ...written to file outdd DO Erase any old records from the file Since the outdd file is still closed at this point the following EXECIO 0 DISKW command will open the file write 0 records and then close it This will effectively empty the data set allocated to outdd Any old records that were in this data set when this exec started will now be deleted EXECIO 0 DISKW outdd OPEN FINIS Empty the outdd file...

Page 186: ...ecords from sample1 data and append them to the end of all sample data exec_RC 0 Initialize exec return code EXECIO DISKR myindd1 STEM newvar FINIS Read all records IF rc 0 THEN If read was successful DO At this point newvar 0 should be 20 indicating 20 records have been read Stem variables newvar 1 newvar 2 through newvar 20 will contain the 20 records that were read SAY SAY newvar 0 records have...

Page 187: ...uninitialized state Read all records from sample2 data and append them to the end of all sample data EXECIO DISKR myindd2 STEM newvar FINIS Read all records IF rc 0 THEN If read was successful DO At this point newvar 0 should be 10 indicating 10 records have been read Stem variables newvar 1 newvar 2 through newvar 10 will contain the 10 records If we had not cleared the stem newvar with the previ...

Page 188: ...ful 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 2nd EXECIO DISKW return code is RC SAY END END ELSE DO exec_RC RC Save exec return code SAY SAY Error during 2nd EXECIO DISKR return code is RC SAY END END EXECIO 0 DISKW myoutdd FINIS Close output file FREE FI myindd1 FREE FI myindd2 FREE FI myoutdd EXIT 0 Figure 9 EXE...

Page 189: ... a language processor environment Services Available to REXX Execs This book until now has described writing and running REXX execs in the TSO E address space Besides TSO E execs can run in other address spaces within MVS Where an exec can run is determined by the types of services the exec requires There are services that are available to an exec that runs in any address space TSO E or non TSO E ...

Page 190: ...h authorized and unauthorized can be issued from an exec that runs in a TSO E address space For a description of these commands see z OS TSO E Command Reference X TSO E External Functions v GETMSG retrieves system messages issued during an extended MCS console session X v LISTDSI returns data set attributes X v MSG controls the display of messages for TSO E commands X v MVSVAR returns information ...

Page 191: ...l use of your terminal while the exec runs Running an Exec in the Foreground Interactive execs and ones written that involve user applications are generally run in the foreground You can invoke an exec in the foreground in the following ways v Explicitly with the EXEC command For more information see Running an Exec Explicitly on page 16 v Implicitly by member name if the PDS containing the exec w...

Page 192: ...stallation s setup you can affect the performance of execs you run by allocating the data sets that contain them to either SYSEXEC or SYSPROC More about this technique appears in the following sections on allocating to a specific system file Allocating to SYSEXEC SYSEXEC is a system file that can contain execs only SYSEXEC precedes SYSPROC in the search order Therefore execs in PDSs allocated to S...

Page 193: ...IST that is invoked from an exec The following examples demonstrate how a CLIST invokes an exec and how a number is returned to the invoking CLIST The CLIST named TEST explicitly executes an exec named EXEC1 EXEC1 calls EXEC2 which returns the result A OK EXEC1 then returns to the CLIST with a numeric return code of 100 if information was passed correctly and 50 if information was not passed corre...

Page 194: ...llowing two examples exec USERID MYREXX EXEC TRANSFER passes an argument to CLIST USERID MY CLIST RECEIVE and the CLIST returns a number through the CODE parameter of the EXIT statement USERID MYREXX EXEC TRANSFER REXX This exec passes a percent sign to a CLIST and depending on the success of the transfer the CLIST returns 100 if it was successful or 50 if it was not successful SAY We are about to...

Page 195: ...obs in the background see z OS TSO E User s Guide Running Execs in a Non TSO E Address Space Because execs that run in a non TSO E address space cannot be invoked by the TSO E EXEC command you must use other means to run them Ways to run execs outside of TSO E are v From a high level program using the IRXEXEC or IRXJCL processing routines v From MVS batch with JCL that specifies IRXJCL in the EXEC...

Page 196: ... The following series of examples show how an MVS batch job named USERIDA invokes a REXX exec in a PDS member named USERID MYREXX EXEC JCLTEST The member name JCLTEST is specified as the first word after the PARM parameter of the EXEC statement Two arguments TEST and IRXJCL follow the member name Output from the exec goes to an output data set named USERID IRXJCL OUTPUT which is specified in the S...

Page 197: ...mp to the sequential data set that was allocated to the OUTDD file by the JCL used to invoke this exec OUTLINE 1 Exec JCLTEST has ended at TIME EXECIO 1 DISKW OUTDD STEM OUTLINE FINIS Write the line SAY Leaving exec JCLTEST EXIT 137 send a condition code of 137 USERID TRACE OUTPUT Exec JCLTEST has ended at 15 03 06 USERID IRXJCL OUTPUT Running exec JCLTEST Test IRXJCL First line of data Second lin...

Page 198: ... data and the PULL instruction is in a loop the exec can result in an infinite loop Summary of TSO E Background and MVS Batch CAPABILITIES TSO E BACKGROUND IKJEFT01 MVS BATCH IRXJCL Execs run without terminal interaction Execs run without terminal interaction Execs can contain v REXX instructions v Built in functions v TSO E REXX commands v TSO E commands v TSO E external functions Execs can conta...

Page 199: ...t parameters modules that define language processor environments They are v IRXTSPRM for TSO E v IRXPARMS for non TSO E v IRXISPRM for ISPF The defaults are set by TSO E but they can be modified by a system programmer What is a Language Processor Environment A language processor environment defines characteristics such as v The search order used to locate commands and external routines v The ddnam...

Page 200: ...processor environment in two ways v Change the values in the three default parameters modules IRXTSPRM IRXISPRM and IRXPARMS v Call an initialization routine IRXINIT and specifying parameters to change default parameters For more information about customizing a language processor environment see z OS TSO E REXX Reference Defining Language Processor Environments 182 z OS V1R1 0 TSO E REXX User s Gu...

Page 201: ...Part 3 Appendixes Copyright IBM Corp 1988 2001 183 ...

Page 202: ...184 z OS V1R1 0 TSO E REXX User s Guide ...

Page 203: ...s two things v Creating a new data set in which to store REXX execs You can create a new data set with the ISPF PDF UTILITIES option or with the TSO E ALLOCATE command Checklists for creating a data set appear in Checklist 1 Creating and Editing a Data Set Using ISPF PDF on page 187 Checklist 2 Creating a Data Set with the ALLOCATE Command on page 190 v Accessing an existing data set and associati...

Page 204: ...te allocation you might need to use the checklists again to keep your allocations up to date Preliminary Checklist 1 Issue the LISTALC STATUS command to see the names of all data sets allocated to SYSEXEC and SYSPROC To see what data sets are already defined to SYSEXEC and SYSPROC at your installation issue the LISTALC command with the STATUS keyword READY listalc status You then see several scree...

Page 205: ...the following READY LISTDS sysexec first exec SYSEXEC FIRST EXEC RECFM LRECL BLKSIZE DSORG VB 255 5100 PO VOLUMES TSO026 READY LISTDS sysproc first clist SYSPROC FIRST CLIST RECFM LRECL BLKSIZE DSORG FB 80 19040 PO VOLUMES TSOL07 5 Write down the attributes of the first data set in your SYSEXEC concatenation RECFM ______________________________ LRECL ______________________________ BLKSIZE ________...

Page 206: ...y to process list of data set names Print or display VTOC information 5 RESET Reset statistics for members of ISPF library 6 HARDCOPY Initiate hardcopy output 8 OUTLIST Display delete or print held job output 9 COMMANDS Create change an application command table 10 CONVERT Convert old format menus messages to new format 11 FORMAT Format definition for formatted data Edit Browse 12 SUPERC Compare d...

Page 207: ...se fields may be specified 4 Edit a member of the newly created PDS by selecting the EDIT option option 2 and specifying the PDS name with a member name After you have allocated a PDS you can press the RETURN PF key PF4 to return to the Primary Option Menu and begin an edit session Select the EDIT option option 2 from the ISPF PDF Primary Option Menu ISPF PDF PRIMARY OPTION MENU OPTION 2 USERID YO...

Page 208: ...time 000010 IF usertime THEN 000011 SAY O K Game s over 000012 ELSE 000013 DO 000014 SAY The computer says 000015 TSO system time command 000016 END 000017 000018 EXIT BOTTOM OF DATA Checklist 2 Creating a Data Set with the ALLOCATE Command 1 Type an ALLOCATE command at the READY prompt to define the attributes of the new data set You can use the ALLOCATE command to create a PDS instead of using I...

Page 209: ... your data set of execs before other data sets Generally all the data sets in the list should have the same record format either RECFM VB or RECFM FB and logical record length LRECL Also the first data set in the list can determine the block size BLKSIZE for the data sets that follow If the block size of the first data set is smaller than the block sizes of subsequent data sets you might end in er...

Page 210: ...EXEC rexx exec setup exec ENTER AN S BEFORE EACH OPTION DESIRED BELOW NOMAIL NONOTICE RECONNECT OIDCARD Checklist 4 Writing an Exec that Sets up Allocation to SYSPROC 1 Write an exec named SETUP that allocates data sets to SYSPROC Create a data set member named SETUP in your exec PDS In SETUP issue an ALLOCATE command that concatenates your PDS to the beginning of all the data sets already allocat...

Page 211: ...tering the following EXEC command READY EXEC rexx exec setup exec If the allocation was successful you should then see displayed on your screen Allocation to SYSPROC completed To have SETUP execute when you log on and automatically allocate your data set to SYSPROC type the same EXEC command in the COMMAND field of your LOGON panel Sample SETUP Exec REXX This exec is an example of how to allocate ...

Page 212: ...any entry field ENTER LOGON PARAMETERS BELOW RACF LOGON PARAMETERS USERID YOURID PASSWORD NEW PASSWORD PROCEDURE MYPROC GROUP IDENT ACCT NMBR 00123 SIZE 5800 PERFORM COMMAND EXEC rexx exec setup exec ENTER AN S BEFORE EACH OPTION DESIRED BELOW NOMAIL NONOTICE RECONNECT OIDCARD Checklist 4 194 z OS V1R1 0 TSO E REXX User s Guide ...

Page 213: ...g implicit execution these libraries are searched first v The application level includes exec libraries specified on the ALTLIB command by data set or file name During implicit execution these libraries are searched after user libraries v The system level includes exec libraries previously allocated to file SYSEXEC or SYSPROC During implicit execution these libraries are searched after user or app...

Page 214: ...control the ALTLIB definitions that were passed take effect again regardless of whether the invoked application changed them If you omit the PASSLIB operand ALTLIB definitions are not passed to the invoked application For more information about writing ISPF applications see z OS ISPF Services Guide Examples of the ALTLIB Command In the following example an application issues the ALTLIB command to ...

Page 215: ...ilities For separating data into variable names and formatting text REXX provides extensive parsing through templates For more information see Parsing Data on page 87 v Use of a data stack REXX offers the use of a data stack in which to store data For more information see Chapter 11 Storing Information in the Data Stack on page 135 v Use of mixed and lowercase characters Although variables and mos...

Page 216: ... SYSPREF WRITE SYSPREF SYSPROC SYSUID For Terminal Information SYSLTERM SYSWTERM For CLIST Information SYSENV SYSICMD SYSISPF SYSNEST SYSPCMD SYSSCMD For System Information SYSCPU SYSHSM SYSJES SYSLRACF SYSNODE SYSRACF SYSSRV SYSTERMID SYSTSOE Arguments of the SYSVAR external function For User Information SYSPREF SAY SYSVAR syspref SYSPROC SYSUID For Terminal Information SYSLTERM SYSWTERM For Exec...

Page 217: ... SELECT WHEN OTHERWISE END instructions Looping Looping Iterative DO Iterative DO DO WHILE END statements DO WHILE END instructions DO UNTIL END statements DO UNTIL END instructions Interrupting Interrupting END EXIT statements EXIT instruction GOTO statement SIGNAL instruction LEAVE instruction CALL instruction Calling another CLIST Calling another exec as an external subroutine EXEC command EXEC...

Page 218: ...apping TSO E command output Trapping TSO E command output SYSOUTTRAP SYSOUTLINE OUTTRAP external function Error handling Error handling ERROR and ATTN statements SIGNAL ON ERROR SIGNAL ON FAILURE SIGNAL ON HALT SIGNAL ON NOVALUE and SIGNAL ON SYNTAX instructions CALL ON ERROR CALL ON FAILURE and CALL ON HALT instructions 1 For more information about REXX error handling instructions see z OS TSO E ...

Page 219: ...meters ARG PARSE ARG PARSE UPPER ARG instructions arg dsname member disp An exec receives positional parameters Use the PARSE ARG and PARSE UPPER ARG instructions to receive keywords for example my data member member1 disp old parse upper arg dsname parse upper arg MEMBER mem parse upper arg DISP disp Recognizing comments within a parameter Recognizing comments within a parameter A CLIST PROC stat...

Page 220: ...ND CLOSFILE PAYCHEKS EXECIO DISKR EXECIO DISKRU commands EXECIO 3 DISKR indd stem employee FINIS Read 3 records from the data set in indd The 3 records go to a list of compound variables with the stem of employee They are employee 1 employee 2 and employee 3 Writing to a file Writing to a file OPENFILE PUTFILE CLOSFILE statements OPENFILE PRICES OUTPUT SET PRICES 2590 00 PUTFILE PRICES CLOSFILE PR...

Page 221: ...en closing delimiter always required Using Functions CLIST REXX Calling a function Calling a function FUNCTION expression SET A LENGTH ABCDE A 5 function arguments a length abcde a 5 Using Variables CLIST REXX Assigning value to a variable Assigning value to a variable SET statement SET X 5 X gets the value 5 SET NUMBER X NUMBER gets the value 5 SET Y NUMBER Y gets the value NUMBER assignment inst...

Page 222: ...Using Variables 204 z OS V1R1 0 TSO E REXX User s Guide ...

Page 223: ...a Corporation Licensing 2 31 Roppongi 3 chome Minato ku Tokyo 106 Japan The following paragraph does not apply to the United Kingdom or any other country where such provisions are inconsistent with local law INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION AS IS WITHOUT WARRANTY OF ANY KIND EITHER EXPRESS OR IMPLIED INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF NON IN...

Page 224: ...se products and cannot confirm the accuracy of performance compatibility or any other claims related to non IBM products Questions on the capabilities of non IBM products should be addressed to the suppliers of those products All statements regarding IBM s future direction or intent are subject to change without notice and represent goals and objectives only This information contains examples of d...

Page 225: ...wing terms are trademarks of the IBM Corporation in the United States or other countries or both v CICS v DFSMS MVS v IBM v IBMLink v IMS v MVS v MVS DFP v MVS ESA v Operating System 2 v Operating System 400 v OS 2 v OS 400 v RACF v Resource Link v SAA v Systems Application Architecture v z OS v zSeries UNIX is a registered trademark of The Open Group in the United States and other countries Other...

Page 226: ...208 z OS V1R1 0 TSO E REXX User s Guide ...

Page 227: ...APPC MVS Management SA22 7599 v z OS MVS Programming Writing Transaction Programs for APPC MVS SA22 7621 v z OS MVS Initialization and Tuning Reference SA22 7592 v z OS MVS Programming Authorized Assembler Services Guide SA22 7608 v z OS MVS Programming Authorized Assembler Services Reference ALE DYN SA22 7609 v z OS MVS System Messages Vol 1 ABA AOM SA22 7631 v z OS MVS System Messages Vol 2 ARC ...

Page 228: ...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 TSO E REXX User s Guide ...

Page 229: ...utine 74 arguments passing 24 using CALL instruction 24 using EXEC command 24 using REXX function call 24 arithmetic operator division type of 29 priority 29 type of 28 array 156 assignment instruction 13 ATTACH host command environment 102 ATTCHMVS host command environment 102 ATTCHPGM host command environment 102 B background TSO JCL 177 running an exec 176 batch MVS JCL 178 running an exec 178 ...

Page 230: ...al 34 blank 34 CONSOLE host command environment 102 console session 102 continuation of an instruction 10 control variable 119 copy information to and from data sets 159 information to compound variables 161 information to the end of a data set 160 CPICOMM host command environment 102 104 D data set adding information with EXECIO command 160 adding to SYSEXEC 191 adding to SYSPROC 192 allocating 7...

Page 231: ...input to a TSO E command 100 exec continued prompting the user for input to a TSO E command 124 149 receiving input 22 returning information to a CLIST 176 running error message 19 explicitly 16 173 from a CLIST 173 175 from another exec 173 implicitly 17 173 185 implicitly with ALTLIB 195 in a TSO E address space 173 in non TSO E address space 177 in the background 176 in the foreground 173 where...

Page 232: ... LISTDSI 120 MSG 122 MVSVAR 123 OUTTRAP 123 PROMPT 124 SETLANG 125 function continued TSO E external continued STORAGE 126 SYSCPUS 126 SYSDSN 126 SYSVAR 127 using EXIT 78 using PROCEDURE 80 using PROCEDURE EXPOSE 81 using RETURN 78 when to make internal or external 79 writing 77 function package description 133 local 134 system 134 user 134 G GETMSG external function 119 120 GOTO 58 H HE halt exec...

Page 233: ...DURE EXPOSE 74 81 PULL 21 88 137 PUSH 136 QUEUE 136 re executing during interactive trace 116 SAY 8 SELECT WHEN OTHERWISE END 44 SIGNAL 58 SIGNAL ON ERROR 113 syntax 9 instruction 71 continued TRACE ending tracing 117 interactive tracing 114 tracing command 111 tracing expression 37 type of assignment 13 command 14 keyword 13 label 14 null 14 using blank 10 using comma 10 using quotation mark 9 98...

Page 234: ...running an exec 178 using IRXJCL 178 using the data stack 180 MVS host command environment 102 MVSVAR external function 123 N name for variable restriction on naming 26 valid name 26 NEWSTACK command 148 non TSO E address space running an exec 177 Notices 205 null instruction 14 numeric constant decimal number 28 floating point number 28 signed number 28 whole number 28 O operator arithmetic 28 or...

Page 235: ...k command 144 145 149 repetitive loop 47 RESULT special variable 75 100 used with EXIT 57 REXX compiler benefits 5 REXX environment definition 181 REXX exec identifier 8 14 174 REXX instruction 71 adding during interactive trace 116 REXX instruction 71 continued ADDRESS 106 ARG 22 74 82 88 blank 14 CALL RETURN 57 comment 14 conditional 41 continuing to the next line 10 DO END 47 DO FOREVER 49 DO U...

Page 236: ...77 subroutine calling 57 comparison to a function 69 83 description 69 exposing a specific variable 74 external 71 internal 71 subroutine continued passing information using an argument 74 passing information to possible problem 72 using a variable 72 protecting variable 73 receiving information from RESULT 75 using the ARG built in function 75 returning a value 57 using CALL RETURN 70 using PROCE...

Page 237: ...ion 119 JCL example 177 running an exec 177 TSO E external function description 119 GETMSG 120 LISTDSI 120 MSG 122 MVSVAR 123 OUTTRAP 123 PROMPT 124 SETLANG 125 STORAGE 126 TSO E external function continued SYSCPUS 126 SYSDSN 126 SYSVAR 127 TSO E REXX command DELSTACK 149 description 97 DROPBUF 144 EXECIO 154 EXECUTIL HI 49 EXECUTIL SEARCHDD 174 EXECUTIL TE 117 EXECUTIL TS 114 115 MAKEBUF 143 NEWS...

Page 238: ...220 z OS V1R1 0 TSO E REXX User s Guide ...

Page 239: ...isfied Satisfied Neutral Dissatisfied Very Dissatisfied Accurate h h h h h Complete h h h h h Easy to find h h h h h Easy to understand h h h h h Well organized h h h h h Applicable to your tasks h h h h h Please tell us how we can improve this book Thank you for your responses May we contact you h Yes h No When you send comments to IBM you grant IBM a nonexclusive right to use or distribute your ...

Page 240: ...ation P384 2455 South Road Poughkeepsie NY 12601 5400 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ...

Page 241: ......

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

Reviews: