1 / 97

REXX

REXX. Saravanan Desingh. REXX. An abbreviation of IBMs R estructured EX tended e X ecutor ( REXX ) Language, which allows system command to be used or combined in a routine. Topics. 1 REXX ENVIRONMENT 2 CODING PROGRAM & DATA INSTRUCTIONS 3 DEBUGGING & STORAGE FACILITIES

Download Presentation

REXX

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. REXX Saravanan Desingh

  2. REXX • An abbreviation of IBMs Restructured EXtended eXecutor (REXX) Language, which allows system command to be used or combined in a routine.

  3. Topics 1 REXX ENVIRONMENT 2 CODING PROGRAM & DATA INSTRUCTIONS 3 DEBUGGING & STORAGE FACILITIES 4 REXX AS A COMMAND LANGUAGE

  4. REXX ENVIRONMENT 1.1 Creating a REXX program. 1.2 Coding Simple variables and Expressions 1.3 Using Built-in functions

  5. 1.1 Creating a REXX program 1.1.1 Beginning a REXX Program and using comments 1.1.2 Structuring a REXX Program 1.1.3 Using Basic Terminal I/O 1.1.4 Running a REXX Program

  6. 1.1.1 Beginning a REXX program and using comments • Start with Keyword REXX • Comments /* and */

  7. 1.1.2 Structuring a REXX program • Free-Formatted Language • A Space to separate the arguments • Not Case-Sensitive

  8. 1.1.2 Structuring a REXX program ;Separate 2 Instructions , Continue an Instruction

  9. 1.1.3 Basic terminal input and output instruction • SAY • Display Text on Screen • PULL • Retrieves User Input

  10. 1.1.4 How to Run a REXX program? • Explicit Command • TSO Environment exec‘DSN’exec • Implicit Command • SYSPROC or SYSEXEC TSOmember-name

  11. 1.2 Coding Simple variables and Expressions 1.2.1 Using Dynamic Typing 1.2.2 Assigning simple variable 1.2.3 Using Character String Expressions and Operations 1.2.4 Using Arithmetic Expressions and Operations 1.2.5 Using Logical Expression and Operations

  12. 1.2.1 Using Dynamic Typing • Implicit Defining of Variables • Defined Dynamically

  13. 1.2.2 Assigning simple variables • Variable Characteristics: • Length 1 to 255 characters • A-Z, a-z, 0-9 • !,@,#,$,?,_ • Should not begin with Digits

  14. 1.2.3 Using Character String Expressions and Operations • All Constants & Variables referred as Alphanumeric Character Strings. • Character Strings - “” and ‘’ • Concatenation - ||

  15. 1.2.4 Using Arithmetic Expressions and Operations • Denoted with or without Quotes 12,’12.0’,”12.00” • Arithmetic Operators +,-,*,/

  16. 1.2.5 Using Logical Expressions and Operations = > < == (Identical to) & | \ (Not)

  17. 1.3 Using Built-in functions 1.3.1 Using string manipulation function 1.3.2 Formatting numbers 1.3.3 Using Arithmetic Functions 1.3.4 Using Miscellaneous functions

  18. 1.3.1 Using String Manipulation Functions • LENGTH(string) • No.of characters in the string • LEFT(string,no.of chars) • Isolate a string within a string • SUBSTR(string,startpos,no.of chars) • RIGHT(string,no.of chars)

  19. 1.3.1 Using String Manipulation Functions • POS(lookfor,seach) • INDEX(search,lookfor) • searches one string (search) to see if another string (lookfor) is contained in it

  20. 1.3.2 Formatting Numbers • FORMAT(nn,ninteger,ndecimal) nn - Number or numeric expression to format ninterger-Number of digits or blanks to the left of the decimal point. ndecimal-Number of places to the right of the decimal point • Ex: A=123.44 FORMAT(A,3,1)=123.4

  21. 1.3.2 Formatting Numbers • TRUNC(number,numberofplaces) • Ex: TRUNC(56.7777,1)=56.7

  22. 1.3.3 Using Arithmetic Functions • DATATYPE(variable) • NUM • CHAR

  23. 1.3.3 Using Arithmetic Functions • Additional Function: • ABS(n) • MAX(n1, n2, n3...) • MIN(n1, n2, n3….) • RANDOM(low, high) • SIGN(n) -1, 0 , 1

  24. 1.3.4 Using Miscellaneous Function • USERID() • TIME() Format hh:mm:ss • DATE() Format dd mmm yyyy • DATE(J) Format yyddd • DATE(U) Format mm/dd/yy

  25. 2 CODING PROGRAM & DATA INSTRUCTIONS 2.1 Using Compound variables 2.2 Coding Conditional and Looping Constructs 2.3 Implementing Subroutines, Procedures, and Functions 2.4 Parsing Data

  26. 2.1 Using Compound variables • Stem • No. of Elements • Maximum Variable Name Length - 250 Characters • Mixed types and Lengths • Ex: arr.1=“25” arr.2=“Steeple-Reach Building” • Implementing Arrays and Records

  27. Initialize array: • array.=0 • arr.=‘’

  28. Single and Multi dimension array. • Ex: single.var matrix.row.col

  29. Compound Variables can be used as Data Structures. • Ex: emprec.empname=‘Bharath’ emprec.empno=5508 emprec.sex=‘M’ • Record like structure.

  30. 2.2 Coding Conditional and Looping Constructs 2.2.1 Using Conditional Constructs and Compound Statements 2.2.2 Using Looping Constructs 2.2.3 Bypassing and Terminating Loops 2.2.4 Branching on errors

  31. 2.2.1 Using Conditional constructs and Compound statements • Conditional group: IF-THEN-ELSE • Format: IF expression THEN statement ELSE statement • ELSE optional

  32. 2.2.1 Using Conditional constructs and Compound statements • Grouping the statements: DO-END Ex: DO Statement1 Statement2 END

  33. 2.2.1 Using Conditional constructs and Compound statements • Selecting several conditions: SELECT-WHEN-THEN-OTHERWISE * OTHERWISE optional

  34. 2.2.2 Using Looping Constructs • Repeating a sequence of instructions. • Conditional Looping. • DO-WHILE • DO-UNTIL

  35. 2.2.2 Using Looping Constructs • Format: DO WHILE condition Stmts END • Executes when condition is True.

  36. 2.2.2 Using Looping Constructs • Format: DO UNTIL condition stmts END • Executes when condition is False.

  37. 2.2.2 Using Looping Constructs • Numerically Controlled Repetitive Loop: • Format: DOnooftimes stmts END • Ex: DO 5 say ‘It will be displayed for 5 times’ END

  38. 2.2.2 Using Looping Constructs • Numerically Controlled Repetitive Loop:(Infinite Looping) • Format: DOFOREVER stmts END • Ex: DO FOREVER say ‘Your System is locked by the User’ END

  39. 2.2.2 Using Looping Constructs • Numerically Controlled Repetitive Loop: • Format: DO var = initial T0 final stmts END • Ex: DO I=1 to 10 s=s+I END

  40. 2.2.2 Using Looping Constructs • BY Clause: • Additional variations. Ex: DO I=1 T0 99 BY 2 SUM=SUM+I END ‘I’ will have the values 1,3,5,…99

  41. 2.2.2 Using Looping Constructs • FOR Clause: • Controls Maximum no. of Execution. Ex: DO I=0 BY 5 FOR 20 SAY I END ‘I’ will have the values 0,5,10,..95

  42. 2.2.2 Using Looping Constructs • Nested Looping: DO … DO… ……. END END

  43. 2.2.3 Bypassing and Terminating Loops • LEAVE: • Terminating explicitly. • Ex: DO FOREVER SAY ‘Enter a String (Exit : X)’ PULL STR IF STR == ‘X’ THEN LEAVE ELSE SAY STR END

  44. 2.2.3 Bypassing and Terminating Loops • ITERATE: • Bypass instructions. • Ex: DO count = 1 TO 10 IF count = 8 THEN ITERATE ELSE SAY 'Number' count END

  45. 2.2.4 Branching on Errors • SIGNAL: • Ex: IF RC\=0 THEN SIGNALhandle-error ……. handle-error: ….

  46. 2.3 Implementing Subroutines, Procedures, and Functions 2.3.1 Defining Subroutines, Procedures and Functions 2.3.2 Using Subroutines 2.3.3 Using Procedures 2.3.4 Using Functions

  47. 2.3.1 Defining Subroutines, Procedures, and Functions • In REXX, use a Subroutine for a simple branch and return within a program. All main program variables are available to a subroutine.

  48. 2.3.1 Defining Subroutines, Procedures, and Functions • In REXX, use a Proceduresthe same way as you use a subroutine, but use it when you need a routine with its own local variables ‘hidden’ from the main program.

  49. 2.3.1 Defining Subroutines, Procedures, and Functions • In REXX, use a Functions to return data to use in the main program. REXX allows functions to either access main program variables or local variables.

  50. 2.3.2 Using Subroutines Main pgm, ….. CALL subrtn …… EXIT subrtn: …….. RETURN

More Related