01_579967 ffirs.qxd 2/3/05 9:00 PM Page i

Rexx ’s Reference

Howard Fosdick 01_579967 ffirs.qxd 2/3/05 9:00 PM Page iv 01_579967 ffirs.qxd 2/3/05 9:00 PM Page i

Rexx Programmer’s Reference

Howard Fosdick 01_579967 ffirs.qxd 2/3/05 9:00 PM Page ii

Rexx Programmer’s Reference Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2005 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 0-7645-7996-7 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 1MA/ST/QS/QV/IN No part of this publication may be reproduced, stored in a retrieval system or transmitted in any or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per- fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, e-mail: [email protected].

LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COM- PLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WAR- RANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SER- VICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PRO- FESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOM- MENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ. For general information on our other products and services or to obtain technical support, please con- tact our Customer Care Department within the U.S. (800) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002. Wiley also publishes its books in a variety of electronic formats. Some content that appears in may not be available in electronic books. Trademarks: Wiley, the Wiley Publishing logo, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc., and/or its affiliates, in the United States and other countries, and may not be used without written permission. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. 01_579967 ffirs.qxd 2/3/05 9:00 PM Page iii

About the Author

Howard Fosdick Howard Fosdick has performed DBA and systems support work as an independent consultant for 15 years. He’s coded in Rexx for nearly two decades and has worked in most other major scripting lan- guages. Fosdick has written many technical articles, founded two users’ groups, and is known as the originator of such concepts as “hype cycles” and “open consulting.” 01_579967 ffirs.qxd 2/3/05 9:00 PM Page iv 01_579967 ffirs.qxd 2/3/05 9:00 PM Page v

Credits Senior Acquisitions Editor Project Coordinator Debra Williams Cauley Erin Smith

Development Editor Graphics and Production Specialists Eileen Bien Calabro Jonelle Burns Carrie Foster Production Editor Lauren Goddard Felicia Robinson Denny Hager Joyce Haughey Technical Reviewer Jennifer Heleine Mark Hessling Quality Control Technicians Copy Editor John Greenough Publication Services Leeann Harney Jessica Kramer Editorial Manager Carl William Pierce Mary Beth Wakefield Proofreading and Indexing Vice President & Executive Group Publisher TECHBOOKS Production Services Richard Swadley

Vice President and Publisher Joseph B. Wikert 01_579967 ffirs.qxd 2/3/05 9:00 PM Page vi 01_579967 ffirs.qxd 2/3/05 9:00 PM Page vii

To Kate, my parents, and Phoebe Jane. 01_579967 ffirs.qxd 2/3/05 9:00 PM Page viii 01_579967 ffirs.qxd 2/3/05 9:00 PM Page ix

Foreword

Rexx is a very underrated ; elegant in design, simple syntax, easy to learn, use and maintain, yet as powerful as any other available today.

In 1979, , IBM fellow, designed a “human-centric” programming language, Rexx. Cowlishaw’s premise was that the programmer should not have to tell the what the language syntax was in each program they wrote; that was the job of the interpreter. So unlike most other program- ming languages, Rexx does not suffer from superfluous, meaningless punctuation characters throughout the code.

Since the release of Rexx outside of IBM, Rexx has been ported to virtually all operating systems and was formally standardised with the publishing of the ANSI Standard for Rexx in 1996. In late 2004, IBM transferred their implementation of Object REXX to the Rexx Language Association under an Open Source license. This event signalled a new era in the history of Rexx.

This book provides a comprehensive reference and programming guide to the Rexx programming lan- guage. It shows how to use the most popular implementations of Rexx and Rexx external function pack- ages and is suited to both the programmer learning Rexx for the first as well as the seasoned Rexx developer requiring a single, comprehensive reference manual.

Rexx has had a major influence on my life for the past 20 years since I wrote my first XEDIT in Rexx. In the last 10 years I have maintained the Regina Rexx interpreter, ably assisted by Florian Große- Coosmann, and in my remaining spare time have developed several Rexx external function packages (and my XEDIT-like , THE). However, like many developers of open source products, I have never quite documented the products as completely as they deserve.

This is the book I would have liked to write if I had had the time. I’m glad Howard had the time!

Mark Hessling Author of Rexx/SQL, Rexx/gd, Rexx/DW, Rexx/CURL, Rexx/Curses, Rexx/Wrapper, Rexx/Trans, The Hessling Editor (THE), Maintainer of Regina, Rexx/, PDCurses, http://www.rexx.org/ 01_579967 ffirs.qxd 2/3/05 9:00 PM Page x 01_579967 ffirs.qxd 2/3/05 9:00 PM Page xi

Acknowledgments

Special thanks are due to Mark Hessling, who writes and maintains Regina Rexx and a wide variety of open source Rexx tools and interfaces. As the technical reviewer for this book, Mark was an invaluable source of recommendations for improvement as well as (oops!) corrections. His expertise and helpful- ness were critical to improving this book.

Special gratitude is also due to the inventor of Rexx, Michael Cowlishaw. His advice and feedback were very much appreciated.

In the process of developing this book, I wrote inquiries to many people without any prior introduction. Each and every one of them responded helpfully. It was a great pleasure to meet people with such an interest in Rexx, who so kindly answered questions and who greatly improved this book with their suggestions.

I would like to give heartfelt thanks to María Teresa Alonso y Albado, W. David Ashley, Gil Barmwater, Dr. Dennis Beckley, Alex Brodsky, Frank Clarke, Steve Coalbran, Ian Collier, Les Cottrell, Michael Cowlishaw, Chip Davis, Prof. Rony Flatscher, Jeff Glatt, Etienne Gloux, Bernard Golden, Bob Hamilton, Henri Henault , Stéphane Henault, Mark Hessling, Jack Hicks, IBM Corporation, René Vincent Jansen, Jaxo Inc., Kåre Johansson, Kilowatt Software, Les Koehler, Laboratorios Bagó S.A., Joseph A. Latone, Henri LeFebure, Michael Lueck, Antoni Levato, Dave Martin, Rob McNair, Patrick TJ McPhee, Dr. Laura Murray, Walter u. Christel Pachl, Lee Peedin, Priscilla Polk, the Rexx Language Association, Pierre G. Richard, Peggy Robinson, Morris Rosenbaum, Dr. Elizabeth Rovelli, David Ruggles, Roger E. Sanders, Thomas Schneider, Theresa Stewart, UniForum Chicago, Vasilis Vlachoudis, Stan Wakefield, Keith Watts, Dr. Sandra Wittstein, and Claudio Zomparelli.

Beyond those who provided technical advice and input for this book, I wish to thank my editors at John Wiley and Sons, Inc. Eileen Bien Calabro greatly improved the readability of this book through her writ- ing recommendations. Debra Williams Cauley provided insightful perspective and guidance on the preparation and organization of the book. Finally, I thank Richard Swadley. I appreciate his confidence and hope this book fulfills its promise both in the quality of its material and in its sales and distribution.

Special thank you to the following developers for permission to reprint or refer to their code (most of these items fall under various open source licenses):

W. David Ashley—IBM Corporation, project leader of the Mod_Rexx project for scripts appearing in the chapter on Apache programming with Mod_Rexx

Les Cottrell and the Stanford Linear Accelerator Laboratory—Authors of Rexx/CGI for a illustrating their Rexx/CGI library

Henri Henault & Sons—Authors of the Internet/REXX HHNS WorkBench for a script and screen shot illustrating the Internet/REXX HHNS WorkBench. 01_579967 ffirs.qxd 2/4/05 12:12 PM Page xii

Acknowledgments

Mark Hessling—Developer/maintainer of Regina Rexx and many open source Rexx tools for material on Rexx/gd and the reference tables of Rexx/Tk functions

Patrick TJ McPhee—Developer of RexxXML for the example program appearing in the chapter on RexxXML

Pierre G. Richard, Joseph A. Latone, and Jaxo Inc.—Developers of Rexx for Palm OS for example scripts appearing in the chapter on Rexx for Palm OS 02_579967 ftoc.qxd 2/3/05 9:01 PM Page xiii

Contents at a Glance

Foreword ix Acknowledgments xi Introduction xxix

Part I 1 Chapter 1: Introduction to Scripting and Rexx 3 Chapter 2: Language Basics 21 Chapter 3: Control Structures 33 Chapter 4: Arrays 53 Chapter 5: Input and Output 67 Chapter 6: String Manipulation 79 Chapter 7: Numbers, Calculations, and Conversions 99 Chapter 8: Subroutines, Functions, and Modularity 109 Chapter 9: Debugging and the Trace Facility 133 Chapter 10: Errors and Condition Trapping 143 Chapter 11: The External Data Queue, or “Stack” 159 Chapter 12: Rexx with Style 169 Chapter 13: Writing Portable Rexx 189 Chapter 14: Issuing System Commands 209 Chapter 15: Interfacing to Relational 229 Chapter 16: Graphical User Interfaces 255 Chapter 17: Web Programming with CGI and Apache 273 Chapter 18: XML and Other Interfaces 291

Part II 305 Chapter 19: Evolution and Implementations 307 Chapter 20: Regina 331 Chapter 21: Rexx/imc 345 Chapter 22: BRexx 359 Chapter 23: Reginald 385 Chapter 24: Handhelds and Embedded Programming 421 Chapter 25: Rexx for Palm OS 433 Chapter 26: r4 and Object-Oriented roo! 447 Chapter 27: Open Object Rexx 459 Chapter 28: Open Object Rexx Tutorial 475 02_579967 ftoc.qxd 2/3/05 9:01 PM Page xiv

Contents at a Glance

Chapter 29: IBM Mainframe Rexx 493 Chapter 30: NetRexx 515

Part III 529 Appendix A: Resources 531 Appendix B: Instructions 535 Appendix C: Functions 547 Appendix D: Regina Extended Functions 573 Appendix E: Mainframe Extended Functions 593 Appendix F: Rexx/SQL Functions 597 Appendix G: Rexx/Tk Functions 607 Appendix H: Tools, Interfaces, and Packages 615 Appendix I: Open Object Rexx: Classes and Methods 619 Appendix J: Mod_Rexx: Functions and Special Variables 623 Appendix K: NetRexx: Quick Reference 629 Appendix L: Interpreter System Information 635 Appendix M: Answers to “Test Your Understanding” Questions 637

Index 657

xiv 02_579967 ftoc.qxd 2/3/05 9:01 PM Page xv

Contents

Foreword ix Acknowledgments xi

Introduction xxix Who This Book Is For xxx What This Book Covers xxxi How This Book Is Structured xxxi What You Need to Use This Book xxxii Conventions xxxii Source Code xxxiii Errata xxxiii p2p.wrox.com xxxiv Part I 1

Chapter 1: Introduction to Scripting and Rexx 3 Overview 3 Why Scripting? 3 Why Rexx? 6 Power and Flexibility 7 Universality 8 Typical Rexx Applications 9 What Rexx Doesn’t Do 11 Which Rexx? 12 Downloading Regina Rexx 14 Installing Regina under Windows 15 Installing Regina under and 17 Installing Regina with Red Hat Package Manager 19 Summary 20 Test Your Understanding 20

Chapter 2: Language Basics 21 Overview 21 A First Program 21 02_579967 ftoc.qxd 2/3/05 9:01 PM Page xvi

Contents

Language Elements 24 Operators 27 Summary 32 Test Your Understanding 32

Chapter 3: Control Structures 33 Overview 33 in Rexx 34 IF Statements 35 DO Statements 37 A Sample Program 38 SELECT Statements 40 CALL Statements 41 Another Sample Program 43 Unstructured Control Instructions 47 Summary 50 Test Your Understanding 50

Chapter 4: Arrays 53 Overview 53 The Basics 54 A Sample Program 57 Associative Arrays 60 A Sample Program 61 Creating Data Structures Based on Arrays 63 Summary 64 Test Your Understanding 65

Chapter 5: Input and Output 67 Overview 67 The Conceptual I/O Model 67 Line-Oriented Standard I/O 69 Character-Oriented Standard I/O 72 Conversational I/O 75 Redirected I/O 75 I/O Issues 76 Summary 77 Test Your Understanding 77

xvi 02_579967 ftoc.qxd 2/3/05 9:01 PM Page xvii

Contents

Chapter 6: String Manipulation 79 Overview 79 Concatenation and Parsing 79 A Sample Program 84 String Functions 89 The Word-Oriented Functions 92 The Bit String Functions and Conversions 96 Summary 98 Test Your Understanding 98

Chapter 7: Numbers, Calculations, and Conversions 99 Overview 99 The Basics 100 Numeric Functions 103 Conversions 105 A Sample Program 106 Summary 107 Test Your Understanding 108

Chapter 8: Subroutines, Functions, and Modularity 109 Overview 109 The Building Blocks 110 Internal Functions and Subroutines 111 Passing Parameters into a Script from the Command Line 115 Passing Parameters into Subroutines and Functions 116 A Sample Program 118 The Function Search Order 120 Recursion 121 More on Scoping 123 Another Sample Program 128 Summary 130 Test Your Understanding 131

Chapter 9: Debugging and the Trace Facility 133 Overview 133 The say Instruction 133 The trace Instruction 135 Reading Trace Output 138 The trace Function 139

xvii 02_579967 ftoc.qxd 2/3/05 9:01 PM Page xviii

Contents

Interactive Tracing 140 Summary 142 Test Your Understanding 142

Chapter 10: Errors and Condition Trapping 143 Overview 143 Error Trapping 143 How to Trap Errors 144 A Sample Program 146 An Improved Program 148 Special Variables 151 signal versus call 152 The condition Function 154 A Generic Error-Trap Routine 155 Limitations 156 Summary 157 Test Your Understanding 157

Chapter 11: The External Data Queue, or “Stack” 159 Overview 159 What Is the Stack? 160 An Example — Placing Data into the Stack and Retrieving It 162 Another Example — The Stack for Interroutine Communication 165 Practical Use of the Stack 166 Summary 168 Test Your Understanding 168

Chapter 12: Rexx with Style 169 Overview 169 Capitalize on Capitalization 170 Good Variable Naming 171 Use Spacing and Indentation 172 Limit Nesting 174 Comment Code 175 Write Modular Code 177 Write Structured Code 178 Handle Errors 179 Additional Suggestions 181 Subscripts 181 Quotation marks for commands 181 Consider declaring all variables 182 xviii 02_579967 ftoc.qxd 2/3/05 9:01 PM Page xix

Contents

Rexx-aware editors 183 Publish site standards for coding style 183 Consider automated tools to ensure standards compliance 183 Consider code reviews 183 Avoid Common Coding Errors 184 Failing to end a comment 184 Failing to end a literal string or parenthetical expression 184 Improper coding of functions 184 Forgetting that functions return a string 184 Using parentheses on call 185 Failure to use commas on call or in parse arg 185 Confusing command-line arguments with internal routine arguments 185 Global variables 185 Forgetting return or 186 Forgetting about automatic uppercase conversion 186 Incorrectly continuing a statement 186 Failing to use strict comparisons 187 Incorrectly coding strict comparisons for numbers 187 Summary 187 Test Your Understanding 187

Chapter 13: Writing Portable Rexx 189 Overview 189 Factors Affecting Portability 190 Rexx Standards 192 How a Script Learns about Its Environment 195 A Sample Program 200 Techniques for Command Portability 201 Issues in Code Portability 202 I/O and Code Portability 205 Interfaces for Portability — RexxUtil 206 Summary 207 Test Your Understanding 207

Chapter 14: Issuing System Commands 209 Overview 209 Issuing Commands 211 Feedback from OS Commands 213 Controlling Command I/O 216 A Few Examples 218 Discovering Defaults — the address Function 220 Issuing Commands to Other Environments 220 xix 02_579967 ftoc.qxd 2/3/05 9:01 PM Page xx

Contents

A Sample Program 222 Using the Stack for Command I/O 225 Summary 227 Test Your Understanding 227

Chapter 15: Interfacing to Relational Databases 229 Overview 229 Rexx/SQL Features 230 Downloading and Installing Rexx/SQL 231 The Basics 232 Example — Displaying Database Information 234 Example — Create and Load a Table 239 Example — Select All Results from a Table 241 Example — Select and Update Table Rows 243 Example — Cursor Processing 245 Bind Variables 247 Working with Other Databases 248 Connecting to Oracle 248 Connecting to DB2 UDB 248 Connecting using ODBC 249 Connecting to MySQL 249 Oher database differences 249 Other Database Interfaces 250 Summary 253 Test Your Understanding 253

Chapter 16: Graphical User Interfaces 255 Overview 255 Rexx/Tk 256 Rexx/DW 256 Rexx Dialog 257 OODialog and the Object REXX GTK+ Project 257 Dr. Dialog, VX*Rexx, VisPro Rexx 257 Rexx/Tk 258 Downloading and installing 258 Basic script design 259 A simple example 260 Your next steps 264 Rexx/DW 264 Components 264 Downloading and Installing Rexx/DW 265

xx 02_579967 ftoc.qxd 2/3/05 9:01 PM Page xxi

Contents

Basic script design 265 Your next steps 266 Graphical Images with Rexx/gd 266 The logic of a Rexx/gd routine 267 A sample program 268 Summary 272 Test Your Understanding 272

Chapter 17: Web Programming with CGI and Apache 273 Overview 273 Common Gateway Interface 273 The cgi-lib.rxx library 274 The Internet/REXX HHNS WorkBench 276 Programming Apache with Mod_Rexx 281 Functions and special variables 282 Installation 282 A sample script 283 Example — Rexx Server Pages 287 Further Information 288 Summary 288 Test Your Understanding 289

Chapter 18: XML and Other Interfaces 291 Overview 291 XML with RexxXML 291 Licensing, downloading, and installation 295 Common operations 295 A sample script 299 Other Rexx Tools, Interfaces and Extensions 302 Summary 303 Test Your Understanding 303 Part II 305

Chapter 19: Evolution and Implementations 307 Overview 307 The Evolution of Rexx 308 Free Rexx Implementations 311 Which Rexx? 313

xxi 02_579967 ftoc.qxd 2/3/05 9:01 PM Page xxii

Contents

Rexx Intepreters 315 Regina 317 Rexx/imc 318 BRexx 318 Reginald 318 Rexx for Palm OS 318 r4 319 Object-Oriented Rexx 319 roo! 319 Open Object Rexx 319 NetRexx 320 Mainframe Rexx 320 Other IBM Rexxes 321 Rexx for Handhelds and Embedded Programming 321 Commercial Rexxes 322 uni-Rexx by The Workstation Group 323 Personal Rexx by Quercus Systems 323 S/Rexx by Treehouse Software Inc. 323 Rexx 323 Rexx and Tokenizers 323 Running Rexx in the 324 Rexx As an API 324 Rexx As a Macro Language 324 Multiple Rexx Interpreters on One 325 The Future of Rexx 327 Summary 327 Test Your Understanding 328

Chapter 20: Regina 331 Overview 331 Advantages 332 Regina’s Extras 333 Interpreter options 334 Functions 335 Access to function libraries 339 Regina’s SAA API 343 Sample Scripts 343 Summary 343 Test Your Understanding 344

xxii 02_579967 ftoc.qxd 2/3/05 9:01 PM Page xxiii

Contents

Chapter 21: Rexx/imc 345 Overview 345 Advantages 345 Installing Rexx/imc 346 Features 348 The C-language I/O Model 351 Interfaces and Tools 351 A Sample Program — Environmental Information 352 A Sample Program — I/O 354 Summary 356 Test Your Understanding 357

Chapter 22: BRexx 359 Overview 359 Advantages 360 Downloading and Installation 360 Windows installation 361 Windows or DOS installation 362 Linux installation 362 Unix installation 362 Windows CE installation 363 Extra Built-in Functions 363 Input/Output 364 The External Function Libraries 366 Windows CE 367 Issuing Operating System Commands 368 Example — C-like I/O 369 Example — ANSI Screen I/O with Random Data Access 371 Example — Direct Data Access 376 Example — DOS Functions 378 Summary 383 Test Your Understanding 383

Chapter 23: Reginald 385 Overview 385 Advantages 385 Download and Installation 386 Tools 386 Windows GUI 388 GUI Development Aids 390 Input/output 390 xxiii 02_579967 ftoc.qxd 2/3/05 9:01 PM Page xxiv

Contents

Documentation and Tutorials 392 Other Features and Functions 393 Operating system commands 393 Options 394 395 GUI trace panel 395 Error conditions 395 Windows DLLs 395 Sorting 396 Multiple stacks 396 Parameter passing 396 do over loop 396 Array indexing 397 Improved interpret instruction 398 Other functions 398 Leveraging Reginald 399 Sample Scripts — File, Directory, and Drive Management 400 Example — display file information 402 Sample Scripts — GUIs 404 Another GUI Example 409 Let My Computer Speak! 412 MIDI Rexx 414 Accessing the Windows Registry 416 Summary 418 Test Your Understanding 419

Chapter 24: Handhelds and Embedded Programming 421 Overview 421 Programming Handhelds 422 Running Native — /EPOC32 426 DOS Emulation 426 PocketDOS 427 XTM 428 Embedded Device Programming 429 Summary 430 Test Your Understanding 431

Chapter 25: Rexx for Palm OS 433 Overview 433 Advantages 434 Downloading and Installation 434

xxiv 02_579967 ftoc.qxd 2/3/05 9:01 PM Page xxv

Contents

A Tutorial 435 Summary 444 Test Your Understanding 445

Chapter 26: r4 and Object-Oriented roo! 447 Overview 447 Advantages 447 Downloading and Installation 448 Preinstall 448 Verification 449 Documentation 449 Tools 450 Object-Oriented Programming with roo! 452 Summary 456 Test Your Understanding 457

Chapter 27: Open Object Rexx 459 Overview 459 Background 460 Features 460 Open Object Rexx for Linux 462 Installation using Red Hat Package Manager 463 Installation without Red Hat Package Manager 463 Postinstall steps 464 The Basics 464 The Class Libraries 468 Other Object Rexx Additions 469 New operators 469 Directives 470 Built-in objects 470 Special variables 471 New instructions 471 New functions 472 New condition traps 472 New utility functions 472 Rexx API 472 Open Object Rexx for Windows 472 Summary 473 Test Your Understanding 474

xxv 02_579967 ftoc.qxd 2/3/05 9:01 PM Page xxvi

Contents

Chapter 28: Open Object Rexx Tutorial 475 Overview 475 A First Program 476 Squaring a Number — Using Our Own Class and Method 477 Another Simple OO Program 479 Implementing a Stack through Objects 481 A Video Circulation Application 485 Concurrency 489 Summary 491 Test Your Understanding 492

Chapter 29: IBM Mainframe Rexx 493 Overview 493 VM Rexx Differences 494 First line 494 Online facility 495 File types 496 “Not” symbol 496 OS commands 496 Instructions 496 Functions 497 Function packages and external functions 498 CMS immediate commands 498 498 Useful CMS commands 499 OS/TSO Rexx Differences 500 Additional instructions and functions 501 TSO/E external functions 501 TSO/E Rexx commands 501 TSO/E programming services 503 Mainframe Rexx and the Language Standards 503 Interfaces 504 Sample Scripts 506 Migrating Mainframe Scripts to Other Platforms 512 Applying Your Rexx Skills to Other Platforms 513 Further Information 513 Summary 513 Test Your Understanding 514

xxvi 02_579967 ftoc.qxd 2/3/05 9:01 PM Page xxvii

Contents

Chapter 30: NetRexx 515 Overview 515 Why NetRexx? 515 Do You Have to Know Java to Use NetRexx? 516 Downloading and Installation 517 Ways to Run NetRexx Programs 518 Features 519 Sample Programs 523 A simple sample applet 525 Summary 526 Test Your Understanding 527 Part III 529 Appendix A: Resources 531

Appendix B: Instructions 535

Appendix C: Functions 547

Appendix D: Regina Extended Functions 573

Appendix E: Mainframe Extended Functions 593

Appendix F: Rexx/SQL Functions 597

Appendix G: Rexx/Tk Functions 607

Appendix H: Tools, Interfaces, and Packages 615

Appendix I: Open Object Rexx: Classes and Methods 619

Appendix J: Mod_Rexx: Functions and Special Variables 623

Appendix K: NetRexx: Quick Reference 629

Appendix L: Interpreter System Information 635

Appendix M: Answers to “Test Your Understanding” Questions 637

Index 657

xxvii 02_579967 ftoc.qxd 2/3/05 9:01 PM Page xxviii