Rexx Programming1 REXX Programming. Rexx Programming2 INTRODUCTION What is REXX ?  REstructured eXtended eXecuter  Simple Programming Language  Can.

Slides:



Advertisements
Similar presentations
Introduction to C Programming
Advertisements

PL/SQL.
The Web Warrior Guide to Web Design Technologies
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Introduction to Rexx Prof. Chris GauthierDickey COMP 2400: Unix Tools.
Chapter 9: Arrays and Strings
REXX - part 2 Prof. Chris GauthierDickey COMP Unix Tools.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 27, 2005.
Chapter 8 Arrays and Strings
JavaScript, Third Edition
Guide To UNIX Using Linux Third Edition
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
Python Programming Fundamentals
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
Fortran 1- Basics Chapters 1-2 in your Fortran book.
1 Chapter 9 Writing, Testing, and Debugging Access Applications.
1 Stacks Chapter 4 2 Introduction Consider a program to model a switching yard –Has main line and siding –Cars may be shunted, removed at any time.
Introduction to Python Basics of the Language. Install Python Find the most recent distribution for your computer at:
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
2440: 211 Interactive Web Programming Expressions & Operators.
1 © 2000 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.
CIS 218 Advanced UNIX1 CIS 218 – Advanced UNIX (g)awk.
Chapter 8 Arrays and Strings
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
Input, Output, and Processing
Using Client-Side Scripts to Enhance Web Applications 1.
CSC 3210 Computer Organization and Programming Chapter 1 THE COMPUTER D.M. Rasanjalee Himali.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Guide to Oracle 10g ITBIS373 Database Development Lecture 4a - Chapter 4: Using SQL Queries to Insert, Update, Delete, and View Data.
Data TypestMyn1 Data Types The type of a variable is not set by the programmer; rather, it is decided at runtime by PHP depending on the context in which.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
REXX Saravanan Desingh. REXX An abbreviation of IBMs Restructured EXtended eXecutor (REXX) Language, which allows system command to be used or combined.
JavaScript, Fourth Edition
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
By Mr. Muhammad Pervez Akhtar
Chapter 14 JavaScript: Part II The Web Warrior Guide to Web Design Technologies.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Chapter 4: Variables, Constants, and Arithmetic Operators Introduction to Programming with C++ Fourth Edition.
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
Rexx for Shell Scripting or “We don't need no stinkin' bashes...”
Definition of the Programming Language CPRL
CSC 4630 Meeting 7 February 7, 2007.
Topics Designing a Program Input, Processing, and Output
The Selection Structure
Scripts & Functions Scripts and functions are contained in .m-files
Stacks Chapter 4.
Objectives Insert a script element Write JavaScript comments
Topics Introduction to File Input and Output
WEB PROGRAMMING JavaScript.
7) Built-in functions Built-in Function overview,
PHP.
T. Jumana Abu Shmais – AOU - Riyadh
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
3) Parsing Instructions: PARSE, ARG, Patterns.
Introduction to Computer Science
Topics Introduction to File Input and Output
Presentation transcript:

Rexx Programming1 REXX Programming

Rexx Programming2 INTRODUCTION What is REXX ?  REstructured eXtended eXecuter  Simple Programming Language  Can run Inside / Outside of a TSO/E Address Space

Rexx Programming3 Features of REXX  Ease to Use  Free Format  Convenient Built - in Functions  Debugging Capabilities  Interpreted Language  Extensive Parsing capabilities

Rexx Programming4 Components of REXX  Instructions  Built – in Functions  TSO/E External Functions  Data Stack Functions

Rexx Programming5 Writing a REXX Exec

Rexx Programming6 What is a REXX Exec ?  Contains REXX language Instructions and Commands  Starts with the comment line with the word REXX  Example : /* REXX */ Say ‘This is my First REXX program’

Rexx Programming7 Syntax of REXX Instructions Literal String  Using Single quotes  Using double quotes Format of a REXX Instruction  Can begin in any column on any line  Comma (,) used as a continuation character  Semi colon (;) indicates the end of an Instruction

Rexx Programming8 Types of REXX Instructions Keyword Assignment Label Null Command

Rexx Programming9 Operators Comparison Operators Logical (Boolean) Operators Concatenation Operators

Rexx Programming10 Controlling the Flow Within an Exec Conditional Instruction –IF / THEN / ELSE Instruction –SELECT / WHEN / OTHERWISE / END Instruction Looping Instruction – Repetitive Loops LEAVE ITERATE – Conditional Loops Interrupt Instruction –EXIT –SIGNAL –CALL / RETURN

Rexx Programming11 Subroutines & Functions Made up of sequence of instruction that can receive data, process the data and return a value (Optional for Subroutine & Mandatory for Functions) Passing the Information RESULT PROCEDURE Instruction PROCEDURE EXPOSE Instruction

Rexx Programming12 Built-In Functions Arithmetic Functions  ABS - Returns the Absolute value of the input number  MAX - Returns the largest number from the list specified  MIN - Returns the smallest number from the list specified  RANDOM - Returns a quasi-random, non-negative whole number in the range Specified

Rexx Programming13 Built-In Functions ….. Contd Comparison Function:  COMPARE : Returns 0 if the two input strings are identical. Otherwise returns the position of the first character that doesn’t match.  DATATYPE : Returns a String indicating the input data type of the input string such as Number or Character.

Rexx Programming14 Built-In Functions ….. Contd Conversion Functions :  B2X – Binary to Hexadecimal  C2D – Character to Decimal Formatting Functions:  CENTER / CENTRE – Returns a String of a specified length with the input string centered in it.  COPIES – Returns the specified number of concatenated copies of the input string.  LEFT / RIGHT – Returns a String of the specified length truncated or padded on the Right / Left as needed.

Rexx Programming15 Built-In Functions ….. Contd String Manipulating Function: INDEX – Returns the character position of the first character of the specified string found in the input string. LENGTH – Returns the Length of the Input String. STRIP – Returns a character String after removing leading or trailing character or both from the Input String. SUBSTR – Returns a portion of the Input String beginning at a specified character position.

Rexx Programming16 String Manipulating Functions ….. Contd WORD – Returns a word from the Input String as indicated by a specified number. WORDS – Returns a number of words in the Input String. 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.

Rexx Programming17 Built-In Functions ….. Contd  Miscellaneous functions:  DATE – Returns the date in the default format(dd mon yyyy) or in one of the various optional format.  TIME – Returns the local time in the default 24 – hour clock format (hh:mm:ss) or in one of the various optional formats.  USERID – Returns the TSO/E user id, if the REXX exec is running TSO/E address space.

Rexx Programming18 Passing Information SAY –Passing Information to the Terminal PULL –Getting Information from the Terminal ARG –Specifying the inputs while invoking the execs –Periods (.) will act as the dummy variables PARSE –Preventing the translation of Uppercase

Rexx Programming19

Rexx Programming20

Rexx Programming21

Rexx Programming22

Rexx Programming23

Rexx Programming24

Rexx Programming25 Compound Variables & Stems Compound Variables  a way to create a multi dimensional array or a list of variables in REXX. Stems  First variable name and the first period of a compound variable  Every compound variable begins with a stem

Rexx Programming26

Rexx Programming27

Rexx Programming28 Parsing Data PARSE UPPER PULL PARSE UPPER ARG PARSE UPPER VAR –For Example quote = ‘Knowledge is power’ PARSE UPPER VAR quote word1 word2 word3 PARSE UPPER VALUE – For Example PARSE UPPER VALUE ‘Knowledge is power ‘ WITH word1 word2 word3.

Rexx Programming29

Rexx Programming30

Rexx Programming31 Commands from an Exec TSO/E REXX COMMANDS  Provided with the TSO/E implementation of the language  Will do the REXX – related tasks in an execs.  For Example EXECIO – Controls the I/O operations to and from the dataset NEWSTACK & DELSTACK – Perform data stack services SUBCOM – Checks for the existence of a host command Environment.

Rexx Programming32 Commands from an Exec …. Contd Host Commands :  Recognized by the Host Environment in which an exec runs.  RC is set to the return code of the Host Command issued  Enclose the Command within single or double quotation marks  For Example “ALLOC DA(NEW.DATA) LIKE(OLD.DATA) NEW ” name = myrexx.exec “LISTDS” name “STATUS”

Rexx Programming33 Host Command Environments TSO – Default Host command Environment ISPEXEC – The environment in which the ISPF commands execute. ISREDIT – The environment in which ISPF/PDF EDIT commands execute. ADDRESS – The command used to change the Host Command Environment. – For Example ADDRESS ISPEXEC “EDIT DATASET(“datasetname”)”

Rexx Programming34

Rexx Programming35

Rexx Programming36

Rexx Programming37

Rexx Programming38 Data Stack Expandable data structure to store the information STACK - Last In First Out (LIFO) QUEUE – First In First Out (FIFO) PUSH – Puts one item of data on the top of the Data Stack QUEUE - puts one item of data on the bottom of the Data Stack QUEUED() – Total number of elements in a Data Stack PARSE EXTERNAL – Gets the input directly from the terminal and by pass the data stack.

Rexx Programming39

Rexx Programming40

Rexx Programming41

Rexx Programming42

Rexx Programming43

Rexx Programming44

Rexx Programming45 TSO/E External Functions LISTDSI  To retrieve the detailed information about a dataset’s attribute.  The attribute information will be stored in a system variables.  For Example x = LISTDSI(‘’’proj5.rexx.exec’’’) SYSDSNAME-Dataset name SYSUNIT-Device unit SYSDSORG-Dataset Organization SYSRECFM -Record Format SYSLRECL-Logical Record Length

Rexx Programming46

Rexx Programming47

Rexx Programming48

Rexx Programming49 TSO/E External Functions…. Contd OUTTRAP  Puts lines of command output into a series of numbered variables each with the same prefix.  These variables will save the command output.  Specify the variable name in parentheses following the function call.  For Example X = OUTTRAP(var.) “LISTC” X = OUTTRAP(‘OFF’)

Rexx Programming50

Rexx Programming51

Rexx Programming52

Rexx Programming53 TSO/E External Functions…. Contd PROMPT  Prompting the user for the valid input for the TSO/E commands  TSO/E Profile - For the terminal session TSO PROFILE PROMPT TSO PROFILE NOPROMPT  TSO/E EXEC command When invoking an exec with the EXEC command, can specify the PROMPT operand to set prompting on for the TSO commands Issued within the exec. The default value is NOPROMPT  PROMPT External Function PROMPT(‘ON’) – to set the PROMPT option PROMPT(‘OFF’) – to set the NOPROMPT option

Rexx Programming54

Rexx Programming55

Rexx Programming56

Rexx Programming57

Rexx Programming58

Rexx Programming59 TSO/E External Functions…. Contd SYSDSN  Determines if a specified dataset is available or not  For Example X = SYSDSN(‘myrexx.exec’) The value of X will be ‘OK’ if it is available for use otherwise The value of the X will be MEMBER SPECIFIED, BUT DATASET IS NOT PARTITIONED MEMBER NOT FOUND DATASET NOT FOUND PROTECTED DATASET UNAVAILABLE DATASET INVALID DATASET NAME, data-set-name: MISSING DATASET NAME

Rexx Programming60

Rexx Programming61

Rexx Programming62

Rexx Programming63

Rexx Programming64 TSO/E External Functions…. Contd SYSVAR  Retrieves the information about the MVS, TSO/E and the current session, such as logon procedure and the user id.  Information retrieved depends upon the argument specified.  For example Argument Value Description SYSPREFPrefix as defined in user profile SYSPROCLogon procedure of current session SYSUIDUser id of the current session

Rexx Programming65 Dynamic Modification of a Single REXX Expression INTERPRET Instruction  Evaluate the expression and also treat it as an instruction after it is evaluated  For Example action = ‘ DO 3 ; SAY “HELLO” ; END ’ INTERPRET action

Rexx Programming66 Process Information to and from the Data Sets Using EXECIO  reads information from a data set to the data stack (or a list of variables) and writes information from the data stack (or list of variables) back to a data set.  The dataset must be either sequential or a single member of a PDS.  OPTIONS with DISKR / DISKRU OPEN FINIS STEM SKIP LIFO FIFO  OPTIONS with DISKW OPEN FINIS STEM  QUEUE ‘’ – Used to queue a null line at the bottom of the stack to indicate the end of the information

Rexx Programming67 EXECIO ….. Contd Return Codes from EXECIO Command 0-Normal Completion 1 -Data was truncated during the DISKW operation. 2-End of file Reached before the number of lines were read during DISKR / DISKRU operation. 4-An empty dataset was found during the DISKR / DISKRU operation. 20-Severe error.

Rexx Programming68 Executing a REXX Exec……

Rexx Programming69 Executing the REXX Exec Explicit Execution  EXEC command runs the non-compiled REXX programs in TSO/E.  Enter EXEC command followed by the dataset name that contains the exec and keyword ‘exec’ to distinguish it from the CLIST.  For Example EXEC ‘SHRTEST.SHREXB.EXEC(SEARCH)’ exec EXEC SHREXB(SEARCH) exec

Rexx Programming70 Executing the REXX Exec …. Contd Implicit Execution  Running the Exec by simply entering the member name of the dataset that contains the exec.  Allocate the PDS that contains the execs to the system file SYSPROC or SYSEXEC  SYSPROC  Is a system file whose dataset can contain both CLISTS and EXEC  SYSEXEC  Is a system file whose dataset can contain only the EXECs.  If both the system files are available, SYSEXEC will be searched first.

Rexx Programming71

Rexx Programming72

Rexx Programming73

Rexx Programming74

Rexx Programming75 Executing the REXX Exec …. Contd Through Batch Mode  Program IKJEFT01 will be used to submit the REXX execs in Batch mode  The member name and the arguments will be passed thru the PARM parameter.  The PDS that contains the member exec will be mentioned in SYSEXEC DD statement.  The output (if any) from the REXX exec will be stored in the dataset mentioned in the SYSTSPRT DD statement.

Rexx Programming76

Rexx Programming77 Debugging the REXX Exec

Rexx Programming78 Debugging the REXX Exec TRACE  Displays how the language processor evaluates each operations.  TRACE I (Trace Intermediates)  Will Trace the Intermediate states of the Expression or an Instruction.  TRACE R (Trace Results)  Will Trace the Result or Output of the Expression or an Instruction.

Rexx Programming79

Rexx Programming80

Rexx Programming81

Rexx Programming82 Debugging the REXX Exec …. Contd SPECIAL VARIABLES  RC – Will contain the Return code the latest command  SIGL – The line number from which there was a transfer of control because of the function call, a SIGNAL instruction, or a call instruction.  Interactive Debug Facility  EXECUTIL TS(TRACE Start)  EXECUTIL TE(TRACE End)  Option within Interactive Trace

Rexx Programming83

Rexx Programming84

Rexx Programming85

Rexx Programming86

Rexx Programming87

Rexx Programming88

Rexx Programming89

Rexx Programming90

Rexx Programming91

Rexx Programming92 Thank You……………..