Free Rexx ! Everything You Ever Wanted to Know

Slides:



Advertisements
Similar presentations
What is a Computer Program? For a computer to be able to do anything (multiply, play a song, run a word processor), it must be given the instructions.
Advertisements

Chapter 11 Introduction to Programming in C
Programming for Beginners
Agenda Definitions Evolution of Programming Languages and Personal Computers The C Language.
Introducing JavaScript
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
MC697 Object-Oriented Programming Using Java. In this class, we will cover: How the class will be structured Difference between object-oriented programming.
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Introduction to Rexx Prof. Chris GauthierDickey COMP 2400: Unix Tools.
Programming Languages Structure
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
Scripting Languages CS 351 – Programming Paradigms.
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
C++ fundamentals.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
CS102 Introduction to Computer Programming
CSC 142 A 1 CSC 142 Introduction to Java [Reading: chapter 0]
Programming Languages: Telling the Computers What to Do Chapter 16.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Introduction to Shell Script Programming
INTERNET APPLICATION DEVELOPMENT For More visit:
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
Introduction to Python
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
CMPE13Cyrus Bazeghi 1 Programming Languages Telling computers what to do.
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
CS 390 Unix Programming Summer Unix Programming - CS 3902 Course Details Online Information Please check.
CompSci Today’s topics Java Review Just a bunch of headings meant to trigger questions A contraction of previous notes Upcoming Midterm Exam Reading.
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Programming Domains 1.Scientific Applications Typically, scientific applications have simple data structures but require large numbers of floating-point.
10/8: Software What is software? –Types of software System software: Operating systems Applications Creating software –Evolution of software development.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
9-Nov-97Tri-Ada '971 TASH An Alternative to the Windows API TRI-Ada ‘97 Terry J. Westley
© Paradigm Publishing, Inc. 4-1 Chapter 4 System Software Chapter 4 System Software.
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.
Intermediate 2 Computing Unit 2 - Software Development.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
JavaScript 101 Introduction to Programming. Topics What is programming? The common elements found in most programming languages Introduction to JavaScript.
Chapter 1 Basic Concepts of Operating Systems Introduction Software A program is a sequence of instructions that enables the computer to carry.
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
Course Title Object Oriented Programming with C++ instructor ADEEL ANJUM Chapter No: 03 Conditional statement 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER)
Python 1 SIGCS 1 Intro to Python March 7, 2012 Presented by Pamela A Moore & Zenia C Bahorski 1.
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
First appeared Features Popular uses Basic This language emphasises on ease of use, allowing general purpose programming to those with a small amount of.
Presented By P.SRIVIDYA 085D1A0552 Programming Language.
Rexx for Shell Scripting or “We don't need no stinkin' bashes...”
Component 1.6.
CS 330 Class 7 Comments on Exam Programming plan for today:
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
Scripting Languages Info derived largely from Programming Language Pragmatics, by Michael Scott.
Key Ideas from day 1 slides
Chapter 2 First Java Programs
PHP / MySQL Introduction
Introduction to Algorithm Design
Programming Languages 2nd edition Tucker and Noonan
Principles of Programming Languages
강의 내용 및 방법 접근방법 리포트 시험 Lambda Calculus, Proof of Correctness
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
FEATURES OF PYTHON.
Web Application Development Using PHP
Presentation transcript:

Free Rexx ! Everything You Ever Wanted to Know About Rexx (but were afraid to ask) Howard Fosdick (C) 2005 FCI

Who Am I? Independent consultant DBA / SA for: Oracle, DB2, SQL Server Linux, Unix, Windows Founder IDUG, MWDUG, CAMP Author: Rexx Programmer’s Reference Contact: hfosdick@compuserve.com

Viewpoint / Purpose All languages have their strengths & roles Not here to “put down” other languages Here to present Rexx’s strengths and discuss where it fits in your toolbox (1) Know where Rexx fits (2) Teach you to script it in < 2 hours ! Goals:

Outline Why Scripting ? Why Rexx ? Rexx Tutorial Further Info

I. Why Scripting ?

Ka-Boom! 2 Big Software Trends Converge Free and Open Source Scripting Perl, Python, Rexx, Tcl/Tk, Bash, Korn, Ruby, others Java, C/C++, COBOL Visual Basic, VBScript, WSH

What’s a Scripting Language ? Rexx: General purpose Free / open source Universal Portable code Transferable skills Standardized (8 of 9 free Rexxes meet stds) Dynamic Sizing (variables & arrays) Memory management No “variable declarations” No “data typing” Integrated debugger Interpreted High-level Glue language

Scripting Vs. Traditional Languages -- Lower level -- Compiled -- More detail-oriented -- Manual variable management -- Pre-declared variables -- More programmer effort -- “Coding” languages -- Optimize execution speed -- High level -- Interpretive -- More productive -- Varying degrees of automatic variable management -- Shifts burden to the machine -- “Glue” languages -- Acceptable execution speed Rexx, Perl, Python, Tcl/Tk, Ruby, others C/C++, COBOL, Java, Pascal, others

When to Use Rexx Yes No -- Productivity -- Reliability -- Quick development -- Glue language -- Prototyping -- Systems administration -- OS extensions -- Portable apps -- Mainframe migrations -- Embedded programming -- Handhelds -- Text processing -- Interactive development / debugging -- Optimal execution speed is required -- Systems -level programming (No BIOS interrupts, direct addressing, etc.)

Performance Ratio of compiler to interpreter speed remains constant while processor speeds increase exponentially 200k 10k 4k 70 Year-- 1981 1988 1993 1998 2005 Mhz-- 4.77 8 66 266 3 ghz CPU-- 8088 386 486 PII PIV

II. Why Rexx ?

“Easy but Powerful” “Easy but Powerful” Why Rexx Vs Other Scripting Languages ? “Easy but Powerful” “Easy but Powerful” Ease of use benefits experienced developers ... FAST coding ! Reliable code Easy to code right out of memory Maintainable code 70%+ of IT does maintenance This determines your code’s longevity Saves your company $$$

Rexx uses specific technologies to tie them together Why Rexx Vs Other Scripting Languages ? Power Simplicity Conflict ! Rexx uses specific technologies to tie them together

Power Through Simplicity by… Small instruction set, w/ power in the functions Extensible Call external functions just like internal Glue language (uses OS commands, interfaces, DLLs, shared libraries, services, objects, etc.) Minimal syntax Minimal special characters, variables, etc. Automated memory management Automated variable management No data definitions No data typing Dynamic array sizes Dynamic string or variable lengths

Rexx presents a unique scripting paradigm. Power Through Simplicity… Rexx presents a radically different philosophy on how to achieve power than the “Unix tradition” languages (Perl, Bash, Korn, Awk, etc.) Rexx presents a unique scripting paradigm.

The Language Structure Makes Rexx Easy Operators Arithmetic Comparison Logical String 2 dozen Instructions Learn from the inside out 70 Built-in Functions Other Features OS commands, external functions, DLLs, APIs, widgets, etc.

Rexx Runs Everywhere… Rexx predominates on systems in red Linux-- all versions Unix-- all versions BSD-- all versions Windows-- all versions Mac OS-- all versions DOS all versions (32- and 16- bit) Handhelds-- Windows CE, Palm OS, Symbian/EPOC32 Embedded-- Embedded Linux, DOS, Windows variants Mainframes-- OS, VM, VSE (all versions) IBM mid-range-- i5/OS, OS/400 (all versions) Many others-- Amiga OS, AROS, OpenVMS, BeOS, OpenEdition, AtheOS/Syllable, SkyOS, QNX (QNX4/QNX6), OS/2, eCS, osFree, more… Rexx predominates on systems in red

The Free Rexx Interpreters BRexx Regina Rexx/imc All major operating systems Windows, DOS (32/16 bit), Windows CE, Linux, Unix, Mac OS, others Unix, Linux, BSD Rexx for Palm OS Reginald r4 Windows Windows Palm OS Open Object Rexx OOP extensions roo! NetRexx Linux, Windows, Solaris, AIX Any Java Environment Windows

Rexx Free Tools and Interfaces Over 100 free tools for Rexx. Examples: SQL database access GUIs XML Web programming Math libraries Regular Expressions Code managers Communications functions OS interface libraries Graphics Speech, MIDI, sound . . . you name it . . .

III. Let’s Code !

Example Script # 1… /*******************************************************************/ /* Find Payments: */ /* Reads accounts lines one by one, and displays overdue */ /* payments (lines containing the phrase PAYMENT_OVERDUE). */   arg filein /* Read the input file name*/ do while lines(filein) > 0 /* Do while a line to read */ input_line = linein(filein) /* Read an input line */ if pos('PAYMENT_OVERDUE',input_line) > 0 then say 'Found it:' input_line /* Write line if $ overdue */ end

Simplicity in this script… Minimal syntax Minimal special characters and variables Free format Use spaces & blank lines however desired Case-insensitive (capitalize however you want) No explicit file definition File is automatically OPEN’ed and CLOSE’d Automatic “declaration” of variables (see FILEIN and INPUT_LINE) No “data typing” All variables are strings Numbers are strings that look like numbers Decimal arithmetic (portable, consistent results) Automatic conversions where sensible

What is “Power” ? Power is not solving the problem in the fewest LOC! Is it the number of Lines of Code (LOC) ? Can reduce LOC by nesting functions But why write a complex “fortune-cookie” script ? Power is not solving the problem in the fewest LOC! Power is a deft script that solves the problem in a reliable, readable, maintainable manner

Example Script # 2… This script does the same thing as Example #1 arg filein fgrep PAYMENT_OVERDUE filein This script does the same thing as Example #1

The Power of Glue Languages Rexx evaluates a statement, sends anything that is not Rexx to the “external environment” (by default this is the OS) Full power of a string-manipulation language to direct external interfaces Inspect return code, command output, messages, and respond Rexx is a glue language

Structured Control Instructions If If then else Do End Do While Select Call (case) Subroutine or Function

Un-Structured Control Instructions Do Until Do Forever Iterate Leave Signal (goto)

Rexx Functions… 70 Built-in Functions: String manipulation (character, bit, hex) Word manipulation I/O Numeric Environmental Conversion Other 2 statements access external function library Those functions are then coded just like built-ins

Example Script # 3… /*******************************************************************/ /* Code Lookup: */ /* Looks up the area code for the town the user enters. */   area. = '' /* Initialize array entries to null */ area.CHICAGO = 312 /* Define a table of area codes */ area.HOMEWOOD = 708 area.EVANSTON = 847 do while town <> '' /* Loop until user enters null line */ say 'For which town do you want the area code?' pull town if town <> '' then do if area.town = '' then say 'Town' town 'is not in my database' else say 'The area code for' town 'is' area.town end

Simplicity in this script… Array recognized by the period (area.) Do not have to declare arrays or predefine their size Sets all possible elements to null string (area. = ‘’) Subscript array by any arbitrary string (content-addressable memory or associative memory) Arrays can be: Dense or sparse Contain homogenous or heterogeneous elements Represent records or C structs Expand to size of memory Automatic capitalization (pull & array element names) Can always override Rexx’s automation

Example Script # 4… (part I) /* Find Books: */ /* This program illustrates how arrays may be of any dimension */ /* in retrieving book titles based on their keyword weightings. */   keyword. = '' /* Initialize both arrays to all null strings */ title. = '' /* The array of keywords to search for among the book descriptors */ keyword.1 = 'earth' ; keyword.2 = 'computers' keyword.3 = 'life' ; keyword.4 = 'environment' /* The array of book titles, each having several descriptors */ title.1 = 'Saving Planet Earth' title.1.1 = 'earth' title.1.2 = 'environment' title.1.3 = 'life' title.2 = 'Computer Lifeforms' title.2.1 = 'life' title.2.2 = 'computers' title.2.3 = 'intelligence' title.3 = 'Algorithmic Insanity' title.3.1 = 'computers' title.3.2 = 'algorithms' title.3.3 = 'programming'

Example Script # 4… (part II) arg weight /* Get number keyword matches required for retrieval */   say 'For weight of' weight 'retrieved titles are:' /* Output header */ do j = 1 while title.j <> '' /* Look at each book */ count = 0 do k = 1 while keyword.k <> '' /* Inspect its keywords */ do l = 1 while title.j.l <> '' /* Compute its weight */ if keyword.k = title.j.l then count = count + 1 end if count >= weight then /* Display titles matching the criteria */ say title.j

Discussion Array keyword. is a lookup table or list key/value pairs like Perl or Berkeley DB Array title. is a tree Trees can be balanced or not DO I = 1 TO n BY m WHILE condition FOR x DO UNTIL … DO FOREVER DO n IF condition THEN DO . . . END ELSE DO DO IF Enclose multiple statements within a DO END pair

Create Any Data Structure With Rexx Arrays : Element 1 Key 1 Value 1 b.1 b.1.1 b.1.1.1 b.1.1.2 b.2 b.2.1 b.2.2 b.2.3 b.3 b3.1 b.3.1.1 b.3.1.1.1 Key 2 Value 2 Element 2 Key 3 Value 3 Element 3 Key 4 Value 4 A Simple List or Look-up Table Key-value Pairs b.1 b.1.1 b.1.2 b.2 b.2.1 b.2.2 b.3 b.3.1 b.3.2 b.1 b.1.1 b.2 b.2.1 b.2.2 b.2.3 b.3 b.4 A Multi-level Tree (unbalanced) Also: linked list, doubly linked list, stack, queue, dequeue, etc... Balanced Tree Un-Balanced Tree

Example-- Creating a Linked List list.0 = HEAD ; list.0.next = 1 /* Define linked list. */ list.1 = 'a' ; list.1.next = 2 /* You could also */ list.2 = 'b' ; list.2.next = 3 /* create it */ list.3 = TAIL ; list.3.next = TAIL /* dynamically. */ call display_linked_list /* Display the linked list */ list.99 = 'after a, before b' /* Add new item in list */ list.99.next = 2 /* Point new item to next */ list.1.next = 99 /* Point to the new item */ exit display_linked_list: /* Displays the linked list*/ sub = 0 do while list.sub.next <> TAIL say 'Element:' list.sub sub = list.sub.next end return

Why Rexx Vs Other Scripting Languages ? For a language that “lacks data structures,” Rexx sure has a lot of them! Power thru Simplicity

IV. More about Rexx

Rexx Standards 8 of 9 free Rexx interpreters adhere to TRL-2 Extensions TRL-2 ANSI 8 of 9 free Rexx interpreters adhere to TRL-2 ANSI adds little beyond TRL-2 Most Rexxes offer extensions Extensions offer OS-specific stuff and other niceties

Rexx Standards Early 90s 1990 1996 1985 TRL-1 TRL-2 SAA ANSI Language Level 3.50 4.00 5.00

The Evolution of Rexx Object-oriented Rexx Standard or “Classic” Rexx Early 1980s Mid 1990s Standard or “Classic” Rexx NetRexx (for Java environments)

Rexx on Handhelds Native DOS Emulation Interpreter: Interpreter: Windows CE BRexx Palm OS Rexx for Palm OS Symbian / EPOC32 Regina PocketDOS XTM others BRexx + Integrates with... + DOS Services + DOS Applications + Many DOS apps instantly available without any changes + Faster + Integrates with native services

How DOS Emulation Works Rexx Scripts Rexx Interpreter DOS Operating System DOS Emulator Native operating system Each layer runs on top of the one below it PC Hardware

Object-Oriented Rexx Means… Classic Rexx Classes and Methods PLUS Inheritance & Derivation Encapsulation Abstraction Polymorphism Huge Class Library

Object Rexx Adds to Classic Rexx . . . Classes and Methods Complete Object Orientation Object Rexx Built-in Objects, Special Variables, many other features New Instructions And Much More More Functions New Operators

NetRexx A “Rexx-like” language Brings Rexx ease of use to Java environment NetRexx scripts use Java classes Script: Classes for use by Java Applets Applications Servlets Java Beans (EJBs) Client & server side both

NetRexx Goes Beyond Classic Rexx… Java environment integration Object orientation New instructions Changed and Extended with . . . Data typing (“types”) Indexed strings Special names Special methods … and much more …

Developing and Running NetRexx Scripts To translate, compile and run in one step enter: nrc -run hello Translate NetRexx source into a Java program Class file Eg: hello.class Source script Eg: hello.nrx Java file Eg: hello.java Compile Java into bytecode Run NetRexx interprets and/or compiles. Can generate commented, formatted Java code. Runs under JVM or stand-alone.

V. More Rexx Features

How Rexx Supports Modularity Modularity Internal Routines External Resources -- Extensions and Function Libraries -- Operating System Commands -- Commands to other environments -- External Programs -- API Interfaces to external features -- API into Rexx -- Built-in Functions -- Functions you develop -- Subroutines

String Processing Operations abc + abc abcabc Concatenation Joins two or more strings abcabc Bifurcation Splits a string abc abc abcabc Parsing Scans and analyzes a string, may split it into its constituent components Parse Count = 2 abcdef Pattern Matching Identifies patterns in strings Find “def”

Parsing Operations By Words Separate by words By Pattern Separate , using , commas By Numeric Pattern abc abc abc Columns: 1 5 9

The Two I/O Modes Line-oriented Process one line at a time Character-oriented Process one character at a time linein charin charout lineout lines chars + More portable + Reads “special” characters

The Stack is both a Stack and a Queue PULL, PARSE PULL PUSH QUEUE Rexx’s Stack is a generalized communications mechanism

Rexx Supports Recursion Script X How Recursion Works Yes End Test Fufilled ? No Call Script X

Tip – Steps to Good Programming Style Ect ! Error checking Structured Code Modularity Comments Limit Nesting Spacing & indentation Good variable names Capitalization

Debugging Options SAY Instruction TRACE Instruction in batch mode Interactive TRACE + Quick, informal + Great for simple problems + Requires changing code (adding SAY instructions) + Resolves challenging problems + Allows real-time code tests + Programmer-directed interaction resolves problems + Quick & easy, but powerful + Batch script trace + Can set trace level based on user input + Many trace settings available + Good for “paperanalysis” of a problem

Condition / Exception Trapping signal on condition name label_name …code of the main routine... label_name: …code of the error handling routine... Conditions: error, failure, halt, novalue, notready, syntax, lostdigits

VI. Conclusions

Conclusions Trends ! Free & open source languages have taken over Scripting is the “quiet revolution” Rexx offers “Power through Simplicity” Useful addition to your toolbox

Resources Next... Rexx Programmer’s Reference at Amazon INTERPRETER: DOWNLOAD: Regina http://regina-rexx.sourceforge.net BRexx http://bnv.home.cern.ch/bnv/ Reginald http://www.borg.com/~jglatt/rexx/rexxuser.htm Rexx/imc http://users.comlab.ox.ac.uk/ian.collier/Rexx/rexximc.html Rexx for Palm OS http://www.jaxo.com/rexx/ r4 http://www.kilowattsoftware.com/ roo! http://www.kilowattsoftware.com/ Open Object Rexx http://www.rexxla.org NetRexx http://www-306.ibm.com/software/awdtools/netrexx/ Rexx Programmer’s Reference at Amazon www.amazon.com/rexx      

? ? ? ? ? questions... ? ? ? ?