Rexx Programmer's Reference
Total Page:16
File Type:pdf, Size:1020Kb
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 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 form 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-copy 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. at (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 print 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 database 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 programming language; elegant in design, simple syntax, easy to learn, use and maintain, yet as powerful as any other scripting language available today. In 1979, Mike Cowlishaw, IBM fellow, designed a “human-centric” programming language, Rexx. Cowlishaw’s premise was that the programmer should not have to tell the interpreter 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 time 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 macro 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 text editor, 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/Tk, 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 library for a script 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.