Home

stanf~rdlinearacceleratorcenter stanf~rduniversi~,stanford

image

Contents

1. A A e M d e er ee ewe sql connect sample lt 0 Then Do Say sql error text Exit End a i a M M e e a wr t ee M M e a e e e M e ee ee SELECT name FROM sysibm systables WHERE name rm var STAFF if sql command q1 st parm var lt 0 Then Do En Do Say sql error text Exit M a e e A M e e M e oan e i 1 To ql name 0 Say Table qi name i d M e e M M M M A e M A a re A a e M a n n m en ema M M e a if sql command q1 COMMIT lt 0 Then Do Say sql error text Exit End
2. a e Display the name and payment details for all employees Employee information is stored in a DB2 database financial information stored in an Oracle database REXX SQL multi database example y cms REED NAE C SEE EE an an ar A a ore ce M cc ee nee ee ce ee ee ee ee ee ee ee ne re x Load the Oracle and DB2 external function libraries ma me ee a e a A M x Call rxfuncadd LoadOracleFuncs REXXSQL LoadOracleFuncs Call LoadOracleFuncs Call rxfuncadd LoadDB2Funcs REXXSQL LoadDB2Funcs Call LoadDB2Funcs a am m a uio GER an an ap ve UD UND an ap DU UND am am aa ARD ee lee UD AED p is CER UD GA Ge UD UND GEL AG KAP UD UND SED GU Ua P UND Gum Sue ame ap up ee um um ame cn ATO Connect to local Oracle database pn 9 If oracle connect 0 Then Do Say oracle error text Exit End 2 22 22 22 2 2 222 2 2 2 2 2 2 2 2 22 2 x Connect to local DB2 database PERSONNEL rer r x If DB2 connect PERSONNEL O Then Do Say DB2 error text
3. This tag indicates the classes that should be inherited from More than one class may be specified This tag may be used more than once within a class definition vars lt var gt var This tag indicates the variables associated with the class More than one variable may be specified This tag may be used more than once within a class definition Note stem variables may NOT be used Use RoxAddVar to add stem variables to an object method lt methodName gt This tag indicates that the code for the method named lt methodName gt follows The code for the method ends at the next tag including comment or end of file 5 C Programming Interface ROX methods can be implemented in compiled languages such as C via a DLL The function RoxClassAddMethodDll adds a method to a class that points to a function in a DLL The function in the DLL must have the following signature amp 2 2 2 2 2 2 2 2 2 2 2 2 typedef for function that handles method invocation Br rn nr a en ee ee ee typedef ULONG APIENTRY RoxMethodHandlerType void object PUCHAR name ULONG argc PRXSTRING argv PRXSTRING retString The parameters passed to the method are 198 5 C PROGRAMMING INTERFACE object a pointer to the ROX object receiver name the name of the method arge the number of arguments passed to the method argv array of RXSTRINGs that make up the parameters retS
4. Exit End M Declare queries to be performed 2 2l 22l2 2 2l2 2 2 22 2 2 2 222 22 222 2 2 222 2 22 22 2 queryl select name empno from emp order by name query2 select amt paydate from gl trans where accno ACCNO Ya re EN cedunt DEN CUN ME MM RUM my a ne Pr Execute the first query on the DB2 database and return all rows we M a A wn M uA A D H A M if DB2 command qi queryl lt 0 Then Do Say DB2 error text Exit End p D x For each employee record obtain the payment details from the Oracle database and display them MA i u A wt A UM we P e en Uo dus e M we M a A A e M a a D Do i 1 To qi name 0 if oracle command q2 query2 ACCNO ql empno 1 lt 0 Then Do Say oracle error text Exit End Say a Say Right ql empno i 8 Left ql name i 35 Do j 1 To q2 amt 0 Fii Copies 15 Left q2 paydate j 12 Right q2 amt j 12 En End ALL IEWIIXLIueL ILLILLII llllLlolcxlc lccollolclle cilnlc z2Lfl2ccuc Disconnect from the Oracle database am aa ae A an as am DO te coe ae Se MS he MY SD a gt GAP A a DS A a SEY a SS a
5. fred 1 Tom fred 2 Chris fred 3 Alex do tail over fred say fred tail in end on SAAN gt Alex gt Chris Date Conversions Convert date to standard formats Example say date usa 19931225 standard gt 1 2 25 93 c say date european 19931225 standard gt 25 1 2 93 Techniques for Performance Tuning REXX Interpreters A Case Study of Regina Anders Christensen Sintef Runit 24 Techniques for Performance Tuning Rexx Interpreters A Case Study of Regina Anders Christensen lt anders christensen runit sintef no gt The Rexx Symposium for Developers and Users Boston May 1 4 1994 Abstract This article describes some of the techniques and methods used for optimizing the Regina interpreter a REXX interpreter written in C originally for Unix systems The methods described first may be regarded as optimalization techniques in isolation but they are also prerequisites for the last technique described here the creation and maintenence of shortcut pointers from the parse tree to the variable structure 1 Introduction When tuning a program like a REXX interpreter for improved speed a number of general tech niques are used Some of these are interesting in themselves but not very specific to REXX interpreters The scope of this text is to present some of the techniques that are closely related to the datastructures and operations of REXX interpreters 2 Datatyping Var
6. 0 ones length space ones 0 parity ones 2 Sets PARITY to 1 May 1994 Mike Cowlishaw SUBSTR LEFT and RIGHT SUBSTR or LEFT can take a pad character say substr Fred 1 8 say left Fred 8 both say Fred RIGHT can pad on the left or return rightmost characters say right 12 6 0 say right e extra cmd 3 says 000012 and cmd May 1994 Mike Cowlishaw TRANSLATE As well as character substitution TRANSLATE can be used to reformat lay out strings in abcdefgh pattern gh ef abcd say translate pattern Says 27 08 1994 19940827 in May 1994 Mike Cowlishaw VERIFY VERIFY can look for the odd one in as well as the odd one out say verify 123 456 0123456789 Says 4 but say verify It s 1994 13579 Match Says 6 May 1994 Mike Cowlishaw 9 And finally Shuffle the numbers in range 1 gt max shuffle procedure signal off novalue max arg 1 out do i l to max sub random i max out out substr ar sub 4 if sub i then iterate ar sub ar 1 end return out May 1994 Mike Cowlishaw IBM Views on REXX James Crosskey IBM James Crosskey REXX Development IBM Endicott NY l Internet id crosskey gdlvm7 vnet ibm com REXX Excitement mes Customer support of REXX SHARE GUIDE COMMON SEAS REXX Symposium OS 2 Technical Interchange
7. REXXLIST uga uga edu General Rexx discussion vm gmd de nic surfnet nl vm ucs ualberta ca ucflvm cc ucf edu PC REXX bitnic educom edu Personal REXX REXXCOMP Ditnic educom edu REXX Compiler TSO REXX _bitnic educom edu TSO REXX VM REXX vm marist edu VM CMS Rexx ANSIREXX psuvm psu edu ANSI Documents 139 Rexx Resources on the Internet Discussions via Listserv Programs available via Listserv Info available via FTP Info available via Gopher How to subscribe to a Listserv list e Send mail to listserv list location The Subject can be anything or can be omitted The body of the mail should be SUBSCRIBE list name your full name Example SUBSCRIBE rexxlist Linda Littleton Notes Be sure to send the mail to LISTSERV not to the list How to Send a Message Write to list name list location e Whatever you write is forwarded to everyone on the list Rexx programs available via Listserv Library Location rexxlib psuvm psu edu psutools psuvm psu edu vm util vm gmd de ubvm cc buffalo edu vm marist edu Other Useful Listserv commands SIGNOFF list name unsubscribe from the list REVIEW list name get a list of people subscribed LIST GLOBAL get a list of all Listserv lists HELP How to get programs from a Listserv Send commands one per line in the body of the mail to LISTSERV Qllocation To get a list of packages GET library FILELIST To get the
8. i allie Development System Editor File System Panel interface REXX Future Directions Wide range of platforms Apply new technology Object Oriented programming SOM DSOM etc Visual Programming tools OpenDoc peste Communications MultMedia Database Encourage use of REXX as the application extender Improve documentation Primer on line tutorial j Books books and more books Expand user base gt Students non glass house and OS 2 users The Open Scripting Language Coming to a system near you L Trademarks IBM OS 2 AIX OS 400 REXX 6000 IBM REXX for NetWare REXX for CICS ESA REXX VSE CICS ESA VSE ESA are registered trademarks of International Business Machines Corporation UNIX is a trademark of X Open Company Ltd NetWare is a trademark of Novell Inc Windows is a trademark of Microsoft Corporation VX REXX is a product of WATCOM International Corporation VisPro REXX is a product of HockWare Inc GpfRexx is a product of Gpf Systems Inc Choosing a Command Language An Application Centric Approach Hal German GTE Choosing a Command Language An Application Centric Approach Hallett German GTE Laboratories Incorporated An Introduction to this paper For over four years the author has discussed a means for beginning and intermediate command language users to quickly choose the essential elements of their
9. ee ew ee er ee ee ee a A ee we If rxfuncquery SQLDBS 0 Then rey rxfuncadd SQLDBS SQLAR SQLDBS rxfuncquery SQLEXEC 0 Then rey rxfuncadd SQLEXEC SQLAR SQLEXEC we ee ee a M wee Call sqlexec CONNECT TO sample IN SHARE MODE If st SQLCA SQLCODE 0 Then Do Say CONNECT TO Error SQLCODE SQLCA SQLCODE Exit End ae Prepare and declare the cursor for the SQL statement e e SELECT name FROM sysibm systables WHERE name lt gt Call sqlexec PREPARE sl FROM st Call sqlexec DECLARE cl CURSOR FOR s81 If El Ca Re SQLCA SQLCODE 0 Then Sa
10. 0 iO 00000004 10 amp aj amp 2 j 74 amp Q amp i ah 810 A 0 00000005 amp amp amp aq This program cop00000006 yrighted for MY Company Vienna Austria 800000007 b 00000008 h 00000009 A a 00000010 J a 00000011 AER J 1 A 0 100000012 0 0 g j e l o 00000013 H Ru EO E K E amp G ON amp E j 00000014 k R amp X C 7 8 2M y 1 900000015 Ek S I T F C 0 A2 12 k 00000016 S G amp S L H B amp k K gt 2 00000017 amp f l k K 2 b d f 6h k Yi 2m 1400000018 j bE 8 Z B J e BY a amp 00000019 e j 6 M Lj 000000203 B n 00000021 1569501301 010094074 00000022 a a Alternate Library Compile program with ALTERNATE and SOURCELINE e use CONDENSE to hide source e DLINK does not work Distribute Alternate Library without royalties without paperwork Alternate Library is installed on systems without Library invokes interpreter when compiled program is run Distributing REXX Library optional required optional Source exposed not exposed hidden CONDENSE Maintenance problems no problems no problems Packaging few options all options some options What s missing TRACE support a REXX I O for CMS 2 INCLUDE facility 1 MARGINS Agenda News from the REXX Compiler Packaging an application General
11. 01590698 61666908 61618088 01628988 01630990 81646666 61646166 91640280 61640300 01640408 81646508 61648698 81648708 61645898 81649988 61641608 81641186 61641208 61641366 63641460 81641508 61641660 616580608 91660099 61670600 81680608 916900098 61766606 01710008 81726008 81729000 81739008 01740060 01758000 01766808 81778009 81786006 01790098 91886008 01810088 01826088 82350800 92360689 82370608 62380098 62390008 82400008 02410066 82420000 62430606 82440060 92450060 02468098 824760698 02480000 82496008 82506080 62516986 02520000 925300600 02548090 62550008 62568006 92576088 02580000 62596068 62600098 92610000 02620009 92630068 82648000 82650608 82660998 02670098 62680088 82690008 62700600 62716980 62729800 62730089 62746890 92758068 82769608 92770098 94 Function Packages ST l svc BR R6 0NLADUR R15 X 6600B090 284 R18 Add to startup PSW tok Plist COPY FENCE flags Return See if function is already a nue teus extension make it a nucleus extension if not CMS rel v2021 svc oc LTR 202 AL4 1 RIS RIS RE EUNOFES R6 8 R6 RIZ5 R6 ONLADDR 282 At4 1 Rie USING R2 Fall through if error Exists Yes immediate return toad address offset True start address Add to startup PSW Ignore errors Return Restore USING status RESET request switch off functions DOOFF v2042 dd USING DNUCX R13 Save USING stat
12. 1 3 Object creation Objects are created and destroyed with the RoxCreate and RoxDestroy func tions described in Object Lifecycle Functions on page 9 The RoxCreate func tion takes the name of the class to create the object from and any number of additional parameters to initialize the object The RoxCreate function returns an object reference This object reference is a regular REXX string with a par ticular value which the ROX functions can use to dereference the object This object reference is used as the first parameter for method invocation When an object is created the init method for the class is invoked Likewise when an object is destroyed the deinit method for the class is invoked If the 10S 2 is a trademark of International Business Machines Corporation 190 1 INTRODUCTION tnit or deinit methods are not defined in the class they will be searched for in inherited classes 1 4 Method invocation Once an object is created you can send messages to it This is also commonly referred to as invoking a method The message is the name of the method along with parameters that the method should be passed To invoke a method use REXX function call invocation The name of the function is the name of the method prefixed by The first parameter to the function is an object reference and any other method specific parameters can be passed as well It s time for a short example In this example we create an objec
13. 1 then exit Send the message OSI Severity if modemSend path ATDT message nl OK 1 then exit address UNIX sleep 5 Clean up if modemSend path ATDT4 nl OK 1 then exit if modemSend path ATH nl OK 1 then exit Disconnect from the path r ao targetClose path 123 Fri April 29 1994 exit BERERRRKREAREREREREEEREENEERER modemSend sends the contents of str Using REXX in a Unix Environment to Manage Network ve fe ie e de e fe dede de e fe e de de de dee e dee e e dede he e de de e efe dede de dee dee e ing to modem and checks that the response from the modem contains the contents of pattern je He he e dede de dede dede de de fede dee de e e e eee dee e Ae He e e ee de dee eee fe de deje dede dede dede de e de de e e dee dee e e ee ke y modemSend arg path string pattern len length string Find the cursors current location on the screen r ao targetCommpath 7 0 cursor 0 if rc AON_noError then do say Can t find cursor rc rc return 1 end Send the command to the modem r ao targetComm path 15 String len 0 if rc AON noError then do say Send failed rc re return 1 end Loop ten times waiting each time 2 seconds for a response do 10 address UNIX sleep 2 Look for response following cursor position r ao targetComm path 8 string PSsize cursor curs
14. a a eu a e a e S a a M ee e e wre m a M e a we if sql disconnect lt 0 Then Re Do Say sgl error text Exit End turn What is GUROO In its current original form GUROO is a standalone program written using Oracle s Pro C and linked with Regina GUROO is really 7 external functions sql connect connect to an Oracle database sql disconnect disconnect from an Oracle database sql command execute an SQL command select update etc sql open cursor Open a cursor sq close cursor close a cursor sq fetch row fetch a row from a cursor sq error text return the text of the last GUROO or Oracle error For more details on the syntax of these functions see the attachment Current Status GUROO is currently in use solely as an internal tool within the Information Systems section of Griffith University Many of the DBA tools are written using GUROO and the programming staff have also begun to use GUROO in situations where the Oracle supplied tools are inappropriate In one instance GUROO has replaced one function which was originally written using various combinations of
15. and the exponent a native integer Consider the REXX statements 5 so Rexx statement Numeric String e After the first line foo contains the numeric value 2 while its string value is not set Note that it is not undefined it can easily be converted from the numeric format if necessary e In the second line the string value of foo is retrieved which means that the numeric value is converted After the second line both a numeric and a string value are stored for the foo variable e In the third line the numeric value of foo is retrieved and used in an expression which results in a string value At the end of that statement the foo variable is set to a new string value and the numeric value becomes unset e In the fourth line the numeric value of foo is retrieved However at that point the foo variable have only a string value so when retriving the value the current string value is expanded to a numeric value After the fourth line both a string and numeric value are set Why maintain this double accounting It turns out that variables set to a string value are very rarely used in numeric expressions And vice versa when a variable is set to a numeric value it is seldom used in a string context except for output statements which tend to be slow anyway Based on these two observations it makes sense to have two parallel highly optimized sets of functionality for operating variables one for numeric values
16. third example do i 1 to 2 call bar end exit bar procedure expose i if i 1 then foo say foo return Here the second invocation of bar finds the cached pointer in the SAY clause but the pointer is invalid even though the generation number is correct To handle this case variables discarded during the execution of the RETURN clause are not immediately discarded if there are any shortcut 30 pointers pointing to it as recorded by the shortcut counter field Instead it is suspended until all shortcut pointers point elsewhere at which time the box is deallocated In the meantime a flag is set for the variable box so that the interpreter can discover that the box is invalid if it tries to dereference the shortcut pointer fourth example do i 1 to 4 if i 2 then do drop i i 2 end end The code of the fourth example as shown above illustrates why the delete flag is necessary The variable box created at the start of the loop is dropped during the loop so a mechanism is necessary to detect that the box is invalid at the start of the next iteration 8 Algorithms The two algorithms shown are the the central for the correct operation of the shortcut pointers in Regina The first algorithm is shown in figure 5 and describes how to access retrieve or update the value of a variable To be effective it requires that the code has been executed at least once before so that shortcut pointers have been created f
17. 243 Questions REXX CICS May 4 1994 C Copyright IBM Corporation 1993 1994 444 Foils 5 3 4 REXSYM94 11 foils 0 notes Apr 17 92 Apr 29 94 17 12 Pitch 6 10 Bind 7 7 Tags Release 4 0 0 245 Working and Playing with REXX and OS 2 Multimedia Timothy Sipples IBM 246 Working and Playing with REXX and OS 2 Multimedia Timothy F Sipples _____IBM Personal Software Products 7 Chicago Illinois 7 s 312 245 4003 i 312 245 7624 fax Internet usibS8c5 ibmmail com What is Multimedia Combining still images bitmaps animation software motion video text and or audio to present information Principle technologies CD ROM laserdisc digital audio MIDI high resolution displays with more colors Principle file formats WAV MID and AVI Multimedia NOT invented by Comptons We like to call it ULTIMEDIA Why use Multimedia oo o It s the market stupid Triggers to describe events Education training Kiosks point of sale Presentations and demos Better human interfaces generally Entertainment and games Requirements for OS 2 Multimedia 9999999 OS 2 2 1 with Multimedia Presentation Manager 2 included Standard OS 2 hardware requirements Some additional RAM to 12 MB recommended CD ROM drive Audio adapter Creative Labs MediaVision IBM etc Display with at least 256 colors recommended Video capture adapter optional Laserd
18. C shell awk SQL ReportWriter SQL Plus and SQL Loader The GUROO program is quicker smaller and much easier to understand Despite being interpreted the performance of GUROO programs is on par with other Oracle tools Currently GUROO is not available for distribution outside of the Information Systems section of Griffith University 98 Future Directions As a result of Griffith University s reluctance to allow distribution of GUROO and a colleague of mine have begun an independent development of a similar tool REXX SQL The structure and operation of REXX SQL will be fundamentally the same as GUROO but will also include most of the low level functions like PARSE and EXECUTE that exists in current tools This will give users the option of a simple interface or one which they are more familiar for users of RXSQL DB2 etc REXX SQL will have the ability to make multiple connections to the same or different databases from the same vendor or different vendors The ultimate goal for REXX SQL will be to allow a programmer to access data from any combination of SQL databases as though all data were stored in the one database This can really only be achieved by writing each database access functions as dynamically linked libraries that can be loaded at run time Example 3 illustrates this goal 99 Example 3 AA ae a m a M e
19. GX FF 61258066 61266668 61276608 Literal pool 612006008 801296900 First argument 813666088 61316666 61320886 nee ROB PO 0B oROROA E B 5599535 News from the REXX Compiler Supplement News from the REXX Compiler Supplement Cu en p stare Function Packages Sass I ere Function Packages AS USER contains a call to USER3 and a call to USERX 60518668 compile USER with the DLINK compiler option 68520888 LOAD USERFN USERX RLDSAVE 66530686 GENM USERFN NOMAP 08540006 If you do this on CMS rel gt 5 you will get a module 60556008 runnable on CMS rel 5 and later which will reside 68568608 above the 16 M8 line if possible 60570000 USERI USER2 and USER3 are the known functions 60580006 Calls in USER to USER3 and USERX will use DLINK 60598068 60600908 Entry exit conditions 88610060 60620006 Standard SVC conventions 60630008 Ri points to a tokeni ed PLIST 90640080 This code can run with AMODE 24 or AMODE 31 00650008 90660006 Exit 06670008 R15 8 Function successfully loaded or exists 60080008 functions unloaded 60690008 Service call Endcmd call 68786660 R1IS Return code from unsuccesful WUCEXT LOAD 00710000 1 LOAD or RESET but no second argument 80720000 or function not in package 667309086 4 no first argument 60740008 80750668 Maclibs 66766668 DMSSP or DMSGPI 08770009 60788006 Macros and control blocks 66790006 REGEQU 068608060 CMSLEVEL 68
20. Mixin Streom Supplier Indexed SN P E Sequenced Closs String Setlike Sequenced Queue E Array Closs y IndexOnly Manyltem List Directory gt d N el Beg Relation OD That looks a bit daunting but the REXX user doesn t have to be concerned with many of these classes A number of them Collection Indexed IndexOnly ManyItem Queuelike Sequenced and Setlike are abstract classes used only for internal factoring out of common methods In addition the metaclass section of the hierarchy Class Mixin Object Mixin Object Class Sequenced Class and Array Class is shown for completeness but isn t for general use see the section on Metaclasses below That leaves us with the classes that represent other objects Alarm Array Bag Condition Directory List Message Method Object Queue Relation Set Stream String Supplier and Table O Copyright IBM Corporation 1994 The Object REXX Class Hierarchy 21 More on Multiple Inheritance We used the List class to introduce multiple inheritance The List class inherits from the Sequenced and Qucuelike abstract classes which mcans that lists have both the Sequenced and Queuelike properties collections of methods Another way of saying this is that a list can be used whenever either a queuclike or sequenced object is expected and it will work correctly Multiple inheritance can be very useful if used properly but it can cause a lot of problems when it s use
21. OS 2 Technical Conference REXX Language Association tenent 40 REXX books and manuals Pd 9 written in last year alone fo Most recent include gt REXX Reference Summary Handbook m D Goran Mastering OS 2 REXX by G Gargiul o gt Application Development Using OS 2 REXX by A Rudd a R E X X b O O ks a More REXX Excitement rade Press articles 10 articles in 1st quarter 94 Publications include gt PC Week Dr Dobb s Journal OS 2 Computing OS 2 Professional PC Magazine Byte OS 2 iiaii Industry enth usiasm for REXX p n Visual programming with REXX e gt VX REXX VISProREXX GpfREXX ANSI Committee close to a REXX standard Enthusiastic MEN to IBM nn REXX beta program Plan 1993 94 1994 95 X RE IB IBM REXX on AIX and NetWare IBM AIX REXX 6000 5764 057 Available 12 93 Port of IBM s OS 2 REXX kernel to the AIX platform 3 2 5 release and up AS IS release IBM REXX for NetWare 5764 075 Available 3 94 Port of IBM s OS 2 REXX kernel to Novell s _ AS IS release IBM CICS and VSE REXX IBM REXX for CICS ESA IBM REXX VSE 5655 086 Development 5686 058 System 5655 087 Runtime Available 9 93 Facility Port of IBM s TSO E Available 4 94 REXX kernel to Port of IBM s TSO E VSE ESA ges REXX kernel to Supports both compile CICS ESA 3 2 1 or 3 3 and interpreted REXX releases
22. Returns process ID SysWait Waits on child process to end tte IBM REXX for NetWare a Available 3 94 Program number 5 64 075 IBM REXX for NetWare Reference Guide SH24 5286 comments on reference guide can be sent to pubrcf amp galvme vnet ibm com Supports NetWare release 3 11 3 12 or 4 0 p AS IS release ia EX M REXX for NetWare Additional details Port of IBM s OS 2 REXX kernel to Novell s NetWare platform SAA Level 2 gt I O functions charin charout stream etc gt System exits Default command environment ee Address netware load monitor SE REXX for NetWare REXX API s RexxRegisterSubcomNLM registers a subcommand handler from a NetWare loadable module RexxRegisterSubcomAdr registers a subcommand handler from within an application routine ges s Similar API s for registering external functions and exit handlers Gu REXX for NetWare Ol NetWare specific utilities RxConsolePrint Display a line of text on the system console RxDosCopy Copies a file from the DOS partition to the NetWare partition RxDosPresent pr Queries whether DOS is in memory Pt a HxGetNumberOfVolumes Queries the number of volumes on the IgGl server HxGetVolumeName f Given a volume number get the volyfne nam RxQueryNLM REXX Return NLM handle if the NLM is loaded for NetWare gt Indust
23. This function passes a select statement to be parsed prepared and executed The rows that the SQL command retrieves are then made ready for repeated calls by sql fetch row An explicit cursor is associated with the statement name passed This function takes the same arguments as sql command Arguments statement name a string of up to 30 characters to identify the SQL command This is used as the first part of the stem variable name containing column values and as the argument to sql fetch row so it knows from which cursor to fetch rows Sqi command any valid SQL Plus select command bind variable optional bind variables values as specified in the SQL command Return Values 0 successful connection Negative number Oracle error number Example To prepare for returning the names of tables owned by the current user rcode sql open cursor QOl select table name from user tables Assuming the user has select permission on the user tables object rcode is set to 0 See sql fetch row for further examples 105 Synopsis Sq fetch row statement name Description This function retrieves the next row in the previously opened cursor and sets REXX variables for each column specified in the sql command passed to the sql open cursor function The format of the REXX variables set is statement name followed by a period followed by the column name If the value of a column is NULL an extra REXX variable is created See th
24. a column is NULL use the following test If ql col_name null i NULL Then column is NULL Because the contents of all columns for all rows are returned from a select statement the select command may return many rows and exhaust memory Therefore the use of sq command should be restricted to queries that will retum a small number of rows For larger queries use a combination of Sql open cursor and multiple sql fetch row calls When bind variables are used a pair of arguments is used for each unique bind variable name The first argument is the name of the bind variable as specified in the SQL statement the second is the value that bind variable is to take Arguments statement name a string of up to 30 characters to identity the SQL command This is used as the first part of the stem variable name containing column values sql command any valid SQL Plus command bind variable optional bind variables values as specified in the SQL command Return Values Positive number successful operation the number of rows affected by the SQL command Negative number Oracle error number 103 Example To select the names of all tables owned by the current user issue the following call rcode sql command Ql select table name from user tables Assuming the user owns the tables EMP DEPT and CUSTOMER rcode will be set to 3 and the following REXX variables will be set Q1 TABLE_NAME 0 3 Q1 TABLE_NAME 1 E
25. application without using a single piece of code This paper is the first time the approach has been presented to the movers and shakers of the REXX world It supplements the presentation by covering the following Why use such an approach Concepts behind the approach The approach itself Conclusions References akon gt The presentation at the REXX Symposium will provide an overview of the approach as well as an example of how to use and include other factors to consider Handouts can be obtained by contacting the author Why use such an approach In the old days it was easy You used a mainframe host that had one command language and one editor that usually had ties to the command language Then PCs and UNIX systems snuck in from somewhere and the issues became more complex There were more than one command language and editor to choose from Programs could run on more than one operating system and simultaneously if needed Unfortunately the theories and software practices for command languages were not enhanced to match the new realities The approach listed below is a modest attempt to provide command language developers a strategy to deal with the new realities so they don t have to say What do do next Concepts behind the approach 1 What is a command language Unfortunately we only can briefly look at this area My definition of a command language is the following A programming language consis
26. arrays and lists The answer is an abstract class Abstract classes are special classes that don t create instances unlike normal classes like Student and Graduate Instead they provide a set of instance method definitions that can be shared by a number of other classes It s helpful if abstract classes define meaningful properties with a collection of methods that relate to that property For example the property shared between arrays and lists is that of having some internal sequence which can be used to step through the items of the array or list the idea of a first item next item and so on This leads naturally to the idea of a Sequenced class but it s not a normal class since it isn t meaningful to think about making instances of the Sequenced class That s because the Sequenced class doesn t provide enough capability for a functional standalone sequenced object Array and List inherit from Sequenced and add the missing pieces that Sequenced doesn t have We need a name for normal classes that can create instances to distinguish them from abstract classes We call them object classes because these arc the classes whose members instances are real live objects Their names are usually nouns such as Array List and Rectangle In contrast abstract classes define properties or abstractions that describe objects they have no instances and their names are usually adjectives like Sequenced Because of the way
27. be a tty or more likely a port on a terminal server connected remotely via LAN or WAN from the workstation where the REXX was actually executing The resource management system was designed to make the details of the actual connection transparent to the connecting program This means the REXX program need only know a single name to invoke the connection In order to allow the REXX to connect through COMMAND Post s resource management system several functions were added to the language by inserting additional code into the REXX interpreter so it could use UNIX sockets and streams lt fd gt ao_targetConnect lt name gt ao targetClose lt fd gt ao targetComm lt fd gt lt function gt lt data gt lt length gt lt pos gt The first function ao_targetConnect requests the opening of a connection to a named port The name implies more than simply a physical port It also implies a pathway to get there and in some cases a terminal emulation appropriate to the external target system on the other side of the port These are defined externally to REXX by COMMAND Post s system management faciilty A file descriptor or more appropriately a handle is returned by ao targetConnect to identify the path for future communications calls 115 Fri April 29 1994 Using REXX in a Unix Environment to Manage Network The ao targetClose function simply reverses the connect function closing down the path The handle from ao_targetCon
28. com David Hergert Textron Defense Systems 201 Lowell St Rm 3124 Wilmington MA 01887 508 657 2953 Fax 508 657 2776 Mark Hessling Griffith University ITS Division of Information Services Nathan QLD 4111 Australia M Hessling gu edu au 266 Marc Irvin 100 01 Hope St Stamford CT 06906 2500 203 852 3584 Fax 203 852 3570 Kevin Kearney Mansfield Software Group P O Box 532 Storrs CT 06268 203 429 8402 Fax 203 487 1185 Lee Krystek Boole amp Babbage Inc 8000 Commerce Pky Mt Laurel NJ 08054 609 778 7000 lee boole com Luc Lafrance Simware 2 Gurdwara Rd Ottawa Ontario Canada K2E 1A2 613 727 1779 lafrance simware com Bill Langlais Percussion Software 222 Berkeley St Ste 1620 Boston MA 02116 Linda Littleton Pennsylvania State University 214 Computer Building University Park PA 16802 John Lynn Rohm and Haas Independence Mall West Philadelphia PA 19105 215 592 3000 Ray Mansell IBM H4 A06 30 Saw Mill River Road Hawthorne NY 10532 914 945 3000 Fax 914 784 6201 Alan Matthews Percussion Software 222 Berkeley St Ste 1620 Boston MA 02116 617 267 6700 Fax 617 266 2810 Rohan Menezes 515 W 59th St No 19B New York NY 10019 Patrick Mueller IBM MS 4B G 11000 Regency Parkway Cary NC 27512 919 469 7242 Fax 919 469 6948 Donna Murphy Putnam Investments 859 Willard St Quincy MA 02169 Simon Nash IBM UK Laboratories Ltd Hursley Park Winche
29. considerations DLINK Function packages Performance Performance MVS INNER 1 OUTER EXEC SYSPROC CEXEC SYSPROC MODULE STEPLIB MODULE DLINKed E Compiled Interpreted INNER CALLER 3 INNER CALLER INNER fo OUTER EXEC CEXEC MODULE ER EXEC execloaded PERS CEXEC execloaded RXOUTER MODULE E RXOUTER nucxloaded OUTER DLINKed Applications Internal External Performance LW G7 Maintenance KE ss Yj Distributed development f impossible A Search order P certain BE sitai ff Programming f Include 3 i D LINK j i i not yetavailable unction packages Function packages f DLINKed Applications DLINK Search overhead zero Requires Compiler Does not work with Alternate Library Function Packages Commonly used functions Early in the search order Functions must understand REXX function invocation Search Order CMS RXEXTFNC continue search ications with Function Packages Function packages Function Packages First in search order Compiler allows to write functions in REXX Works with Alternate Library a May require explicit loading unloading on CMS DLINK may be used when Alternate Library is not used CMS Function Package Example Two files RXUSERFN is function package loader USEHFN is function package glue code Glue code for a function package Use without royalties Allows free
30. given object class RoxClass object This function returns the name of the class of the object RoxAddVar add a variable to an object result RoxAddVar object varName This function will the named variable to the set of instance variables associated with the object Be careful not to add extra blanks to varName when passing it in The characters in the variable name up to the first will be uppercased to conform with REXX variable conventions The remainder of the variable name is left as is 4 Format of rox Files Classes are defined in files with an extension of rox A rox file may contain one or more class definitions Classes defined in rox files may be loaded by using the RoxLoad function see Utilities Provided on 13 The format of rox files is a tagged file The character in column one indicates a tag The rest of the line after the indicates the type of tag The characters when located in column one indicate a comment The following tags may be used in a rox file include lt file gt This tag indicates that the file specified in the tag should be loaded as a rox file Useful for including inherited class definitions from separate files 197 class This tag indicates the start of a new class definitions Any inherits vars and method tags following this tag up to the end of the current rox file are associated with this class inherits class class
31. information with Percussion Software around topics such as feature wishlist items bug reporting and application examples built with Notrix To receive updates to this database a user needs only to replicate with Percussion s Lotus Notes server o An Online Help Database is included with each copy of Notrix to streamline the development process 162 SOFTWARE REQUIREMENTS AND PACKAGING Notrix requires OS 2 Version 2 1 or later OS 2 REXX Lotus Notes Version 3 0 or later Notrix is supplied on 1 3 5 inch PC formatted diskette containing the Notrix database Notrix NSF DLLs and the Help Database A user manual describing Notrix use and the installation process is also included PRICING AND AVAILABILITY Notrix is priced at 3 500 and will be available in May 1994 Percussion Software headquartered in Boston Massachusetts develops software products to help customers access integrate and manipulate information they need in their day to day business operations Percussion is both a Lotus Notes Business Partner and a member of the Lotus Professional Developer s Program Percussion offers programs for Lotus Notes VARs and consultants who wish to use our products in their solutions for a price performance advantage 163 FOR MORE INFORMATION PLEASE CALL Percussion Software 222 Berkeley Street Suite 1620 Boston Massachusetts 02116 Phone 617 267 6700 Fax 617 266 2810 Note to Editors All pro
32. inherited by the class Inherited methods are marked with a prefix of RoxProf cmd Analyzes the profile information generated by RoxStats Use RoxProf for help 7 Classes and Testers Provided list rox Implements a simple list class The program testcoll cmd tests this class by passing it a parameter of list The list class inherits the collection class in collect rox wordlist rox Implements a simple list class similiar to the list class The difference is that the list class can contain arbitrary strings whereas the wordlist class can only contain strings with no blanks in them The program testcoll cmd tests this class by passing it a parameter of wordlist The wordlist class inherits the collection class in collect rox 201 set rox Implements a simple set class The program testcoll cmd tests this class by passing it a parameter of set The set class inherits the collection class in collect rox collect rox Implements a simple collection class that can be inherited by other more spe cific collection classes and will provide additional capabilities sessions rox This file implements some of the classes from Roger Sessions book on OO with C and C reference included in the rox file The program sessions cmd tests the classes spinner rox This class implements a character spinner which can be used as a progress indicator Also uses roxsem dll This class is tested wit
33. ju fQueuelike if Object Mixin amp gne Sequenced Closs x i String Setlike Sequenced Queue P A Table I7 JU NERVOUS uh d IndexOnly Monyltem Ust A x lom B ee i Directory 2o Array Loses y Set Bag Relation 7 h l EM f E u Mises rrr eu EC oe The classes are shown in the same positions as before but the inheritance connections have been replaced by arrows which point from cach class to its metaclass from instance to class There s an interesting circularity between the Object Class mixin and the Object Mixin class each class is an instance of the other This is a bit of a mindbender and reminds me of the chicken and the egg question how did these classes get created Let s just say that someone had to do a little bit of cheating here Last Words Don t worry if multiple inheritance abstract classes or mixins seem difficult or unnecessary The simplest classes are the object classes They create objects that do a particular job which is well defined by their class definition They are the place to start in familiarizing yourself with object oriented programming and in creating your own classes Start by subclassing object classes with single inheritance Override a few methods and get a feel for how subclasses can be different from yet similar to their superclasses Then try multiple inheritance with a mixin getting a feel for how that works When you have developed a few object classes you may start to not
34. last access on the named stream The SYSTEM function runs a shell command and re turns its output as a string Environment variables may be examined and or set using the VALUE function with a third argument of ENVIRONMENT Note however that changes made to the environment will be lost when the Rexx inter preter finishes The function call ERRORTEXT n 100 gives the nth Unix error message such as No such file or directory which is message number 2 The subcommand environment UNIX passes each com mand to a Bourne shell The COMMAND environment passes each command to a small built in shell which tokenises and executes the command directly which is usually much faster than invoking a shell for each command MM REXX imc 12 The REXX imc Stack e rxque is the stack daemon it runs as a separate process it is created and destroyed automatically by the interpreter it may be run as a server for a whole session e rxstack is a stack client rxstack fifol 1ifo copies standard input to the stack rxstack string x stacks one entry rxstack print copies stack contents to standard output rxstack pop copies one entry to standard output rxstack num prints the number of stacked entries e REXX imc is also a stack client queue x stacks an entry in FIFO order push x stacks an entry in LIFO order queued tells the number of stacked lines On SunOS REXX imc can transfer stack con tents to the ke
35. most gain for Reuse components is from serendipity and mass Maturity and robustness are problematic Good designers know how to design things when they are expert In practice the problems of general purpose code reuse by an average programmer are overwhelming Consider these problems ______ Maintenance who maintains components how to compensate the maintainer how to control many versions2 lose of intellectual control as time passes and persons pass on to new jobs and the next life delivery of new function and service including preventive service _ Disappearing customer base First our reuse candidate loses a prospective customer So development stops Next month a new customer surfaces the project restarts only to disappear again How to measure reliability or quality of a reusable code component How does customer convince management to trust reusable code What would be the service cost projection _ Publicity how where and issues of truth in advertising touch on personal sensitivities Packaging When would we bind reusable components to the reuser s program It could bind when compiled at product build at installation of the product when the application loads or at run time Myopic design and semantic provincialism a coworker needed a subroutine to test in a secure way if a person is a SFS Administrator The words mislead In fact the programmer wrote a routine to test if a process id is acceptable by a named reso
36. naming of function package e Requires renaming of files e Explicit loading of package and all functions with RXmyname LOAD e Explained in RXUSERFN header Necessary Modifications RXUSERFN ASSEMBLE amp PACKAGE SETC USERFN Name of the package to load amp RXPACK SETC REPACKAGE Name of this program amp CR 1 SETC his Cop Copyright notice amp CR 2 SETC cons tse Copyright notice continued USERFN ASSEMBLE amp PACKAGE SETC EHE Name of the package amp CR 1 SETC M Copyright notice amp CR 2 SETC V i P ig Copyright notice continued amp FUN 1 SETC USER Name of function amp FUN 2 SETC USER Name of function amp FUN 3 SETC USERS Name of function Obtain the Source Code Email write a note to hansjako vabvm1 vnet ibm com ATIBMCXP at IBMMAIL Disk get one as long as supply lasts if you can t use email if you have a way to upload code Supplement type in Agenda News from the REXX Compiler Copyright Alternate Library Packaging an application General considerations DLINK Function packages Function package example 91 eet Tew Function Packages TITLE RXUSERFN REXX Function Package Loading Stub 66810886 WRRFOARRARRTARSKRARARARARNRKAASTERRARANEATARRARARRARRARRRARAARRARRARARARARA 66916186 2 80810266 Describe your function package here 60910369 id 66810468 WRKE RSTARKAARATARTRARARRARRRARARARANRNRARARARATERRA
37. profile information no parameter should be passed to stop profile information For example re re RoxStats start profiling RoxStats end profiling n uu The profile information can be analyzed with the RoxProf cmd utility Returns 194 3 FUNCTION REFERENCE 3 2 Class Definition Functions The following functions are used to add class definitions to the system Generally you will only need to use RoxLoad and RoxQueryClassLoaded The other functions are used by RoxLoad to to load rox files RoxLoad load class definitions in a rox file rc RoxLoad roxFileName This function loads the named file as a class definition See the section of rox file definitions for the layout of the file This function is implemented as a REXX cmd file RoxQueryClassLoaded query whether class is loaded bool RoxQueryClassLoaded className Returns 1 if the class named className is available in the system Returns 0 otherwise RoxAddClass add a class rc RoxAddClass className This function adds the named class to the system RoxClassAddInherit add an inherited class to a class definition rc RoxClassAddInherit className inheritedClassName This function specifies that the class named className should inherit from the class named inheritedClassName RoxClassAddMethod add a method to a class definition rc RoxClassAddMethod className methodName methodCode This function adds
38. strptr RoxAddClass NULL 1 amp parm NULL amp result Note that the function name and queue name first and fourth parameters may be passed as NULL Be careful how the return value is freed See the sample roxsem c code for examples Two platform independent functions are provided to allocate and free memory The functions are void APIENTRY osMalloc int size void APIENTRY osFree void ptr The include file roxapi h prototypes these functions and the library rox lib contains them 6 Utilities Provided The following utilities are provided with ROX RoxLoad cmd This program can only be used as a REXX function It can not be called from the OS 2 command line One parameter must be passed to the function the name of a rox file to load The file will be searched for in the current directory and then the directories specified in the ROXPATH environment variable 200 7 CLASSES AND TESTERS PROVIDED RoxInfo cmd Prints a short reference of the class definitions in rox files Multiple rox files may be passed as parameters and wildcards may be specified For every class in the rox file the following information will be provided e Classes inherited by the class These classes will be listed in an indentation style which indicates the tree of class inheritance e Variables defined and inherited by the class Inherited variables are marked with a prefix of e Methods defined and
39. tains the variables for an active PROCEDURE or external function call apart from the workspace this is the only one of the above structures which persists across external function calls Within each section the vari ables are stored in a tree structure Exposed variables contain a pointer to another section where the real copy of the variable is to be found The work space is a temporary area for all sorts of calculations It is cleared after interpreting each instruction Notes REXX imc 22 DO and END have been chosen to illustrate how the pro gram stack works Most of the work of DO is to find out what sort of DO clause this is and to set up an entry in the program stack which describes the DO clause The information needed is where to come back to whether there is a symbol and if so what are its name and its step and limit values whether there is a counter or FOR value and if so how many iterations are left e where the WHILE or UNTIL can be found if any DO also has to check to make sure the loop is to be executed at least once REXX imc Example END Fetch the top stack entry If none exists complain 2 If the entry is not from DO or SELECT complain 3 If the entry is not flagged repetitive then a Delete the top stack entry b finish Fetch the pointer to any WHILE or UNTIL If UNTIL is found and the expression following it is true go to 3 a If a symbol name is stored ad
40. testit cmd Or say EXEC PROFILE and they work with CALL too May 1994 Mike Cowlishaw Built in Functions ABBREV allows default match to null string say abbrev PRINT PRINT say abbrev PRINT PRI say abbrev PRINT all say 1 CENTER can be spelled properly too say centre goal kick 25 May 1994 Mike Cowlishaw More Built in Functions COMPARE is often overlooked alpha abcdefghijklmnoparstuvwxyz say compare alpha abcdefghijklmnoqp Says 16 DATE lets you find the day of the week as a number say date Base 7 says 0 for Monday 1 for Tuesday etc May 1994 Mike Cowlishaw INSERT and OVERLAY Powerful when you need them say insert needle haystack 3 Says hayneedlestack and say overlay 12 30 It is hh mm 7 Says It is 12 30 May 1994 Mike Cowlishaw May 1994 Removing character s from a string Use SPACE with a little help from TRANSLATE string Hoppy floppy string translate string string space string O0 string translate string Sets STRING to Hoy floy onu I p os p For multiple characters use for example string translate string string space string 0 string translate string a aeiou a a Mike Cowlishaw Testing for parity Use SPACE with a little help from X2B TRANSLATE and LENGTH bits x2b C7 x 11000111 x ones translate bits
41. the named method with the REXX code for the method to the named class 195 3 3 Object Lifecycle Functions RoxClassAddMethodDIl add a method in a DLL to a class defi nition rc RoxClassAddMethod className methodName dllName entryPoint This function loads the dll gets the address of the function given with the name entryPoint and adds this to the named class RoxClassAddVar add an instance variable to a class definition rc RoxClassAddVar className varName This function adds the named instance variable to the named class 3 3 Object Lifecycle Functions RoxCreate create an object object RoxCreate className lt pi lt p2 lt gt gt gt This function creates an object of the class named className Any number of parameters specific to the class can be passed RoxDestroy destroy an object rc RoxDestroy object This function destroys an object RoxSend send a message to an object result RoxSend messageName object lt pi lt p2 lt gt gt gt This function sends the named message to the object specified Any number of parameters specific to the message and class can be passed 196 4 FORMAT OF ROX FILES RoxSendThread send a message to an object result RoxSendThread messageName object lt pi lt p2 lt gt gt gt Same as RoxSend but starts a new thread to process the message No useful return value is returned RoxClass return class of
42. the screen Jackson RoxCreate dog x name Jackson Jackson x breed Jackson Chocolate Labrador Retriever x describe Jackson 1 6 Class Inheritance Classes can inherit other classes in their definitions This technique expands the variables and methods available to the class to the set of variables and 192 3 FUNCTION REFERENCE methods defined in any inherited classes A class can inherit from more than one class ROX has no scoping facility so if classes are inherited that have the same method the method will be available in the derived class the one that inherits the other classes but the actual method invoked is undefined One of the methods will be invoked but it s not possible to determine which one 1 7 self and super Two special variables are available to all methods They are self and super self refers to the receiver of the method the object which the methods was invoked on super also refers to the receiver of the method however if super is used as the receiver of a method the method to be invoked will be searched for starting at the inherited classes of the class of the method currently running self and super are similiar to the self and super variables in Smalltalk 2 Installation and Removal The ROX REXX function package is contained in the file rox dll This file needs to be placed in a directory along your LIBPATH To get access to the functions in the ROX function package execute t
43. the world the tape player s motor runs on DC batteries so the local power system s voltage and frequency are irrelevant to the Walkman An application is a complete not a partial product We focus on customer related computer products A complete operating system is an application Rexx is an application A PS 2 is not since it is bare metal it is not complete A pre loaded PS 2 is an application Note the definition is broad A ground rule in problem solving is to ask whose eyes to use One could say we must know the scope of the problem or perhaps its environment Our scope is strictly a business viewpoint a marketplace We shall examine moving computer related products to another marketplace 225 Compare your notions of Why Bother with these Increase Marketplace Share One would think making that increased profits result from increasing market share What metric will predict our success Will the cost of development and maintenance exceed revenues That is the question _ Promote brand name recognition We have it all Or Foot in the Door Syndrome Some day we will have it all on your computer _ Protect the product owner s other products in target Spread development costs when one market would not profit the product owner When American engineers looked at designing a small personal tape player they may have thought We can not make a profit in the 60 hertz 110 volt marketplace The cost of a port woul
44. thread reentrant still some more to go 203 08 27 93 version 1 3 print error when invalid object reference is passed to a method added exception handling to try to catch method invocation on objects which are no longer alive 08 24 93 version 1 2 fixed problems with re adding and re registering classes and methods 08 22 93 version 1 1 fixed super behaviour added multiple inheritance capability added class specific init and deinit methods added RoxStemSynch requires user notify the system when stem vari ables are added or dropped as instance variables added RoxInfo cmd utility documentation turned into inf file and enhanced 08 18 93 version 1 0 initial release 204 A SAMPLE ROX FILE A Sample rox file Below is a the sessions rox file which contains class defintions inspired by Roger Sessions book on class development 9 en ae a a nn M REXX Object eXtensions classes described in Roger Sessions book Class Construction in C and C Prentice Hall ISBN 0 13 630104 5 Dp amp 0 2 H SESE EE EE NE GE RD GEER FE OE EE ES AR XD Ee ER OE class performer vars minSalary method setMinimumSalary minSalary arg 1 if 0 datatype minSalary W then minSalary 1000 return self method bargain say I get minSalary 2 dollars a performance r
45. to be able to create instances in its own right If it couldn t we d have to create another object class inheriting from Database and Relational which could create these instances adding an unnecessary class to the hierarchy It looks as though we might need a Relational Mixin metaclass to create the Relational mixin In theory we do in practice we don t By making metaclasses mixins with a base class of the Class class they can also be inherited by subclasses of the Mixin class since Mixin is a subclass of Class So the Database Class metaclass becomes the Database Class mixin and REXX can construct the Relational Mixin metaclass simply by inheriting from the Mixin class and the Database Class mixin That s what mixins are all about O Copyright IBM Corporation 1994 The Object REXX Class Hierarchy 220 Az Classes and Metaclasses The earlier hierarchy diagram showed the superclass subclass relationship of the REXX classes It didn t show the class instance relationships Of course these connections will be quite different so it could be confusing to try to show both on the same diagram We ll use a separate diagram here to show the class instance relationships of these classes xy i D D i X i Stream Supplier Indexed eject seed enim Lown Closs EY Alarm ubi Qu T AAAA a 4 r ry ra a P P Fi H a Obj e ct CI ass i Message Collection Mixin A Aa 7 i f i P SO H 4 E ra mE d meio bone
46. us The product looks and feels the same in both environments The product looks and feels like other applications in the new environment CODE REUSE WHY IS IT PROBLEMATIC Does the Walkman have reusable components What happens when the batteries run down The engineers decide to put a DC plug in the Walkman so that anyone can buy a Reusable Component called an AC DC Converter The problem is there is no common voltage for battery powered appliances Every engineer picked a different voltage 9 65 13 1 and other peculiar voltages Good try engineers Perhaps a variable voltage converter would be a better Reusable Component Think of examples of good reusable code string h in classic C libraries Rexx functions such as STRIP or WATCOM s VXRexx a visual editor for Rexx on OS 2 Intuitively reusable components will be clearly useful if there is a big gain The mass attribute could be due to many potential reusers or big functions replacing large amounts of new code Consider the Rexx interpreter It is an excellent ex mple of a reusable scripting component Why The Rexx reuser gets much more than originally specified or serendipity Rexx is massive since it replaces large amounts of code Rexx is mature Rexx is used by millions of amateur programmers Rexx is robust it does not break Another good example is IBM s XEDIT used as an application base the reuser s customers gain strong editing and searching function gratis The
47. 1 AL3 8 C 8 X 09 AL2 0 611289608 LEES MED SR EDR EEMLENLLLLLLULLE LLALUIleLI GAMME c ccn DR NE MEET AL LASS EOS M OLD MAUOLUIAALIULCGUAGS n npcOeeLIL uou 05 94 KH News from the REXX Compiler Supplement 05 94 KH News from the REXX Compiler Supplement 92 Function Packages Function Packages Res TITLE USERFN REXX Function Package Glue Code 00619066 LCLE amp PACKAGE 8CA 1 amp FUN 1 06920000 RARARARARKARKAARARARARRARARARRARERAARRARAARRRARRARARARARARARAEAARRAR 690630086 s 090640000 Describe your funct on package here s 60850089 a 00060000 AAAARARARAAARRARAAARARAAAARA ARAAARAARKAAAARARRAARRAARAAARRRRARNAAARAR 608708560 A 7 89889006 amp PACKAGE SETC USEAFN Wame of the package 08898000 a n eens 901000600 amp tR 1 SEIC E C pyright notice 66110668 66126868 amp FUN SETC USERI Mame of function 698138808 amp FUN 2 SETC USER2 Name of function 490140009 amp FUN 3 SETC USER3 Wame of function 66159000 90168006 EJECT 60178688 Start of Specificationgnna nmamhunnhERRRRRAARARAWARREARRARNARAN 06186098 60196668 This code is provided on an as is basis i 80286600 08216888 ANKARRRAAARAARRRARARRONARRRRRAKNARRARAAKYNIARRAUERRANRKERARAXKAKKRRAARRARRAARA 88220008 082388608 Module name USERFN 68240800 08258908 Descriptive name Glue code for REXX function package 86260008 902700090 Function 00268060 08299009 The following code resides in free storage and is capable
48. 60300608 of replying to LOAD end RESET 00318668 A LOAD cali results in identifying the function whose name 603208088 is passed as parameter following LOAD as entry point 90336668 A LOAD call without function specified will identify all 90336018 functions in the function package as entry points 60336028 A RESET call from NUCXOROP will turn the functions off 863406600 A PURGE service call is ignored 60350000 98366006 To generate 60376008 HASM USERFN 683800608 LOAD USERFN 60390006 GENM USERFN NOMAP 60460080 68410000 Note To get a MODULE which cen execute on CMS release 5 and 80420868 later gt generate the module on a CMS release gt 5 60438698 Note When user functions are compiled REXX with the DLINK 60448008 compiler option then yos must explicitely specify 66450008 the functions to be OLINKed explicitely on the LOAD 60468008 cowwand and you must use the RLOSAVE option for the 69476008 LOAD command 684668800 Example 60496908 USERI USER2 and USER3 are functions in the package 98506588 IYPBUFF EQU IYPLIN 9 3 61139660 TYPLEN EQU TYPLING14 2 811468668 MSG C DMSRUFO GE Invalid parameter 81158000 Z 81166660 NUCXLOAD 80 81170606 L8 NUCXLOAD 61188668 CL8 amp RXPACK Name to load as 011906098 CLO amp PACKAGE Name of module to load 01280068 cue C 81218066 CL8 SYSTEM System attribute 61220068 CL8 SERVICE Service attribute 61236660 ELB PUSH Push down existing extension 81240008
49. 616668 NUCON 608269088 60836000 Change Activity 60848800 91 11 21 KH Added AMODE 31 capability 66856808 93 66 22 KH Added missing branch for service call with 60656818 AMODE 24 thanks to Roderic A Oavis for pointing 60850926 Out the problem and providing the solution 00850038 93 06 26 KH toad al functions in response to a LOAD request 06850948 without function name specified 66856059 066860000 End of Specifications ARARAARRRAARRAARAARARRRRAERRARARARKRARE 60876660 SPACE 60886666 amp PACKAGE RMODE ANY 90890009 amp PACKAGE AMODE 31 00960008 SPACE 1 60910080 amp PACKAQE CSECT 86926008 USING NUCON G Establish Addressebility 60930008 Ai SETA 1 609380098 CRLOOP ANOP 68996968 AIF amp I GT amp MAX CRLOOPE 81860008 oc C amp CR amp I 61816006 l SETA ginl 01820906 AGO 61630068 CRLOOPE ANOP 61649608 SS e 81658660 List of functions included in this pack with their offsets 616606008 91676600 FUNLNAME EQU 4 8 Offset amp length of name 81680008 FUNOFFS EQU 6 4 Offset to the routine 81090009 LENTRY EQU 12 Length of a single entry 61186000 FUNLIST OS OF List of functions 81118608 amp MAX SETA N amp FUN 61126008 Al SETA 1 811360008 FULOOP ANOP 01146088 Al amp 1 GT amp HAX FULOOPE 81158808 amp FUN SI Name of compiled progran 61166000 A R amp FUN amp 1 amp PACKAGE Offset of compiled prog 81176800 CL2 RX Name prefix 81180088 CLe BFUN RI Name 911990060 al ale
50. 80 BLKSIZE 4000 QUEUE information QUEUE more information QUEUE EXECIO DISKW dddd FINI SYSOUT c a DSN output goes to SYSTSPRT DEST rmt HOLD NOHOLD COPIES n FORM S Itrh OUTDES opnam DUMMY retain no direct eqvuivalents AGIS 259 SHARE81C LEF TAP2ZDSK EXEC XXX DD Lr P as EAS ee EXEC hms ELSYSUT L4 Ly 4S5YS5UT2 Example Original JCL Jo A T mE PROC MEM PGM IEFBR14 DISPetMOD DELETEJ UNIT SYSDA SPACE TRK 1 DSN NCSCB40 OUTPUT TEXT PGM IEBGENER DD DISP OLD VOL SER C12345 UNIT TAPE LABELS 3S BbP EXETDs99000 DCBE RECPMSFB LRECLZs82 BLKSIZES8200 OPTCDsSQJ DSN TAPE INPUT DD DISP CATLG DELETE UNIT SYSDA SPACESQCYD 2 5410 RBSE DCB RECFM VB LRECL 100 BLKSIZE 10000 DSN NCSCB40 OUTPUT TEXT amp MEM ISYSPRINT DD SYSQUTs 4JSYSIN DD Lj PEND 47 DUMMY EXEC TAP2DSK MEM D930722 04 25 94 jel2rex doc AGIS 260 Example REXX Equivalent cec SHARES O JOB area gs V EXEC TDCMUTR1 CMD TAPTODSK batch logon proc TAPTODSK pe REXX IF SYSDSN NCSCB40 OUTPUT TEXT OK THEN DO DELETE OUTPUT TEXT END SIGNAL ON ERROR ALLOCATE REUSE DDNAME SYSUT1 OLD UNIT TAPE JVOLIGI2345 POSITION 3 LABEL BLP BEXPDT 98901 RECFM F B LRECL 82 BLKSIZE 8200 OPTCD Q CDONCOUDTAPE INPUT ALLOCATE REUSE DDNAME SYSUT2 NEW DELETE UNIT SYSDA C
51. 81260600 FULOOP 81216608 FULOOPE 01220898 EFUNLIST A End fence 81230098 81246080 M 81256008 STARTCOD a 61269900 LR R18 RL4 Save return address 61276066 R11 RIA Save return address once more 012750060 ARCI 8 R1 CL8 LOAD Is this a load 61280006 CHK4ARGS Yes check for any arg s 61296000 ARGI B RI CLS RESET Reset 61306008 DOOFF Yes turn off functions 81310688 R15 R15 In case of service call 613290006 R2 X FfG08800 Set HOS of register 61338000 R2 8 R2 tA will clear HOB in AMOOE 24 61348660 R2 R2 Br if AMOOE 24 61350808 P2821 813550906 96 813 X FE Look et Call Type XA 813656068 CONTAL 8613780060 PL2021 CLM R1 8 1080 X FE Look at Call Type 81380068 CONTAL EQU 81390009 BNLR RIA Return Service Endcmd 91408068 1A R15 4 Bad Plist set error code 61418068 BR R14 and return 81420000 CHK4ARCS EQU 81430008 A RI Set possible return code 814400608 5 9 90 X0 0B 09 3 0 902 2 9 99 5 3 2 3 3 3 9 925 USING R12 Establish Addressability 60940806 B STARTCOD Branch around header 80950006 CL8 amp PACKAGE Package ID 60960000 5 1 CI Cee Any arguments passed 61458066 t Ex N amp CR 90378068 BE ALLLOAD No load all functions 61468000 81478688 ST DILLLLLEIDLLIVOLIOII AILLLAELLULULILIHDLIGAMLUIUAAaAGLLAOLOqULLULLkoijre l 05 94 KH News from the REXX Compiler Supplement 05 94 KH News from th
52. A new language o An IBM product Adventures in OO Programming with ROX Copyright IBM Corp 1994 169 e Classes define o Methods implemented in REXX o Variables accessible to methods e Class inheritance o Classes obtain methods and variables of inherited classes o Multiple inheritance e Modelled on Smalltalk but o Classes not 1st class objects o No garbage collection Adventures in OO Programming with ROX Copyright IBM Corp 1994 170 animal class class animal vars name sound smethod init name arg 1 sound arg 2 method name return name method sound return sound 3 dog class Class dog inherits animal method init name arg 1 re animal init self name Bark Adventures in OO Programming with ROX Copyright IBM Corp 1994 171 sample cmd load the ROX file animal rox re RoxLoad animal rox create a dog named Jackson dog RoxCreate dog Jackson gt Jackson says Bark say name dog says sound dog destroy dog rc RoxDestroy dog MH ME MEQMQ MN Adventures in OO Programming with ROX Copyright IBM Corp 1994 172 C programming interface allowing methods to be implemented in C e Auto loaded DLLs to allow complete class definitions to be implemented in C e Multithreaded support Execution profilin
53. ANCED This means that they will be object methods of the Object class and every other object class that inherits from the Object class that is all object classes A mctaclass is needed to create these classes and this metaclass nceds NEW and ENHANCED instance methods so that its instances the object classes will have NEW and ENHANCED object methods Let s call this class the Object Class metaclass Suppose we create a subclass of the Object class with another class method for example a Database class with a RESTORE class method to restore the previously saved state of an O Copyright IBM Corporation 1994 The Object REXX Class Hierarchy 219 object There will have to be a new metaclass to create this class since the Object Class metaclass doesn t have our RESTORE method Let s call this new metaclass with a RESTORE instance method the Database Class metaclass The Database class is an instance of the Database Class metaclass and the RESTORE instance method of the Database Class metaclass becomes the RESTORE object method of the Database class How do these metaclasses fit into the hierarchy As well as their specialized instance methods that correspond to the class methods of their instance classes they have instance methods for all the standard object methods of classes DEFINE DELETE ID INHERIT INITA METHOD METHODS SUBCLASS SUBCLASSES SUPERCLASSES and UNINHERIT We need a class with these as its instance methods th
54. ES SEE ERD gt ED GE se se VO xf If oracle disconnect lt 0 Then Do Say oracle error text Exit End licut qua Dn nd pul Qu ur Gas in Ais e mas ue dpa cie Vu Gu M uS mu is MS casi cm i ER xa iu c sd cs Rmi ia E suse im Gs Ue um ual Ds EE mi am I dM eme tus RE T cua ib ami E Disconnect from the DB2 database ce a an ae ee ee wa a ce ce a Ae a a ee em SO wee AD AD ma OO P he ee oe ee oD xf If DB2 disconnect lt 0 Then Do Say DB2 error text Exit End Return 100 ATTACHMENT A Synopsis sql connect username password remote database string Description This function connects you to an oracle database You supply the function with the username password and optionally the remote database connect string Arguments username password username password remote_database_string connect string for remote database Return Values 0 successful connection Negative number Oracle error number Example To connect as your OPS Oracle login you would use the following call rcode sql connect To connect to the Oracle account SCOTT with TIGER as password rcode sql connect scott tiger To connect to the Oracle account SCOTT with TIGER as password on the remote host overthere Oracle SID of X using SQL Net TCP IP rcode sql connect scott tiger T overthere X 101 Synopsis sql disconnect Description This function disconnects you from an oracle database and commits any outstand
55. EXX as a Database Tool Mark Hessling Griffith University Brisbane Australia Introduction Having been involved in Database Administration for the last 5 years and having a long relationship with REXX over 10 years it was inevitable that the two should come together eventually GUROO History During 1993 found needed a scripting tool to manipulate some data in Oracle tables as part of my Grad Dip course decided that it would be quicker to write an interface from REXX to an Oracle database and then write the programs required in REXX than it was to write the same programs in the tools supplied by Oracle GUROO Griffith University Rexx Oracle Overseer was the result As already had the basic framework courtesy of the SAA REXX API in Regina and the interface to Regina in THE filling in the remainder of the tool was relatively simple The prime design consideration in GUROO was simplicity had a rough idea of the interface to existing REXX SQL tools like the Database Manager in OS 2 Extended Edition These interfaces seem too complicated Compare the same program written using the REXX interface to Database Manager and the GUROO example See Examples 1 and 2 96 L6 Example 1 Display the names of all tables owned by the default user DBM version ee oe a ee a a a ee e ee ee ee ee ee ee ee ee re M M
56. Lotus Notes VARs and consultants who wish to use our products in their solutions for a price performance advantage FOR MORE INFORMATION PLEASE CALL Percussion Software 222 Berkeley Street Suite 1620 Boston Massachusetts 02116 Phone 617 267 6700 Fax 617 266 2810 Note to Editors All products and product names mentioned in the publication are trademarks or registered trademarks of their respective companies Percussion believes the information in this publication is accurate as of its publication date such information is subject to change without notice Percussion is not responsible for any inadvertent errors Adventures in Object Oriented Programming in REXX Patrick J Mueller IBM 166 Adventures in Object Oriented Programming REXX Object eXtensions Patrick J Mueller pmuellr vnet ibm com May 1994 for the 1994 REXX Symposium Copyright IBM Corp 1994 All rights reserved 167 IBM is a trademark of International Business Machines Corporation e OS 2 is a trademark of International Business Machines Corporation M Adventures in OO Programming with ROX Copyright IBM Corp 1994 168 e What ROX is A REXX function package for OS 2 o Provides object oriented capabilities for REXX o An experiment What ROX isn t An interface to existing OO systems C Smalltalk SOM
57. M 41 Interesting Corners of REXX REXX Symposium Mike Cowlishaw IBM UK Laboratories Hursley Instructions Built in Functions Miscellaneous Questions May 1994 Outline Mike Cowlishaw Multi way CALL var FRED call jumper var firstarg jumper procedure signal value arg 1 fred do whatever x return to the CALL May 1994 Mike Cowlishaw DO FOREVER can be clearer do forever j 1f something then leave end forever loop May 1994 Mike Cowlishaw 9v DROP extra state for a variable drop var do i 1 to howmany if whatever then var somevalue end i 1f symbol var LIT then say Found May 1994 Mike Cowlishaw NUMERIC FORM and FUZZ With NUMERIC FORM ENGINEERING var 1234 say var 1el10 var lel11 var 1e12 gt 12 34E 12 123 4E 12 1 234E 15 and don t forget NUMERIC FUZZ for fuzzy comparisons May 1994 Mike Cowlishaw PARSE Most implementations have variable column patterns namecol pos Name header do i 1 to entries parse var entry i namecol name i end i Use placeholder to strip blanks line modemspeed 9600 parse var line key value May 1994 Mike Cowlishaw More PARSE Use relative patterns to include strings in results parse var line pre START SLIP 0 post if pre amp post SLIP then do found start slip end Or parse var line
58. MP Q1 TABLE_NAME 2 DEPT Q1 TABLE_NAME 3 CUSTOMER To select the names of all tables and the tablespace in which they reside owned by the user SCOTT and use a bind variable issue the following call query l select table name tablespace name query 2 from all tables where owner OWNER query query 1 query 2 rcode sql command Ql query OWNER SCOTT Assuming that user SCOTT owns the tables EMP in TEMP SPACE tablespace DEPT in USER SPACE tablespace CUSTOMER in TEMP SPACE tablespace PRICE in USER SPACE tablespace rcode will be set to 4 and the following REXX variables will be set Q1 TABLE NAME 4 Q1 TABLESPACE_NAME 0 4 Q1 TABLE_NAME 1 EMP Q1 TABLESPACE_NAME 1 TEMP_SPACE Q1 TABLE_NAME 2 DEPT Q1 TABLESPACE_NAME 2 USER_SPACE Q1 TABLE_NAME 3 CUSTOMER Q1 TABLESPACE_NAME 3 TEMP_SPACE Q1 TABLE_NAME 4 PRICE Q1 TABLESPACE_NAME 4 USER SPACE To delete rows from the EMP table where DEPTNO 10 issue the following call rcode sql command Ql delete from emp where deptno 10 Assuming there were 5 rows in EMP for DEPTNO 10 rcode will be set to 5 To delete rows from the EMP table where DEPTNO 10 issue the following call rcode sql command Ql delete from emp where deptno 10 Assuming there is no table called EMP then rcode is set to 947 the Oracle error number 104 Synopsis Sql open cursor statement name sql command bind variable name bind variable value Description
59. MS DOS OS 2 Windows and maybe someday CICS Flexibility Control Structures Looping General Conditionals Expressions PARSEing Controlled Recovery and Restart Up front Validation and Handling of Clerical Errors Addresses Batch Window Criticality Reduced Programming Requirements Almost Unlimited Procedure Invocations Levels Including Recursion Application data and control can interact Avoids MVS Steps per JOB limit In short every costs you time and your installation money hms 04 25 94 jcl2rex doc A638 255 Mtr ENT PEN Conversion Steps Extract each JCL step to REXX EXEC by PGM and PROC name Change DDs to equivalent ALLOCATE KEYWORD V ALUE becomes KEYWORD VALUE Subparameter KEYWORD SUBPARM VALUE becomes parameter SUBPARM VALUE Add quotes around permanent dataset names Move each EXEC PGM to end of its step After EXEC PGM effect normal disposition IF RC 0 THEN FREE DD SYSUT2 CATALOG e Change EXECs to equivalents Drop IEFBR14 DELETE ALLOCATE use SYSDSN Create JOB stream to invoke converted REXX module hms 04 2594 jcl2rex1 doc A638 BT RN A EE dr Tm E EXEC Equivalents JCL REXX TSO Allocate Parameters EXEC PGM ppp PARM xxx ADDRESS ISPEXEC SELECT PGM ppp PARM xxx EXEC PROC mmm kwd val ADDRESS ISPEXEC SELECT CMD mmm kwd val Or ADDRESS TSO mmm kwdzval or CALL mmm kwd val mmm has als
60. REXX imc was spent in implementing the file I O functions and in documenting the source even the few comments that are dotted around now were almost entirely absent before this period Many of the changes between versions of REXX imc have been bug fixes thanks to Anders Christensen who spent time running his trip tests on REXX imc and to everyone who reported a bug The main changes in release 1 5 were the addition of language level 4 00 features SIGNAL ON with the NAME keyword CALL ON CONDITION STREAM and so on the command line flags and the OPTIONS options The main changes in release 1 6 are the addition of an API and the improvement of function handling Things planned for the future include but are not limited to the following not in any particular order imple menting speedups in at least three areas improving the variable table improving the arithmetic and implement ing a pre parsing process improving tracing adding a Unix system call library adding OPTIONS to control the language extensions and to move towards the language standard adding extensions as proposed by the Rexx Ex tensions committee adding a stems library completing the API adding an API which can be called by other processes even after Rexx has started and anything else which people suggest Notes REXX imc Files librexx so 1 6 204800 rexx 5712 rxmathfn exec 6743 rxmathfn rxfn 57344 rxmathfn rxlib 57 rxque 8016 r
61. RTARTRREANARASERRARATER 20916568 i 86616669 amp PACKAGE SETC USERFW Wame of the package to load 00010708 06016860 News from the REXX Compiler z amp RXPACK SETC RXBPACKAGE Meme of this program Huber Supplement amp R sere c7 Copyright notice eum EJECT 08811308 Start of Speci ficationg 4 aAAE E hERRTERARPEARRRAETERRRRESRATRSRKR 00020086 88030066 This code is provided on an as is basis 66040000 90950000 REKRERRARKARKRARRAERERAAREARKERPRAREREREERAPRECRAARRERORRERRRARARAR 800600680 8607680868 Module name RXUSERFN 80888088 600906066 Descriptive name REXX function package loader 6818090808 00119008 Function 88128868 08130666 WUCXLOAD module USERFN as RXUSERFN when invoked with a LOAD 881486806 request invoke USERFN with sawe PLIST as on entry 68156008 601680008 To generete 60170908 HASM RXUSERFN 60180086 LOAD RXUSERFN ORIGIN TRANS 66198000 GENM RXUSERFN 682000906 002109090 Note RXUSERFN is interrogated as part of the REXX search 80210916 order for external functions The functions are loaded 80210920 automatically when invoked You can also create a function 66210039 package with a different name e g RXMYPKG 60216046 Rename this file to RXMYPKG 662 8858 Change the macro variable PACKAGE in the header of this 89218868 file from USERFN to MYPKG 602169768 Rename the file containing the functions to MYPKG 66210000 Change the macro variable PACKAGE in the header of th
62. SHORT FAR gpSHORT e SIMSTR h define strupr a b AnsiUpper a b define memcpy a b c fmemoepy a b c rel The Way to an Easy Port SIMFILE c fhOsOpen fhOsClose lOsRead lOs Write OsSeek SIMMEM c OsGPtrAlloc OsGPtrFree ifdef Hungarian notation Sel YACC What Is This call RX CALL symbol opt blank parm list if finterpret TRUE GenExternalP CL OUT SYM 2 4 else if wLabel wIsInternal 2 GenInternal P CL INTERNAL wLabel 4 else if wRoutine wIsBuiltIn 2 GenBuiltIn P_ CL BUILTIN wRoutine 4 else GenExternal P_ CL EXTERNAL 2 4 OsUPtrFree 2 j e output is portable C code 9 I Simware Conventions pointers in REX X passing a symbol as a literal call GetObjectID Luc OT USER objectID arrays in REX X passing the name of a stem calllistcreen array array 0 holds count LET REXX at Simware commitment to REXX substantial development investment ANSI committee nomination big push at Novell future directions integration of products third parties REXX Resources on the Internet Linda Littleton Pennsylvania State University 138 REXX Resources on the Internet Linda Littleton Iri psu edu Center for Academic Computing Pennsylvania State University 214 Computer Building University Park PA 16802 REXX Symposium Boston May 1994 Listserv lists List Name List Location Discusses
63. SLAC R 447 SLAC 447 CONF 9405161 UC 405 ae M PROCEEDINGS OF THE REXX SYMPOSIUM FOR DEVELOPERS AND USERS May 1 3 1994 Boston Massachusetts Convened by STANFORD LINEAR ACCELERATOR CENTER STANFORD UNIVERSITY STANFORD CALIFORNIA 94309 Program Committee Cathie Dager of SLAC Convener Forrest Garnett of IBM Pat Ryall Prepared for the Department of Energy under Contract number DE AC03 76SF00515 Printed in the United States of America Available from the National Technical Information Service U S Department of Commerce 5285 Port Royal Road Springfield Virginia 22161 PROCEEDINGS OF THE REXX SYMPOSIUM A Summary B Presentations Tom Brawn Tom Brawn Anders Christensen Ian Collier Mike Cowlishaw James Crosskey Hal German Klaus Hansjakob Mark Hessling Lee Krystek Luc Lafrance Linda Littleton Alan P Matthews Patrick J Mueller Patrick Mueller Simon Nash Edmond Pruul David Shriver Timothy Sipples Hobart Spitz C Attendees FOR DEVELOPERS AND USERS TABLE OF CONTENTS IBM AIX REXX 6000 and IBM REXX for NetWare Object REX X What s New Techniques for Performance Tuning REXX Interpreters A Case Study of Regina REXX imc A REXX Interpreter for UNIX Interesting Corners of REXX IBM Views on REXX Choosing a Command Language An Application Centric Approach News From the REXX Compiler Using REXX as a Database Tool Using REXX in a UNIX Environment to Manage Network Op
64. YL SPACE 2 5 DIR IO RELEASE RECFM V B LRECL 100 BLKSIZE 10000 DSN NCSCB40 OUTPUT TEXT D RIGHT DATE S 6 SIGNAL OFF ERROR GENER RETURN RC GENER fe BERK Sf IEBGENER DRIVER SIGNAL ON ERROR ALLOCATE REUSE DDNAME SYSPRINT DSN ALLOCATE REUSE DDNAME SYSIN DUMMY SIGNAL OFF ERROR ADDRESS ISPEXEC SELECT PGM IEBGENER CONDCODE RC IF RC 0 THEN FREE DDNAME SYSUT2 CATALOG RETURN CONDCODE hms 04 25 94 jcl2rex doc A638 261 deities Date a Code Volume Perspective LOAD MOD Classic Converted System e Fewer JOB Streams e Near Elimination of JCL e Reduction of Compiled Language Application Code e Increased Modularity l e Facilitates isolation of host dependant code and creates portability Analysis of Actual Batch System NYCTA s CCM Release 2 1 had one PROCLIB consisting of 51 members containing 191 steps calling 19 programs Using 1 1 as an approximate ratio for JCL statement to REXX host command ratio these 191 steps should be replaceable by 70 51 19 REXX EXECs of approximately the same length one for each EXEC In practice the results were much better as most of the 51 JCL PROCs were replaced by a few REXX main modules plus about 10 driver modules to call language processors LKED COBOL COBOL II CICS etc hms 03 25 94 jcl2rext doc A638 LAM Dep Conversion is Ideal for Initial Usage of REXX e Nearly all JCL has direct REXX or TSO equivalen
65. ZR ALB R6 FUNOFFS R2 LA R6 8 R6 812 Query form of NUCEXT plist Are we on CMS release 5 Br if yes use SVC 282 tok Plist COPY FENCE flags Exists Yes immediate return load address offset True start address News from the REXX Compiler Supplement Function Packages Equates ARGI ARG Qu EQU 8 8 16 8 REGE QU CHSLEVEL PLIST for invoking NUCEXT NLIST NLNAME WLKEY WLFLAG WLAODR NLSTART NLLEN ANLIST 05 DC tQu 00 CLO NUCEXT CLB EPACKAGE X FF X e4 ALL SYSTEM X 88 A 8 AL4 A 0 r e NLIST NUCEXT PLIST Flags SYSTEM Equ K e DSECI for NUCEXT plist DNUCX UNLIST DNLNAME NLMASK ONLKEY ONLFLAG ONLAODR OLSTAAT DLNLLEN 05 94 KH DSECT CL NUCEXT CLB amp PACKAGE X FF AL SYSTEM X 66 A ALG A ALA FREELEN First argument Second argument setup as CANCEL PLIST WUCEXT Plist Name function name System mask enabled System key WUCEXT Flag Spare flags Entry point address private Stert address Length Length of list Based on register 13 Name Function name Mask System Key WUCEXT flag Spare flags Entry point address 8 cancel private Start address Length News from the REXX Compiler Supplement unam dm fre 91480998 91490008 815666908 615108808 61526866 61538000 015490008 61556986 91569600 61576666 61590608
66. a performance Rex says BOW WOW BOW WOW BOW WOW BOW WOW Qoooh what an itch Watch my trick I can fetch the letter carrier I get 60 dollars a performance HonestBob says Buy this deal of a car and only 500 more if you want the wheels 210 chr The Object REXX Class Hierarchy Simon Nash IBM 211 The Object REXX Class Hierarchy Simon C Nash IBM UK Laboratories Ltd Hursley Park Winchester Hants SO21 2JN England Internet nash vnet ibm com CMS Abstract Object REXX an object oriented extension of the popular REXX language includes a class hierarchy The design of this hierarchy posed some interesting challenges in providing mechanisms that would serve the needs of the base hierarchy together with probable user extensions to it This paper presents the chosen design in the form of a tutorial introduction to the concepts and mechanisms involved including abstract classes mixins and multiple inheritance It also gives examples of how the mechanisms provided by REXX might be used by class users and implementers Objects and Classes REXX objects are grouped into classes For example all character strings whatever their content belong to the String class all directorics belong to the Directory class and so on The class of an object indicates what kind of object it is that is what methods it provides to respond to messages sent to it For example string objects provide string related me
67. abstract classes factor out the common methods from their subclasses you d expect them to always have more than one subclass This is true for all the abstract classes that REXX provides except the Condition and Supplier classes These aren t object O Copyright IBM Corporation 1994 The Object REXX Class Hierarchy 214 classes because they don t provide NEW or ENITANCED methods for creating instances REXX provides other ways to create condition objects and supplier objects They re a very special case since no user created classes would bc able to work like this and it s convenient to use abstract classes for them To create an abstract class use the ABSTRACT option on a CLASS directive For example to create an abstract class Visual which is a subclass of the Object class you would write class Visual abstract Multiple Inheritance As well as sharing some methods with arrays lists also share some methods with queues MAKEARRAY PEEK PULL PUSH and QUEUE Again it makes sense to create an abstract class for these We call it Qucuclike since its instance methods apply to all objects that function as queues So we need the List class to inherit from both the Sequenced and Queuelike abstract classes This is called multiple inheritance and although it may look quite simple at least in this case it is very powerful It also raises some rather complicated issues see More on Multiple Inheritance below You ca
68. ad command line parameters main Load program from disk 1oad Tokenise program tokenise Enter main loop interpreter a Fetch the next token b If NOP then do nothing c If SAY then print an expression d If RETURN then return an expression e If IF then read and test an expression f If program has ended then return else go to a 5 Clean up and finish i M MM M MM REXX imc Rexx Symposium 1994 Writing an external function in Rexx or with the SAA API is the same as for any other interpreter A function may be compiled and linked as a dynamically loaded object called rxfn with the replaced by the function s name by which it will be called by a Rexx program When REXX imc searches for external func tions it searches for such a file first If the file is found it is linked in and called as if it were built in The function must retrieve its arguments from the REXX imc calcu lator stack and place the result if any there A rxfn file may contain several functions all of which will be registered when the file is first loaded A function library using the SAA API may be compiled as a rxfn file in order to make a library which is portable but which can be called by an already running program To do this the library is augmented by an initialisation function which takes no parameters and returns no result but which uses the SAA API to register all the other functions in the
69. ally uses o RexxStart o variable pool o jnit term System exits Can be used by any REXX macro aware program Possible conflicts with programs that usurp REXX external function exit and depend on period prefixed functions Adventures in OO Programming with ROX Copyright IBM Corp 1994 184 Experimenting with OO and REXX Whet your appetite for Object REXX A way to reuse large ish chunks of REXX code with shared variables Adventures in OO Programming with ROX Copyright IBM Com 1994 185 Currently at version 1 8 Available via o anonymous ftp to ftp cdrom com in pub os2 program rexx as rox zip o Peter Norloff s OS 2 BBS Adventures in OO Programming with ROX Copyright IBM Corp 1994 186 Currently at version 1 8 e Available via o anonymous ftp to ftp cdrom com in pub os2 program rexx as rOX ZIp o Peter Norloffs OS 2 BBS Adventures in OO Programming with ROX Copyright IBM Corp 1994 187 ROX REXX Object eXtensions Patrick Mueller IBM Software Solutions Division Cary North Carolina pmuellrQvnet ibm com c Copyright IBM Corporation 1994 All Rights Reserved April 27 1994 188 Contents 1 Introduction li Whatis ROX cosce 62 Gar ho A eS S RE RED SE es 1 2 What ROX nte 2 eoo 9 Y COR ees GE Reis 1 3 Object cr ation 4 o3 4 48 aceto S EORR RAS es 1 4 Method invocation leeren 1 5 Variables seen oe eta Pah ore oe Se ee SS 1 6 Class Inher
70. and one for string values Since the conversion between them are rather rare the more time consuming code for conversion between the two formats does not significantly increase the total execution time As a future extension the scheme may be expanded to handle boolean variables too However it may turn out that the increased complexity this requires six conversion types as opposed to only two above may not justify the increase in speed The use of boolean variables are much less widespread than string and numeric variables and besides boolean variables can be emulated through numeric variables In addition the native floating point numbers could be used It beats REXX numbers in speed but it is difficult to avoid loosing accuracy wrt the definition of REXX arithmetics 3 Construction of a Parse Tree In order to explain what comes next we need to know the format in which Regina stores a parsed REXX program As an example consider the following REXX code if xxx bar amp bar foo gt 1000 then exit Regina converts this sequence of tokens to a parse tree the expression in the if clause is shown in figure 2 The conversion between a sequence of tokens and a parse tree is described in most text books on compiler construction As an aside note parse trees are often considered to be incompatible with the customary way REXX programs are stored internally a list of tokens However a static tree can easily be converted to a list o
71. and the AREA and PERIMETER method definitions in the Rectangle class A rectangle object can respond to AREA and PERIMETER messages by running the methods shown above and we say that it has these as object methods The Rectangle class cannot respond to AREA and PERIMETER messages itself but its instances can and we say that it has AREA and PERIMETER as instance methods The Rectangle class responds to other class related messages such as the NEW message that creates a rectangle object so it has object methods like NEW as well as its instance methods Since only classes have instance methods there s no nced to distinguish between object methods and instance methods when talking about other kinds of objects such as strings or rectangles We usually just say plain methods when talking about the object methods of these objects Subclasses Superclasses and Inheritance Every class in the system could be defined independently with a complete set of instance methods However many classes have a lot in common An example of this may be Student and Graduate classes a graduate object has the same information as a student object name ID course etc and also some additional information graduation details We d prefer not to repeat most of the instance methods of the Student class in the definition of the Graduate class and we can avoid this and express the close relationship between these two kinds of objects by making the Gradua
72. asses compared with abstract classes by making a special restriction here Beware though Before doing this you should see if your hierarchy can be restructurcd to make one of the superclasses an abstract class or a mixin or consider whether aggregation combining two objects into a composite object as in the Phone Directory example isn t a more appropriate way to accomplish what you want It usually will be Metaclasses For most users of Object REXX the concepts and mechanisms presented so far will be all they need to create instances subclasses abstract classes and mixins making full use of the facilities that REXX provides for using and extending the class hierarchy This section and the next one complete the picture for those who are curious to know morc about how all this Works or need to understand or reprogram the underlying mechanisms of the class hierarchy Are class objects instances of some class For completeness and consistency it would be nice if they were We call these special classes metaclasses Their instances are classes like the Supplier class and the Sequenced class Ilow many metaclasses are there There could be one for each class as in Smalltalk but it s not necessary to go this far Howcver we do need a mctaclass for each class that has a different collection of class methods To see why this is let s look more closely at how class methods work The class methods of the Object class are NEW and ENH
73. bles all variables defined by their class and its inherited classes All instance variables apply only to a particular object they are not shared between objects All instance variables are exposed when a method is invoked Per instance variables may be created with RoxAddVar This provides support for stemmed variables Adventures in OO Programming with ROX Copyright IBM Corp 1994 177 e HoxLoad utility allows classes to be packaged into their own files Multiple classes may be in one file e Format is include lt a ROX file gt class lt class name gt sinherits lt class name gt vars variable name gt method method name method code method method name method code Adventures in OO Programming with ROX Copyright IBM Corp 1994 178 RoxAddClass create a class RoxClassAddInherit add an inherited class to a class definition RoxClassAddMethod add a method to a class definition RoxClassAddMethodDIl add a method in a ER toa class definition RoxClassAddVar add an instance variable to a class definition Adventures in OO Programming with ROX Copyright IBM Corp 1994 179 RoxCreate creates a new object RoxDestroy destroys an object RoxSend send a message to an object RoxSendThread send a message to an object on another thread RoxClass returns class of object RoxAddVar add a per instance variable to an objec
74. ciRxSendString close wave RetStr 0 0O Ensure proper termination of Multimedia REXX call mciRxExit exit 0 Live Demos PLAY CMD FOR DO Ultimotion RECORD CMD Modifications to the sample CMD files Dial 1 1 by Helge Hafting 99999 249 Converting MVS JCL to REXX TSO Hobart Spitz MTA New York City Transit 250 Converting MVS JCL to REXX TSO Presented at REXX Symposium May 94 Hobart Spitz MTA New York City Transit 718 694 3112 5520808 MCIMail com CEXEC REXX 77 ALLOC 7 DD ALLOC It DD ALLOC DD ALLOC hms 04 25 94 jci2rex 1 doc A638 251 Converting MVS JCL to REXX TSO Abstract The speaker will discuss his experiences in using REXX TSO in place of MVS JCL The advantages of REXX over JCL will be covered as will a step by step methodology for converting existing JCL to REXX for batch and or interactive use JCL to REXX TSO equivalents will be spelled out in detail Guidelines and techniques for portability positioning to VM OS 2 etc will be reviewed Speaker Hobart Spitz SBW MTA New York City Transit 130 Livingston St 5041A Brooklyn NY 11202 Phone 718 694 3112 Alternate Voice Mail 718 694 1719 Fax 718 694 4309 E mail internet 5520808 MCIMail com hms 04 25 94 jcl2rex 1 doc A638 252 Application Backgrounds NYNEX Comp uter Services Billing Service Bureau Multiple Clients DB2 with 3rd party host command i
75. code candidates Read code and designs Join or get advice from the local Wisemen Council WHY Rexx _ Standards Group is in place and active Rexx semantics as well as syntax are consistent Slivers are easy to implement A sliver is the slimmest possible layer between a portable application and the complete computer system it would run on Syntax errors will occur in the sliver Semantic errors are harder find and harder to isolate The final semantic error may be impossible to find An application can not port to environments that are semantically incomprehensible to the original environment _ Universality Rexx will run on all new operating systems _ Readability or accessibility Rexx is justly famous for first run successes Problems in Rexx code are rare Errors are most likely when calling system commands The author s first Rexx program worked perfectly on its first test in Rexx circles this experience is nota surprise Debuggability Rexx has implicit symbolic debugging Rexx programs can be distributed as human readable code There is an optional compiler but normally Rexx programs are interpreted from the source code Anyone could read the program to solve a problem and test a fix ee ae ae e I8 0m m m P m 1 This number seems too large but the author extrapolated it from an estimate by Bill Fischofer in 1991 He calculated the number of VM users to be 30 million 2 Need strong code control syst
76. control blocks 605 36608 oc At4 1 60910800 REGEQU 00546098 8R R18 Return pass through rc 88920000 00556008 69930000 Change Activity 00560908 Error handling routines 60940000 91 11 21 KH Cleanup and comments 60570808 Mote that in order to avoid the generation of relocatable 80958000 93 86 28 KH Make function package name a macro veriable add 68576816 address constants the TYPLIN PLIST is hand built rather 68960098 copyright as macro variable 90570628 than using WRIERM 66978068 005690000 809860506 End of Speci fi CAT ONS RARREAARAWARRARRARKARTARRRRATEARRARRASKAAR 68590888 BADPt Egu Something s wrong with PLEST 809960008 s 60609060 LA At MSC Get message address 81869808 ERXPACK RMODE 24 Must be loaded below 16H81 06618568 LA R2 L MSCI Get message length 81010508 amp RXPACK AMODE 24 Expects SVC 282 linkage 96620600 81 8 6111 TYPBUFF Set it in PLIST 61626666 B 66636800 R2 TYPLEN Set it in PLIST 61630609 SRXPACK CSECT 66640008 TYPLINS13 X 46 Request error message edit 61640000 66656088 RI TYPLIN Point at PLIST 61650608 Make sure this is a LOAD 00660099 20 Give it to CMS 81860088 gt 90670680 At4 1 Ignore errors 81676600 USING R12 Establish addressabi lity 006800900 R15 4 Set non zero return code 91680000 8 STARTCOD Branch around header 96686199 R16 Return 81096090 oc CLB BRXPACK Peckege IO B0680208 R12 01100008 BMAX SETA N amp CR 60680308 61119966 tl SETA t 60680488 TYPLEN CLB TYPLIN X 0
77. ction with this year s REXX Symposium Next year the Symposium will be held at the Stanford Linear Accelerator Center 1994 Steering Committee Cathie Burke Dager Forrest Garnett Pat Ryall IBM AIX REXX 6000 and IBM REXX for NetWare Tom Brawn IBM IBM AIX REXX 6000 IBM REXX for NetWare Thomas J Brawn Object REXX Development IBM Endicott NY Internet id tombrawn vnet ibm com IBM AIX REXX 6000 Available 12 93 Program number 5764 057 REXX 6000 Reference guide SC24 5708 comments on reference guide can be sent to pubrcf amp galvme vnet ibm com AS IS release Pa In use internally at over 100 IBM locations gf o over r2 years J REXX 6000 Additional details Port of IBM s OS 2 REXX kernel to the AIX dins SAA Level 2 gt I O functions charin charout stream etc gt System exits Default command environment gt address ksh Is Fc enm Access to AIX environment variables pt gt value PATH ENVIRONMENT rd ux REXX 6000 Additional Functions Directory Works just like OS 2 cmd RexxRegisterFunction RexxRegisterFunctionPkg For registering functions from an application or functions from a function package easy access to API functions SysCreatePipe Creates an unnamed pipe for commyf cation between two processes REXX 6000 More functions SysFork Interface to fork command SysGetpid
78. ctions Flow Control Conditional System Utility Operating System Commands External Commands Internal Commands Input Output File Screen Operations Command line input Built in Functions String Operations Flow Control Loops General Batch Operations Arrays Self contained External Commands Functions Sub procedures Input Output Command Line operations user validation Flow control Multiple conditions Built in Functions Text Case amp string General Interactive operations arrays a oe News From the REXX Compiler Klaus Hansjakob IBM IBM Vienna Software Development Laboratory Dr Klaus Han sjakob Lassallestrasse 1 A 1020 Vienna Austria Europe HANSJAKO VABVM1 VNETIBM COM ATIBMCXP at IBMMAIL 431 21145 4243 The information contained in this document has not been submitted to any formal IBM test and is distributed on an As Is basis without any warranty either expressed or implied The use of this information or the implementation of any of these techniques is a customer responsibility and depends on the customer s ability to evaluate and integrate them into the customer s operational environment While each item may have been reviewed by IBM for accuracy in a specific situation there is no guarantee that the same or similar results will be obtained elsewhere Customers attempting to adapt these techniques to their own environments do so at their own risk In thi
79. d If found then a Store the symbol name on the stack b Fetch an expression and assign it to the symbol c Search for TO BY and FOR expressions and store them on the stack d If the limit is already passed then LEAVE If that failed try to evaluate an expression and store it on the stack Store the pointer to any WHILE or UNTIL on the stack If WHILE is found and the following expression is false then LEAVE REXX imc Rexx Symposium 1994 The source and tokenised program are each kept in a linear stretch of memory pointers to which are held in the arrays source and prog respectively The label table is stored in a linear stretch of memory which is organised as a kind of linked list The calculator stack is a space to store a list of intermediate values during calculations The program stack records information about the control structures that are currently open such as DO groups and function calls It stores the variable name step and limit and or the FOR counter of a DO instruction and it stores all the saved state which must be restored on return from a function call The signal stack holds information about which con ditions are currently trapped or delayed and it also holds the data for the CONDITION function It has one entry for each INTERPRET or function call currently active The variable table is a linear stretch of memory which is divided into sections by varstk Each section con
80. d be too high Light weight batteries would not be powerful enough We must package a different motor We have no idea how to write diagnostic messages in Kanji or Cyrillic Add your own problems here _ Clone a nifty application for my computer Is cloning market related Maybe Examine the cloning of applications What are our real motives Are we violating patents or depriving someone of their copyrights MEASURING SUCCESS Quality is the obvious metric and we know that surveys measure quality reasonably well but customer surveys are not predictive What exactly does quality mean Does quality mean delivering on time or delivering a product that works as well as we can make it or delivering what the customer wants They all are good goals that any product should meet if possible Assuming we could measure our product using these _ three quality goals how do we weigh the three against each other We know that one of the definitions eventually must take priority The developer can not decide if a port will be successful until we know which definition of quality the target marketplace demands 226 Consider these metrics vis a vis porting applications Product makes a profit Sadly profit is not a timely metric _ Maintenance cost we can predict simple costs such as help lines change teams continuous market research advertising code control systems legal fees Often measuring failure is possible while measuring success eludes
81. d incorrectly This has made it quite controversial in object oriented circles A common mistake is to think of it as a magic way to combine two different objects into one such as a hybrid of the Rectangle and List classes That probably sounds rather ridiculous but other examples can seem more plausible For example if I have classes Directory which keeps names and some information for cach name and Phone which dials a number passed to it can t I create a Phone Directory class which keeps names and phone numbers and dials the number when given a name simply by inheriting from Directory and Phone Unfortunately it s not usually that simplc The reason is that Directory and Phone were each designed to do a specific job with a set of methods appropriate to that job but neither was designed probably to mix in with the other For example the DIAL method of Phone was designed to be given a number to dial and multiple inheritance won t make it smart enough to change its behaviour to take a name instead and look it up in the directory By the way the right way to do this is called aggregation which means crcating a new object that contains Directory and Phone and provides the right connections between them So when is multiple inheritance useful Actually the answer s in the paragraph above It s useful for classes that have been specially designed to mix in with other classes like the Sequenced and Qucuelike clas
82. d the step to it and compare with the limit If the limit is passed go to 3 a 6 Decrement any FOR counter If it is zero go to 3 a Fetch the pointer to any WHILE or UNTIL If WHILE is found and the expression following it is false go to 3 a Fetch the stored clause number and jump to the following clause REXX imc Rexx Symposium 1994 Example expressions There is a stack of values and a stack of operations 1 Stack an end marker operation with priority 0 2 Search for a value If the next token is a unary operation stack it and repeat 2 If it is C then evaluate the expression inside check for and go to 3 If it is a quote collect a string Collect a symbol name If the token after the string or symbol is C then call a function otherwise stack its value 3 Search for the current operator If the next token is a keyword or the end of the clause then the operator is an end marker Otherwise if it is not a binary operator then the operator is an implicit concatenation 4 Perform operations If the top stacked operator and the current oper ator are both end markers then finish If not and the top stacked operator has a priority no less than that of the current operator perform the stacked operator and go to 4 Otherwise stack the current operator and go to 2 REXX imc Rexx Symposium 1994 Even though the END instruction contains no in
83. dCarDealer inherits animal method init rc animal init self arg 1 arg 2 arg 3 return method makeSale say and only 500 more if you want the wheels return self 207 B Sample ROX class usage Below is a the sessions cmd file which uses the classes defined in the ses sions rox file say testing the Sessions classes if RxFuncQuery RoxLoadFuncs then do rc RxFuncAdd RoxLoadFuncs Rox RoxLoadFuncs rc RoxLoadFuncs end rc time r rc RoxLoad sessions rox Frenchie RoxCreate animal Frenchie 1 Grrrrrr Rover RoxCreate dog Rover 1 Woof Fifi RoxCreate littleDog Fifi 2 bow wow Rex RoxCreate bigDog Rex 4 BOW WOW HonestBob RoxCreate usedCarDealer HonestBob 1 Buy this deal of a car g setMinimumSalary Rex 30 g setMinimumSalary Fifi 20 g says Frenchie say E says Rover say says Fifi scratch Fifi trick Fifi bargain Fifi noo OQ OQ w lt g says Rex g scratch Rex g trick Rex 208 B SAMPLE ROX CLASS USAGE g bargain Rex Bay Eg says HonestBob g makeSale HonestBob 209 C Output of previous samples Below is a the output of running the sessions cmd file testing the Sessions classes Frenchie says Grrrrrr Rover says Woof Fifi says bow wow bow wow Ooooh what an itch Watch my trick I can roll over I get 40 dollars
84. ducts and product names mentioned in the publication are trademarks or registered trademarks of their respective companies Percussion believes the information in this publication is accurate as of its publication date such information is subject to change without notice Percussion is not responsible for any inadvertent errors PRODUCT NAME Notrix Composer for EDA SQL Version 1 0 OVERVIEW Notrix Composer for EDA SQL is a non programming tool that lets you define bulk data movement between enterprise databases and Lotus Notes Using a standard Lotus Notes form you pull data from external sources into Notes by specifying the source database and target Lotus Notes database You can map fields select records calculate new fields and determine job frequency all without programming Also provided is a Lotus Notes database that acts as a repository and log for all Notrix Composer activities Notrix Composer consists of a set of program libraries and a Lotus Notes database that lets you call functions that interface with the Information Builders EDA SQL Server The Lotus Notes database provided with Notrix Composer contains a server program that runs on the Lotus Notes a 164 server and fulfills requests for EDA SQL data Requests are issued by clicking on one of the buttons of the supplied Lotus Notes Form Buttons are provided to Catalog Jobs Schedule Jobs for later execution and Run Jobs for immediate processi
85. e For example THEN is only allowed when the current clause started with IF Keywords are stored as negative character codes defined in const h This makes them easy to recognise during the main loop instead of asking Are the next three characters say we can ask Is the next character equal to the constant SAY which is 128 It also makes it clearer for the expression evaluator when to stop the code WHILE 88 is obviously not part of an expression whereas the word while could be a variable name The tokenised list of clauses is stored in an array prog which also gives other information such as the line num ber and address of the clause within the source The main loop is relatively trivial it is executing the individual instructions such as DO and evaluating the expressions which is the difficult part Bii ipiis A Mir bcr a Ps se Notes REXX imc 20 Internal data structures e the source source the tokenised program prog the label table labelptr the calculator stack cstackptr the program stack pstackptr the signal stack sgstack the variable table vartab and pointer list varstk the work space vorkptr REXX imc Rexx Symposium 1994 Example DO 1 Store the current clause number on the stack 2 Fetch next token If clause has ended then finish 3 Flag the stack entry as repetitive 4 If the token is FOREVER skip past it 5 Otherwise try and fetch a symbol an
86. e 08210090 file containing the functions to MYPKC 602181898 function package is not interrogated as part of 08210119 search order you must load the functions in the 68210128 package explicitely RXMYPKG LOAD RXaasaaa where aaaaaa 66216136 s the name of the function or globally RXMYPKG LOAD 60216148 before you can invoke them 66210158 To drop all functions of a package issue a NUCXOROP command 86210168 for the package NUCXDROP RXMYPKG MEM Klaus Hansjakob IBM Vienna Software Development Lab Wien 2 Lassallestrasse f c o IBM Austria Obere Donaustrasse 95 A 1020 Austria EUROPE HANSJAKO QNVABVM t VNET IBM COM 431 21145 4243 May 95 P oo PBoRObORO 5 9 9 9 5 959599959 999 News from the REXX Compiler Supplement Function Packages Function Packages e Entry exit conditions 86230060 CRLOOP ANOP 08680568 a 08240090 AIF 8I GT amp MAX CRLOOPE 60680600 NOTE The MODULE is generated as a transient module 06250000 OC C amp CR amp I 00680760 88260000 8I SETA amp I41 60680866 s Entry 80270008 AGO CRLOOP 66686960 s Standard SVC conventions 60280000 CRLOOPE ANOP 66661666 RE points to a tokenized PLIST SVC 282 linkage 66296606 06681168 80360008 STARTCOD DS OF 66681266 iy Exit 663168090 L R18 RI4 Save return address 66696866 ud RIS 8 USERFN successfully loaded and returned with 6 06320090 R2 82 Assume install only 60700900 RIS 8 Return c
87. e API operates much like a person sitting at the terminal console A pseudo screen is created which does not display on the COMMAND Post workstation monitor and the REXX program uses functions defined in the API to interact with this screen Some functions allow the entire screen to be captured as an array and transferred back into a REXX variable for processing Other functions allow a portion of a screen to be captured or in the case of a terminal supporting fields a field to be captured Other functions allow data to be sent to the screen as if was coming from the keyboard There are a number functions dedicated to positioning the cursor and searching the screen or fields for text A few give status information including the height and width of the screen The API also allows for an interrupt driven capability for situations where a simpler set of calls cannot handle the exchange The REXX program waits until new data arrives on the pseudo screen and then is released so it can make additional calls to observe how the screen has changed All calls to the API interface are made through the ao targetComm function described above The fd argument contains the handle for the particular target system involved and the function argument contains the number of the API function that will be used The data length and pos arguments definitions vary based on the function call In general data is data being read or written to the pseudo
88. e REXX Compiler Supplement 2 News from the REXX Compiler Supplement 93 Function Packages OAD request Check function name against FUNLIST Only turn on the requested function PUSH USING USING DNUCX R13 AUTOLOAO EQU MN RA LENTRY RS EFUNLIST R2 FUNLIST A15 1 CHECK1 Save USING status Use save area for PLIST ONLIST LNLIST LIST Move skeleton to work area Ri Seve old plist pointer length of FUNLIST entry End of function table Start of function table Set error return code iut R3 UNE Check against name URN R2 R4 CHECKS R168 Found turn function on loop for another check Return with RC 1 LOAD request without function name load al functions in package Return with RC 6 ALLLOAD EQU LR R3 R1 R4 LENTRY RS EFUNLIST RS RA4 R2 FUNLIST NEXTFI wl Save old plist pointer length of FUNLIST entry End of function table Last entry in function table Start of function table NLIST LNLIST NLIST Move skeleton to work area R16 TURNON R2 R4 NEXTFI R15 R15 R11 TURNON EQU MY RI DNLIST Turn on the function Loop for another function Set ok return code Return NLNAME FUNLNAME R2 Copy startup name gt PLIST See if function is already amp nucleus extension mexe it amp nucleus extension if not CMS rel 5 A R15 1 HR RIS RIS ST R15 0NLADOR CLI CMSPROG VMSPS 8NH S 2621 t R15 X 00868600 SvC 264 LIR RIS RIS B
89. e format and usage in the description for sql command Arguments statement name a string of up to 30 characters to identify the SQL command This is used as the first part of the stem variable name containing columns values and as the argument to sql open cursor Return Values 0 successful connection Negative number end of cursor Example To return the names of tables owned by the current user using an explicit cursor rcode sql open cursor Qi select table name from user tables If rcode lt 0 Then Do Say sql error text Exit 1 End Do Forever rcode sql fetch row Q1 If rcode 0 Then Leave Say ql table name End rcode sql close cursor Qil Assuming the user owns the tables EMP DEPT and CUSTOMER the output from this code will be EMP DEPT CUSTOMER 106 Synopsis sql_close_cursor statement_name Description This function closes the cursor associated with statement_name and frees up resources held by that cursor Arguments statement_name a string of up to 30 characters used to identify which cursor is to be closed Return Values 0 successful connection Negative number Oracle error number Example To close an already opened cursor rcode sql close cursor Ql See sq fetch row for a further example 107 Synopsis sql_error_text Description This function returns the text of the last error encountered from the most recent GUROO external function The error may relat
90. e same name like PRINT When a PRINT message arrives at an instance of the class it s important to know which PRINT method will be run The scarch order starts with the lowest class in the hierarchy the class to which the instance that received the PRINT message belongs and proceeds upwards to its superclass then its superclass s O Copyright IBM Corporation 1994 The Object REXX Class Hierarchy 218 superclass and so on up to the root class Object The first PRINT method found is the one that gets run With multiple inheritance the situation is quite a bit more complicated Classes may have many superclasses direct and indirect and there may not be an obvious right order of searching them for a method The rules REXX uses arc 1 A subclass is always searched before its superclasses 2 Mixins are searched immediately before their base class 3 Where multiple classes appear on the INHERIT option of the CLASS directive the classes are searched in the order they appear leftmost first If there is no search order that satisfies all these rules or if a mixin is inherited without its base class already in the search order the inheritance is in error What about multiple inheritance from object classes It s this sort of thing that gave multiple inheritance a bad name There are very few cases if any when it would be appropriate but REXX doesn t prevent it it doesn t seem right to limit the powers of object cl
91. e to an Oracle error or to an error within GUROO itself If the most recent GUROO external function was successful then the value returned is Last operation successful Arguments None Return Values Text of the result of the most recent GUROO external function Example To display the text of the result of the most recent operation Say sql error text See sql fetch row for a further example 108 Using REXX in a UNIX Environment to Manage Network Operations Lee Krystek Boole and Babbage 109 Fri April 29 1994 Using REXX in a Unix Environment to Manage Network 1 Using REXX in a Unix Environment to Manage Network Operations Lee Krystek Software Manager Boole and Babbage Network Services Abstract When designing our network management and control product we needed to provide a way for users to construct scripts to control any foreign system they might need to interface with via that foreign system s console We selected REXX as this tool Before we could use it we had to augment the language to give it the capability to be started automatically connect to those foreign systems and manipulate our relational database 1 1 The COMMAND Post Product Several years ago Boole and Babbage recognized the need for a product that would be a focal point for network and systems management operations This product would monitor and control network equipment computer systems and even application programs Of specia
92. ect variables z 0 z 1 z 2 where another object of class might have object variables z 0 z 1 191 1 6 Class Inheritance Per instance variables are added to an object with the function RoxAddVar Per instance variables are the only way to store stem variables with an object stem variables can NOT be defined with a class When a method is invoked the variables of the object will be available to the REXX code of the method If the value of a variable changes in the method the changed value will be saved with the object It s time for another example In this example we ll describe a simple class in the format acceptable for rox files The class is dog and it has two variables name and breed They will be used to hold the name of the dog and the dog s breed We also define three methods name breed and describe The name and breed functions either set or return the current value of the variable depending on whether any parameters are passed to them The describe method prints a line describing the dog class dog vars name breed method name if arg 1 then name arg 1 return name method breed if arg 1 then breed arg 1 return breed method describe Say The dog s name is name It is a breed return ett Below is some REXX code that uses the class dog The result of the method describe invocation is that the line The dog s name is Jackson It is a Chocolate Labrador Retriever will be printed on
93. ems 3 A Rexx example is LEFT and SUBSTR the former being a special case of the latter 4 Author s opinion 230 REXX for CICS ESA David Shriver IBM 231 REXX for CICS ESA David Shriver May 4 1994 C Copyright IBM Corporation 1993 1994 232 Contents REXX CICS DIisclalmaer uus Exe ux x ata ra er etw ard a de Ce SANG Aw a eae 1 What is REXX for CICSIESA uevesanwacs 9 3 e I PRYTEOP ERS S SS EORR ONE ew Ros 2 Background 22 oC ko aie oe ee E ose BRR WP RC uS Gre I ice RR aca CRUS Se ea em NOR 3 Project history iocos 3 Sada aw wares dre Ha CR CROCO EX de sax eee eee de Ue 4 Background i5 ua dou Rc ROS ACE DO DUX ONE IURE OE we eS RR RR RR Be a ee ate 5 OVOrVIOW 4 3 5 022479 1 aaa ta aaa aca ae Be P TC ea CEDE AREA a SRL AC 6 Need uan xA EVER ER RE RR Wu RACE ACIER Nee VW RR e NEL RECEN 7 Basic Environment uos 8 AVES VERE CER CON ACRI KORR URL CAs p a aae VC e CC 8 REXX File Syat m RFS usa ew he vies eae Pes DAL RC CRCIHCOCU UR CR ee Nae TR 9 Summary osx eae CERCLE EES OER i bw i ORLRUN CK CR e RE UNO UR v Y CR DRE a 10 Questions 4i vues 6 21d RES RC EINE OS SE OS Wed ca CI ce RON le ee aca dio rr 11 May 4 1994 C Copyright IBM Corporation 1993 1994 233 Disclaimer REXX CICS e Disclaimer This discussion is about REXX for CICS ESA a set of products that IBM has announced an early customer program for but has not announced for general availability e Copyright C Copyright IBM Cor
94. erations REXX at Simware REXX Resources on the Internet Using REXX and Notrix for Lotus Notes Data Manipulation Adventures in Object Oriented Programming in REXX ROX REXX Object eXtensions The Object REXX Class Hierarchy Portable REXX Applications and Reusable Design REXX for CICS ESA Working and Playing with REXX and OS 2 Multimedia Converting MVS JCL to REXX TSO 24 33 41 64 74 95 109 125 138 142 166 188 211 223 231 246 250 265 Summary _____ The fifth annual REXX Symposium for Developers and Users convened in Boston Massachusetts May 2 4 The fifty seven attendees came from Australia Austria England Norway Canada and many US states E This conference has become the premier event for exchanging REXX technical information and people were impressed with how much REXX has spread since the last Symposium This year we welcomed implementations for new platforms and continued growth in numbers of users and in importance of uses One of the most popular sessions was Object Oriented Extensions given by Simon Nash of IBM Also IBM gave the first public demonstration of their Object REXX for Windows And the attendees continued the Symposium tradition of contributing software and making diskettes available for all The Symposium served as a springboard for the REXX Language Association RexxLA which will help promote the use of the language RexxLA held its first public meeting in conjun
95. erver support May 4 1994 C Copyright IBM Corporation 1993 1994 238 Overview REXX CICS e Full REXX 3 48 language support under CICS e Dynamic EXEC CICS command level support e REXX interface to CEDA CEMT e DB2 Interface SQL statements amp DB2 commands e CICS native text editor for REXX execs and data e High level VSAM based REXX file system RFS e Execs may also be run from MVS Partitioned Datasets High level Panel 1 O facility e Support for REXX Subcommands written in REXX e Pseudo conversational support e System and user profile exec support e Shared execs in storage via EXECLOAD amp EXECDROP e High level Client Server interfaces May 4 1994 C Copyright IBM Corporation 1993 1994 239 ais aY OSS a a i i Tg g NNO Renie dene Mug endo uy SC HENARES y oE Rf o 4 Dane a gre i E ES aa yA a od aair PEI ae nsi ES Need REXX CICS Need for REXX CICS Asa tool to streamline support staff activities CICS Systems Programers and Administrators DB2 Analysts CICS and DB2 testers other support staff e More productive CICS application development Native CICS development simpler Enjoy the strengths of REXX under CICS e More flexible powerful product customization amp extension macros e Quick prototyping and procedural language functions e Preserve REXX investments in migrations e Needed for products with REXX requirements e Asa script language to automate st
96. es across a single wide area network line One of the controllers goes off line for a period of time and the FEP automatically aro that controller from the polling list When the controller came back on line an operator would command the FEP to add that controller back into the polling list Under COMMAND Post automated operations an EM monitoring that communications line would report the failure of the control unit COMMAND Post filters would detect this as an alert and would then trigger an automatic operation to send a command to the FEP to add the controller back to the list If the controller failed to respond over a specified period of time a high priority alert could be generated to inform the operator that a situation had occurred that could not be remedied through auto operations Figure 3 The design of the alert detection and trigger mechanism took advantage of COMMAND Post s relational database mechanisms for storing and accessing data A graphic window display known as a selector already existed to select alerts The implementer uses the selector and the mouse to click on certain rules that describe the alert s to be shown on an alert display window This idea was extended to allow groups of alerts to be detected When a specified combination of alerts is detected instead of having the alert s appear in a window a trigger would fire and the auto operation would start Figure 4 Once the detection facility was decided the
97. eturn self lt s class animal vars name sound soundTimes method init name arg 1 soundTimes arg 2 sound arg 3 if name then name unnamed if 0 datatype soundTimes W then soundTimes 1 205 if sound then sound return method says Bay name says do i 1 to soundTimes say sound end return self WIEIEIARIEILINNEEIIAEIDIDIEIDIZINGIIDIZIZIDIRSEIDIIIDIZITISIIIE ELRES EEEE EID GE SATS SSS SAE SS ESS EL IIT ET class dog inherits animal performer method init rc animal init self arg 1 arg 2 arg 3 return method scratch say Ooooh what an itch return self ETSER GNIE IE IE CHE NLIS QE QIE DO GZIE GEN BETIS TEL SES IT GNE SESE RIIN DE CX GE RIED ERRER GE R GC TET class littleDog inherits dog method init rc dog init self arg 1 arg 2 arg 3 return method trick say Watch my trick I can roll over return self G OXEGEGEGHRUOGE GEI GNONEDIAMCHE GE IECGO UIS RD GUGE GR MCONE NECHDGOXR IE ECCE GE DIL OC GN SAE EVE EDGE IF UCIN GR ID GC RECEDIE GP II SED ID GIA XD GO NCIBOGC NIIT NI class bigDog 206 A SAMPLE ROX FILE inherits dog method init rc dog init self arg 1 arg 2 arg 3 return method trick say Watch my trick I can fetch the letter carrier return self H d NERIS RE ONE DEO S SUS VM WT IS ee Ete EB eB Ae eS ORE Rer QU UC REU MI Dt UNDO class uge
98. executed twice as a result of the recursion However due to the rules for evaluation of REXX expressions the retrieval of the i variable at the end of the last clause is executed twice first at end of the second invocation of bar and then at the end of the first invocation of bar Note i is referred to after the recursion itself According to the rules outlined above the shortcut pointer is cached at the end of the second call to bar the first recursive call Thus at the end of the first call to bar this cached value is picked up but the generation number does not match the recorded generation number is greater than the current generation number so the shortcut pointer is discarded and the variable is located using the standard procedure i e since the pointer was made the routines in which it was made has been terminated There is another less subtle point here too All variables local to the second recursive call to bar are discarded when that routine returns Thus the shortcut pointers appear to point to undefined memory This is easily fixed by maintaining a counter with each variable box Whenever a shortcut pointer is set to point to that box the counter is incremented and whenever a shortcut pointer is removed from pointing to a variable box the counter is decremented As soon as this counter mechanism is in place a variable box can be marked for deletion and retained until all shortcut pointers to it have been killed
99. ey need to be instance methods somewhere and we call this class the Class class It s natural to make the Object Class metaclass and Database Class metaclass subclasses of the Class class since they can then inherit all its instance methods listed above Which class is the metaclass for abstract classes Their object methods are the ones that are shared by all classes DEFINE DELETE etc Since these are the instance methods of the Class class the Class class is the metaclass for all abstract classes What about metaclasses for mixins Mixins are very similar to classes only difTering in their inheritance rules so we make the Mixin class the class whose instance methods are object methods of all mixins a subclass of the Class class Is the Mixin class the metaclass for all mixins It isn t for the same reason that the Class class isn t the metaclass for all classes just as different classes have different object methods mixins do too Let s take an example to see why different mixins have different object methods If we create a Relational mixin to our Database class with instance methods but no class methods what object methods does the Relational mixin have They include all the standard mixin object methods the instance methods of the Mixin class as well as the inhcrited class methods NEW ENHANCED and RESTORE We want these as object methods because we want the Relational mixin as a mixin to an object class or an object ntixin
100. f tokens The difference lays in generating 26 i i grin Istn 2s ca t foo bar j cy 400 a CES bar foo Figure 2 A parse tree built by Regina a parse tree which requires a more thorough analysis than a simple conversion of the source code to a list of tokens The most obvious approach for executing the code represented by the parse tree would be to traverse the parse tree and for each binary operator amp x etc first traverse the left subtree then the right subtree and in the end apply the operations to the two strings obtained from the traversals It is possible to add some optimalizations here bar foo We know that this must always be a non numeric comparison this there is no need to try anything but a normal string comparison straight away 2 bar In this expression we are only concerned with the numeric value of bar so we retrieve its value in numeric mode as described in section 2 a b amp c d Here each of the two pairs of parentheses can result in either 1 or 0 Thus we use the native integer format of the computer to signify the values rather than using the Regina string or numeric format 4 Datatyping Expressions Using these techniques the dataformat of the data transmitted from a subtree to its parent node depends on the context For instance consider the parse tree shown in figure 2 After adding the datatypes t
101. files in a particular package GET package name PACKAGE To get a list of files in a package GET package name PACKAGE To get a specific file GET filename lt filetype gt To Submit a Program to Rexxlib Send it to rexxlib psuvm psu edu e Source code only No fees Must be well documented amp readable How to get files via FTP FTP rexx uwaterloo ca You will be asked to identify yourself Type anonymous You will be asked for your password Type your userid 2 your domain Useful commands dir X list directory cd change directory get copy a file to your machine help get help quit exit FTP Rexx Info via FTP Locations to try rexx uwaterloo ca pub general Rexx info Rexx FA Free interpreters for Unix and DOS flipper pvv unit no pub rexx Regina code Archive of comp lang rexx ftp os2 cdrom com ftp luth se pub os2 OS 2 archives wuarchive wustl edu pub aminet Amiga archive Rexx Info on Gopher Gopher site bigblue pvv unit no Rexx FAQ Comp lang rexx archives e CMS Rexx manual Documentation for Rexx imc and Regina Papers on Rexx ANSI committee documents Using REXX and Notrix for Lotus Notes Data Manipulation Alan P Matthews Percussion Software 142 Using REXX and Notrix for Lotus Notes Data Sth Annua REXX Symposium f ent vere OHO SEES Agenda a Lotus Notes o Issues aN
102. forma tion although it might contain a symbol name details of which have been skipped here it can be interpreted because the information is all on the program stack In terpreting the stacked data is relatively straightforward REXX imc The function which performs the above algorithm is called scanning This is a variant of a well known algorithm to turn an expression in infix notation into one in reverse polish notation sometimes described by analogy with a railway track with a siding the siding being the operation stack REXX imc evaluates the reverse polish expression as it is created The calculator stack is the stack which reverse polish notation requires The unary operations each operate on the top value on the calculator stack replacing it with the result The binary operations each operate on the top two values replacing them with the result It is clear that at step 4 of the above algorithm it is always true that the number of values on the calculator stack is one more than the number of stacked binary operations Since each stacked binary operation reduces the size of the calculator stack by one item this means that when the stacked operations have all been performed there is precisely one element left on the calculator stack This is the result Arguments to functions and expressions within parenthe ses are evaluated by calling scanning recursively REXX imc Interesting Corners of REXX Mike Cowlishaw IB
103. g Adventures in OO Programming with ROX Copyright IBM Corp 1994 173 e Objects created with RoxCreate o arg 1 is the class name o arg 2 are initialization parameters o The init method of the class invoked automatically if present o Initialization parameters passed to init method e Objects destroyed with RoxDestroy o he deinit method of the class invoked automatically if present Adventures in OO Programming with ROX Copyright IBM Com 1994 174 RoxCreate returns a string that is a reference to an object Object reference passed as first parameter to all methods and RoxDestroy Object references are plain old REXX strings can be kept in a blank delimited string as in objs wu do i 1 to 10 objs objs RoxCreate dog J end Special variables self and super available to methods which represent the receiver of the method Adventures in OO Programming with ROX Copyright IBM Corp 1994 175 Message sends are just REXX function invocations Object reference is always the first parameter Function name is method name prefixed by ho Object and method name used to resolve the class that implements the method The two move methods invoked below are probably implemented in different classes XX add aNumber 100 XX add aList aListItem Adventures in OO Programming with ROX Copyright IBM Corp 1994 176 Objects have as their instance varia
104. g paradigm for a general attack on the Reusable Code problem A Rexx application being readable accessible by the average programmer is a possible stage to experiment ina _ practical way with Reusable Design The Reusable Design paradigm is based on the classic principles of modularity in Computer Science It can include object based or object oriented methods but the prime principle is semantic as well as syntactic readability the actions of the Reusable function are clear and concise to programmer Readability allows early planning by potential reusers customers for a reusable function As the Rexx Application developers rely more on reusable components market forces could encourage the proliferation of popular reusable components to popular operating systems 224 PREFACE The thoughts and experience herein are those of an operating system coder and designer from 1968 to 1992 and do not pretend to be current in this year 1994 PORTABLE Rexx APPLICATIONS AND REUSABLE DESIGN Outline Porting Applications motivation Measuring Success when to stop Code Reuse promise and problems It is the Design stupid Why Rexx ah on PORTING APPLICATIONS WHY BOTHER Definitions and ground rules help address a problem To port means to change a product such that it works in two or more environments An example of a portable product is a Walkman a personal tape player A Walkman ports very easily around
105. h testspin cmd The demo shows code testing a collection along with a spinner running independently in another thread testthrd cmd This program tests the thread capabilities of ROX cmdline cmd This program uses cmdline rox as a command line reader with history Use the up and down arrows to cycle through previous lines entered roxsocks cmd amp roxsockc cmd These programs demonstrate tcp ip server and client programs X socket class in socket rox 202 8 HISTORY 8 History 04 14 94 version 1 8 e fixed problem with super calls e removed RoxVarSynch e added RoxAddVar and per instance variables e cut execution time in half with new memory management scheme e added RoxStats and RoxProf cmd 01 06 94 version 1 7 e minor documentation cleanup e cleanup of internal structure of ROX no external changes most notably no performance changes 10 22 93 version 1 6 e fixed infinite loop when no variables set in an init method ObjectSaveS tate RoxStemSynch ping ponged Reported by Zvi Weiss as a problem when a syntax error occurred in an init method e changed compiled classes methods stuff to have just one type of class and either compiled or REXX macros ai ee macros added with RoxClas sAddMethodCompiled 09 14 93 version 1 5 e more thread reentrancy fixes e added compiled class capability 08 31 93 version 1 4 e added RoxSendThread function e first attempt at making everything
106. happens in Object REXX is a method Messages Everything that happens in Object REXX is caused by a message P Qe LI i K D boyy Reno bj ect New REXX changes Expressions in stems Parse enhancements Countstr Changestr functions Extended Do syntax Date conversions Cty My Vy Yn Vy Al Expressions in stem references Allow expressions on right side of stem s Use to contain stem expressions Example Before tom index 1 chris index 2 if employee tom chris Is written if employee index 1 index 2 0C Parse enhancements parse caseless Parse template match without regard to case Example parse caseless value Out To Lunch with first to last say first Z2 Out Seem say last gt Lunch a KS adl parse lower S Translate to lower case then parse Fd Example parse lower value Out To Lunch with first to say first gt out j say last gt lunch RT I countstr changestr countstr needle haystack Returns count of needle in haystack Example countstr is This is a test of counstr gt 2 changestr needle haystack new i Returns copy of haystack in which new replaces Al occurences of needle ra Example changestr 1 101100 X xoxxod bject CC Extended DO Adds ability to iterate over stems Example
107. he bonuses of implementing REXX as our auto operations language was that we could use it for general programming We have a large library of scripts mostly written in Bourne or C shell used for installation and maintenance of the product When these scripts interacted with the database they had to first create a second file that would act as input to the Sybase s Interactive SQL program ISQL Then they had to start ISQL directing the second file to the standard input and finally monitor the standard output for errors This convoluted approach made the script hard to read It also made isolating a particular SQL statement that failed difficult since the script was not feeding the commands to ISQL one by one Our REXX with the ability to address the server through the ADDRESS instruction has simplified this problem Since the REXX can address the database directly it is easier to write and test the script program Errors are also easier to detect and handle 1 8 Results Over 100 sites now use COMMAND Post with the automated operations facility A majority of the customers involved have decided to write their own custom auto operations scripts which lessens the load on our support staff We are pleased with our decision to use REXX for auto operations 119 Fri April 29 1994 Using REXX in a Unix Environment to Manage Network 1 9 Bibliography COMMAND Post How to Guide Release 3 0 Boole and Babbage Network Systems San Jose Califor
108. he following REXX code re RxFuncAdd RoxLoadFuncs rox RoxLoadFuncs rc RoxLoadFuncs To unload the DLL you should first call the RoxDropFuncs function then exit all CMD EXE shells After exiting all the command shells the DLL will be dropped by OS 2 and can be deleted or replaced 3 Function Reference The functions provided by the ROX function package fall into the following categories e function package functions e class definition functions e object lifecycle functions 193 3 1 Function Package Functions 3 1 Function Package Functions The following functions load drop and query the version number of the ROX function package RoxLoadFuncs load the ROX function package rc RoxLoadFuncs Loads all the functions in the ROX package If ANY parameters are passed to this function it will bypass the program au thor and copyright information normally displayed All parameters are ignored except to determine whether or not to bypass displaying the information RoxDropFuncs drop the ROX function package rc RoxDropFuncs Drops all the functions in the ROX package RoxVersion returns version number of the ROX function package vers RoxVersion Returns the current version number of the ROX package RoxStats generates execution profile info rc RoxStats lt parm gt This function can be used to generate profile information on stderr A parameter should be passed to start
109. he new parse tree is shown in figure 3 5 Hash Tables to Store Variables Regina uses hash tables to store the variables defined at any given point during the execution of a REXX script This technique can make the retrieval of a variable a constant time operation if given a well balanced hash table However once the hash table becomes full the efficiency drops One of the key points with hash tables is to choose the correct size If the size is too small the handling of overflow adds a large overhead If the table is too big the extra work of initialization and deallocation adds unnecessary overhead One solution is to have only one huge hash table for the whole interpreter in which case the work of initialization and deallocation of the hashtable is done only once However this requires some extra overhead for insertion and deletion of variables 27 bool a bool ose e da ud str num num Xxx bar j boy 1000 num num mi Na bar foo Figure 3 Parse tree with datatypes of transmitted results Among other things it makes the operations of deleting all tails of a particular stem a bit more complicated Another solution is to use dynamic hashing where a small hash table is used initially and the table is expanded when it is filled The advantage of this technique is illustrated by the fact that the interpreter has no way of predicting the number of tails used by a routine at the entry of the routine Except
110. iables The fact that REXX is a typeless language is often described as one of its major advantages Thus it might be a great surprise to learn that one of the techniques boosting the performance the most was introducing typed variables Another technique was introducing typed expressions which is described in the next section f Internally a Regina variable can hold either a string value a numeric value or both When setting a variable either a string or numeric value is set depending on the context Whenever the value of a variable is retrieved it can be retrieved as either a string or a number If a string value is retrieved for a variable currently holding only a numeric value that value is converted so the variable holds both data type formats and then the string value is returned To understand the difference between these two formats it might be instructive to look at their definitions in Regina Lenth 123456789 n 1 n String format i Numeric E HE E P i format L Re ER E Length Sign Exponent 1 234 5 n Figure 1 Storage formats for variables in Regina 25 For the string format the values 2 2 and 2E0 are different but for the numeric format these are identical The string is simply a sequence of characters having a specific length The numeric format is a sequence of decimal digits to which there are connected three pieces of information the length number of digits the sign
111. ice relationships between them that don t match the O Copyright IBM Corporation 1994 The Object REXX Class Hierarchy 221 hierarchy similar or identical methods cropping up in different places That s the time to think about making use of abstract classes to bring the relationships between your object classes into clearer focus This ongoing refinement of the class hierarchy is a hallmark of good object oriented programming seeing new relationships between your classes and finding better ways to structure the hierarchy to express those relationships Don t try to start out by designing a sct of 20 abstract classes 50 object classes 15 mixins and all the relationships between them You won t get it right at the first attempt Far better to develop your hierarchy gradually refining it as you acquire a feel through hands on experience of how the classes relate to each other Summary We have seen how object methods instance methods and class methods are used in Object REXX The need for object classes abstract classes and mixins has been explained together with guidelines for when they should be used and how they relate to single and multiple inheritance The use of all the above facilities of the REXX language has been illustrated with examples from the class hierarchy provided by REXX Finally the role of metaclasses in completing the picture has been shown Acknowledgements The main structure of the REXX cla
112. ill be read from the standard input mE RM CONV e ue ER jer a LERRA REXX ime Added Features stem expression stem string SELECT expression WHEN value THEN instruction END SELECT PROCEDURE HIDE PARSE VALUE x y z WITH p1 p2 p3 Any non zero number is true OPTIONS SETRC for setting RC after I O operations trace prefix for continued lines Extra tracing for SIGNAL ON x when x is an undefined label Features from CMS PARSE NUMERIC JUSTIFY LINESIZEO REXX imc Rexx Symposium 1994 Features for Unix The TRL I O functions Pre defined streams stdin stdout stderr The STREAM commands close fdopen fileno flush ftell open pclose popen Functions CHDIR GETCWD SYSTEM USERID Access to the Unix environment via the VALUE built in function Access to Unix error messages via the ERRORTEXT built in function Subcommand environments UNIX and COMMAND The stack daemon The function interface REXX imc Rexx Symposium 1994 Of these enhancements one namely the trace prefix is as a result of a decision of the X3 J18 standardisation committee and one other namely the compound variable with an expression as part of its tail has been provision ally accepted by the extensions committee More sub stantial enhancements based on meetings of these com mittees such as date time conversion functions were planned but have been delayed The PROCEDURE HIDE instruction really means
113. illcroft Way Netwown PA 18940 215 579 2537 brodsky netaxs com Shu Chen 246 W 102nd St Ste 4B New York NY 10025 Ina Chien Putnam Investments 859 Willard St Quincy MA 02169 Participants 265 Anders Christensen Sintef Runit N 7034 Trondheim Norway Ian Collier The Queen s College High Street Oxford 0X1 4AW England 44 865 727940 imc prg ox ac uk Mike Cowlishaw IBM Hursley Park Winchester S021 2JN England mfc vnet ibm com James Crosskey IBM Corporation Dept G79 1701 North St Endicott NY 13760 crosskey gdlvm7 vnet ibm com Cathie Burke Dager Stanford Linear Accelerator Center P O Box 4349 Stanford CA 94309 415 926 2904 Fax 415 926 3329 cathie slac stanford edu Charles Daney Quercus Systems P O Box 2157 Saratoga CA 95070 408 867 7399 REXX 75300 2450 compuserve com Chip Davis 7254 Pommel Dr Sykesville MD 21784 5931 410 549 3596 chip clark net Rafael Fessel Ammonoosuc Tech 131 Ridge Rd Franconia NH 03580 603 823 8461 Forrest Garnett 2500 Huston Court Morgan Hill CA 95037 408 284 0295 garnett vnet ibm com Hal German GTE Labs 40 Sylvan Road Waltham Ma 02254 617 466 2290 Fax 617 890 9320 hhg1 gte com Eric Giguere WATCOM 415 Phillip St Waterloo Ontario Canada 519 886 3700 Fax 519 747 4971 Klaus Hansjakob IBM Austria VSDL Lassallestrasse 1 A 1020 Vienna Austria 43 1 21145 4243 Fax 43 1 21145 4490 hansjako vabvm1 vnet ibm
114. ing transaction By default whenever the GUROO program exits you are disconnected from the database Arguments None Return Values 0 successful connection Negative number Oracle error number Example rcode sql disconnect 07 Synopsis Sql command statement name sql command bind variable name bind variable value Description This function enables you to execute any Oracle SQL Plus command including DML and DDL statements Typically you would execute commands like select or update using this function Note that the command does not end in a semi colon If you do append a semi colon to the end of the command GUROO will remove it When the SQL command issued is a select statement GUROO returns all column values in arrays The stem variable name is composed of the statement name followed by a period followed by the column name specified in the select statement As with all REXX arrays the number of elements in the array is stored in the variable with an index of 0 When the value of a column is NULL an extra REXX variable is created This variable has the same structure as the REXX variable containing the column value but with NULL before the index value For example the REXX variable created for a select statement containing the column COL NAME and a statement name of Q1 will be Q1 COL_NAME 1 for the first row If the value of that column is NULL the REXX variable created is Q1 COL NAME NULL 1 To determine if
115. ions to the REXX language to support database operations were based on insights provided by the mainframe REXX group Some of the auto operations scripts would be written by customers and a language already familiar to IBM type main frame operators was desired Although COMMAND Post is a Unix based product many of the audience for it have their roots in the IBM culture where REXX is widely used By choosing a familiar language it was hoped there would be less fear and resistance by customers to writing their own REXX scripts REXX s ability to parse data strings would make analysis of messages coming from the EM s easier It was expected that much of the function of the scripts would be to respond to messages coming from the EM systems The REXX parse facility allows most of these messages to be handled without a lot of programming The parse statement is usually easy for even a novice programmer to understand REXX s ability to pass commands to underlying environments makes it easy to address COMMAND Post s database The extensions to the database were critical if we were to be able to write easy to read scripts The ADDRESS instruction allowed us pass SQL command directly to the database Also important was the ability of REXX to create new variables of any type on the fly as data was returned from the database This eliminated the need for a rigid ppp cated structure as used in C when getting data back from the Use
116. iples Shell A Unix command interpreter Shell Script A program that is interpreted by a Unix C or Bourne shell SQL A 3rd generation database manipulation language Sybase A RDBS product Tandem 6539 Tandem async terminal Unix Operating System on which COMMAND Post runs VT 100 VT 320 DEC async terminals 121 Fri April 29 1994 Using REXX in a Unix Environment to Manage Network 1 11 APPENDIX Sample COMMAND Post REXX program usr nc bin nerx s ftne HRREEEEREREREEEEEEAEHRERERREEREREEREEREREEEEEREEE REXX program to perform simple paging The OSI Severity of the first triggering alert will be sent to the pager c This program does the following Pet Connects to a tool called pagerModem which is assumed to be an AT mode modem Initializes the modem for word responses gt Sends touchtone dial sequence which leaves the modem in command mode Sends PIN followed by Looks at the first underlying alert passed in and gets the OSISeverity value from the data base gt Sends OSISeverity followed by out to the pager Waits 5 seconds for repeat gt Sends final to force posting of message gt Does a hangup gt Disconnects from modem ui The following variables should be passed in from the trigger pagerModem Access path of the modem PIN Users pin number x underlyingAlerts optional alertCount option If no aler
117. isc player with computer control optional Major Features in MMPM 2 1 1 Multimedia folder Sound setup object for system sounds Applets 247 y Volume control Drivers Sample files Lotus 1 2 3 and Excel audio macros External function library for REXX and help file Principle File Formats 9999 Generally a superset of Windows file formats WAV Digital audio pulse code modulation and variants MID Standard MIDI file format for instrumental music AVI Audio video interleaved IBM Ultimotion and Intel Indeo Conversion applet for some additional file formats included AVC VOC DIB DMP ADPCM M Motion High degree of modularity permits addition of more file formats e g FLI FLC Principle REXX Features 999 Multimedia with REXX help file PLAY CMD RECORD CMD Entire MCI media control interface command set available not just subset described in online help External function library MCIAPI DLL provides access to MCI command set Key Limitations e REXX is unable to deal with loss of device meaning ACQUIRE EXCLUSIVE must be used REXX program should not hold device exclusive forlong Unless using PMREXX or one of the visual REXX builders MCI commands which require Presentation Manager such as Ultimotion playback will fail REXX does not receive PM messages to easily monitor the status of playback and devices MCI s implicit opens a
118. itance ak x Ro xe Soy Wo oP ey 1 se band super 220 d aos REIS URS we ees 2 Installation and Removal 3 Function Reference 3 1 Function Package Functions llle 3 2 Class Definition Functions lees 3 3 Object Lifecycle Functions llle 4 Format of rox Files 5 C Programming Interface 6 Utilities Provided 7 Classes and Testers Provided 8 History A Sample rox file B Sample ROX class usage C Output of previous samples 189 10 11 13 14 16 18 21 23 1 Introduction 1 1 What is ROX ROX is a function package for REXX that allows for object oriented OO programming in REXX You should have some basic familiarity with OO pro gramming before diving into ROX ROX allows classes to be defined The classes have a number of features e they may inherit from other classes e they specify variables that will be maintained for each object created of the given class e they specify methods written as REXX code Classes are defined in files with an extension of rox See Format of roz Files on page 10 for the format of the rox files 1 2 What ROX isn t ROX is not a new language it is simply a function package that can be used from the OS 2 REXX language providing some OO capabilities ROX provides NO facilities for interacting with other object oriented systems such as SOM or Smalltalk ROX has no distributed cross process or cross platform capabilities
119. l interest were non SNA and non SMNP systems which did not support any network management protocol COMMAND Post runs on a UNIX workstations Initially the SUN SPARC series of processors was used however porting to other UNIX systems is underway A typical COMMAND Post system consists of one or more perhaps even as many as 50 at a large site workstations with color monitors running a GUI such as Open Windows or Motif The system is composed of modules written in Smalltalk an object oriented language for the user interface and C for the more intensive processing tasks Sybase a relational database provides the data storage COMMAND Post will typically connect to a network system such as a modem monitor or T1 monitor or a computer through the system s printer port and console These type of systems are typically referred to as Element Managers or EMs because they control one class of element in the whole network An EM s printer port will often produce interesting information such as the failure of a modem or communication line COMMAND Post has a tool called ALFE ALERT LOGIC FILTER EDITOR that implementers use through user friendly dialog screens to construct an alert filter Figure 1 The filter searches the message stream from the EM s printer port and recognizes important messages The filter parses those messages and then creates an alert in the COMMAND Post system using data obtained from the message The filter a
120. library Before calling any of the functions the Rexx programmer must call the initialisation function If a function cannot be found then a Unix program having the same name as the function is searched for The program can be in any language supported by Unix such as C perl or shell script It will be exec ed with the arguments in argv and the function name in argv 0 and it should print out the result if any on its standard output followed by a newline character Many functions can be aliased to one function library by supplying a text file called rxlib where is the basename of the function library which lists the names of all the functions in the library The library can be a rxfn file a Rexx file or a Unix program If it is Rexx then it can find out which function is being called using parse source Notes REXX imc 18 Tokenising a program means in the case of REXX imc e rejecting invalid characters and unmatched quotes e removing comments null clauses and excess blanks e Concatenating lines which are continued with a e translating un quoted text to upper case recognising keywords like NOP SAY IF and so on organising the program as a list of clauses each end of line or THEN starts a new clause In addition labels THEN ELSE and OTHERWISE are clauses by them selves e making a label table Keywords are recognised based on what has appeared since the start of the current claus
121. lude readability available source code and easy source level debugging Notrix extends the REXX language to work within Lotus Notes also adding functions that make it simple to manipulate Lotus Notes databases KEY FEATURES BENEFITS o Notrix is completely Notes centric and takes advantage of Lotus Notes replication and security features giving you a distributed code base and a secure development environment o Notrix does not require knowledge of the Lotus Notes API or complex C programming so that the project development cycle is reduced by 8096 saving hundreds of hours and thousands of dollars in outside consulting and technical support time o Notrix eases the implementation of large Lotus Notes data manipulation projects since it utilizes standard REXX Dynamic Link Libraries DLLs to minimize programming time and provides sample programs to enhance ease of use and supply instant productivity o With the Notrix Event Manager you can build Notrix applications that automatically trigger when documents in Lotus Notes databases are opened updated or deleted Also a job log can provide an audit trail for system management tracking purposes o Notrix is server based and no additional software is required on the Lotus Notes client so that any Lotus Notes client Windows OS 2 Macintosh etc can be used on a LAN or dial up o Notrix includes a Notrix Discussion Database for users who wish to exchange
122. mechanism to allow the system to carry on a conversation with an EM console was next An augmented version of REXX was chosen for that mechanism Why REXX The decision to use REXX was based on several factors The actual REXX 112 Cu shutdown FEP stops polling Main Control Frame Unit 4 Command sent to console for 2 EM log restart messages note COMMAND Post Restarting a Controller by Auto Operation Figure 3 SendMail AO Trigger selector Copyright c 1933 Boole amp Babbage Inc All Rights Reserved Version 3 1 a Select Group Display File Ok Help ELECTION CRITERIA sf e e a e e e a aa a ae ManualAlerts alerts state NetCmmnd E active y alerts timeReceived value since today 0 10 00 A Selector Figure 4 113 Fri April 29 1994 Using REXX in a Unix Environment to Manage Network product chosen was uni REXX from the Workstation Group LSE 1 3 2 1 3 3 1 3 4 1 3 5 REXX was already an established language for auto operations on Boole s mainframe products In addition to COMMAND Post Boole already had some main frame products that incorporated auto operations They used REXX extensively It was decided there would be an advantage to keep the auto operations language consistent between the products Using REXX also allowed us to draw upon the experience of our main frame programmers and some of the extens
123. minal Element Server Command Post Managers Workstations Emulation Connections Figure 2 111 Fri April 29 1994 Using REXX in a Unix Environment to Manage Network 1 2 The Auto Operations Requirement 13 It became apparent after the initial release of COMMAND Post that our prospective customers wanted to have the system support automated operations That is to have COMMAND Post not only detect alerts and display them but to also automatically take actions based on an alerts or alerts received from a single EM or on a combination of alerts from sev ral EMs COMMAND Post already had the ability to connect with the system consoles for the various EMs Therefore it seemed logical that if an automated operations facility could be built we could send commands to the appropriate EM through the emulations to get an EM to take the desired action The automated operations facility needed two parts First some kind of detection mechanism that would allow the triggering alert or combination of alerts to be recognized Second another mechanism that could have a conversion with an EM s console as if it were a human operator in order to enter the commands necessary to get the EM to carry out the desired action A simple example of an automated operation though no longer a problem on most networks is automatic restart of polling on a communication line A Front End Processor FEP is polling several control units at remote sit
124. mplete set of methods for some property so that a class can acquire that property just by inheriting from the mixin Other mixins define a property and provide some of the methods required but depend on subclasses to provide other necessary methods For example a Persistent mixin may provide methods that take care of saving object data to stable storage and restoring it when needed but not the methods that actually extract the object s essential data when saving and recreate its state from saved data when restoring Those methods may be left as placeholders in the Persistent mixin needing to be filled in by classes that inherit the persistent property from it sincc only they know the intimate details of how they are constructed To create a mixin use the MIXIN option on a CLASS directive For example to create a mixin OrderedSet which has a base class of Sct you would write class OrderedSet mixin subclass Set The Class Search Order for Methods In a single inheritance hierarchy classes inherit methods from their ancestors in the hierarchy Since every class has exactly onc superclass except the root class Object which has none there is a simple line of inheritance from each class up to the root class Object through any intermediate ancestor classes This line of inheritance defines a search order for methods the class search order The order is important because more than one ancestor class may have an instance method with th
125. n use multiple inheritance by specifying the INIIERIT option on a CLASS directive which is equivalent to sending one or more INHERIT messages to a class object For example to create a class Window which is a subclass of Visual and also inherits from Movable and Sizcablc you would write class Window subclass Visual inherit Movable Sizeable There s no limit to the number of classes you can inherit from in this way Class Methods We ve seen that class objects have both instance methods and object methods How are their object methods like NEW defined The CLASS option on a METIIOD directive indicates that the method being defined is a class method not an instance method For an object class this means that the class will have that method as one of its object methods For example the Array class defines OF as a class method and this allows OF messages to be sent to the Array class object to create array objects whose contents are specified by the arguments to OF What about abstract classes can they have class methods too They can but their class methods work slightly differently than those of object classes They are defined in the same way with the CLASS option on a METHOD directive but they don t become object methods of the abstract class itself Instead they become object mcthods of any object classes that inherit directly or indirectly from the abstract class in which they arc defined For example the Sequenced cla
126. nect is the single argument to ao targetClose The third function ao targetComm actually carries out the transfer of data between the REXX program and the target system 1 4 1 Application Program Interface When it came to actually talking to the target system we were faced with an additional problem Usually the device a REXX EXEC needs to talk to is a system console That means the program would be responding to the commands we sent it with data including our own full duplex echo as well as occasionally sending out from our point of view random lines of data as the result of activity on the system How could we develop an interface for REXX that would allow us to send data at will and handle messages from the target when they came in at any time Turning to an interrupt model where we would sit in a wait state until an incoming message would trigger a designated REXX function seemed to be too complicated for easy use by most of our customers especially when more than one target system might be involved in a single REXX program Instead we decided to use an Application Programming Interface API to interact with the target The API we developed was similar to that defined by IBM as the IBM PC 3270 Emulation Program Entry Level High Level Language Application Program Interface or EEHLLAPI Where the IBM was targeted to a 3270 terminal interface our API widens the definition to cover terminals that do not use field positioning Th
127. ng KEY FEATURES BENEFITS o Notrix Composer lets you bring information from external data sources into Notes with no programming You can now access information from your company s databases and bring them right into your Lotus Notes documents through an easy to use Notes Forms Interface that is supplied with Notrix Composer o Notrix Composer contains a Lotus Notes Forms Interface that lets you specify the tables to access within the enterprise database the Notes server and the target database name You can also design how the original fields map to Lotus Notes fields and apply selection criteria to extract only the data you want o Notrix Composer works with Information Builders EDA SQL Server to provide access to over 50 different relational hierarchical and native file systems Data throughout your corporate information systems such as customer profiles financial results or marketing information is now available for your Lotus Notes users and can be distributed across the enterprise using the facilities of Notes database replication o Familiar Notes facilities are used throughout Notrix Composer and all Notrix Composer functions are integrated with the Lotus Notes environment You can enter your information request into a Lotus Notes Form and defer processing to a schedule of your choosing o Notrix Composer is server based and no additional software is required on the Lotus Notes client so that any Lotus Note
128. nia 1993 Programmers Guide High Level Language Application Program Interface IBM Corporation Austin Texas 1987 x A REXX CookBook for COMMAND Post Boole and Babbage Network Systems Mt Laurel New Jersey 1993 uni REXX Reference Manual The Workstation Group Rosemont Illinois 1991 120 Fri April 29 1994 Using REXX in a Unix Environment to Manage Network 1 10 Glossary ALFE Alert Logic Filter Editor The facility in COMMAND Post used to construct a filter API Application Program Interface The interface that allows REXX and C based programs to interact with COMMAND Post emulations Dataserver A process that manages and provides access to a database EM Element Managers Network Control and Monitoring systems that manage a domain of network elements like modems communication lines etc Event Handler COMMAND Post primary memory resident dataserver EXEC A REXX program for COMMAND Post that is part of the auto operations subsystem IBM 3151 IBM async terminal IBM 3270 IBM sync terminal Filter A program in COMMAND Post which parses a stream of data usually from some external source looking for messages When a message is found the filter created an alert for the COMMAND Post database Open Server A database design that allows dataservers from multiple vendors to operate together RDBS Relational Database System A database designed to adhere to relational princ
129. nt enhancements and some of the language extensions that I have added to the interpreter a few of which are connected with the work of the X3 J18 standardisation committee I hope to show some of the ways in which REXX imc can interface with its environment this will include the use of Unix specific built in functions the writing of external function libraries and the application interface with programs such as THE an editor based on KEDIT written by Mark Hessling If time allows I will take a brief look at the internals of the interpreter showing the basic blocks of which it is built and giving a short explanation of how it performs a task such as evaluating a Rexx expression Unfortunately since my real job is to write a D Phil thesis I have not been able to enhance REXX imc as much as I would have liked for this presentation How ever work is still in progress to turn REXX imc into an efficient and fully integrated programming language on Unix REXX imc Because REXX imc is a spare time project work on it has been characterised by bursts of activity and long pe riods of slow development Even though the interpreter was functional in 1991 it was not released until Au gust 1992 In fact it is interesting to note that REXX imc was already capable of running a program to calculate v to many decimal places by October 1989 although it had no functions The period between the 1992 Symposium and the initial release of
130. ntents of the loop the variable foo is set 1000 times and its value is retrived 1000 times I e navigating the variable structure 2000 times Then we add functionality for caching the result of each navigation Neither retrieving nor changing the value of a variable are operations which change the identity of the box in the variable 28 Entry point for variable structure main prog hashtable for 1st sub 1st sub di Yun endsub Boxes V belonging to same 3rd sub bin Hashtable for the A compound var 7 i i EN A42 A bed A Bar Figure 4 The structure of variables in Regina structure where the variable is stored Thus if we can cache a pointer to the variable the number of walks through the hash table structure drops from 2000 to 2 On the other hand the cost of this is caching the pointer after each navigating walk unless it was already cached And the cost of verifying that the shortcut pointer is still valid In particular the latter of these introduces a number of subtle points Consider the following code first example call foo exit foo do i 1 to 2 say i if i 1 then do procedure i i end end In this example which is only allowed for TRL1 not TRL2 the variable i in the SAY clause refers to different variables during the first and the second iterations of the loop This is due to the execution of the PROCEDURE clause du
131. nterface CICS Transaction Processing TSO Scheduler Access Limited TSO User Access Original Batch Design JCL COBOL II Final Application REXX JCL COBOL II New York City Transit Authority Change Control Managment System Data stored in VSAM file and ISPF tables Entirely TSO Based user access Original Batch Design ISPF Skels JCL COBOL Final Application REXX ISPF Skels JCL COBOL hms 04 25 94 jcl2rex doc A638 253 o Soo Le Ihe Great Wall of MVS Batch 7100 Char PARM ES Return TL d Code Program B c EE l JCL Allocations Input Output Symbolics Computations E toge ai Limitations of MVS JCL e Rigid isolation between JCL level allocation SPOOL datasets symbolics and return codes and program level I O computation and logic e No interaction between application data and application control e Limit of 100 characters in PARM e Minimal logical operators even with new MVS features e Heavy manual intervention requirements in most cases e Single level PROC invocation until recently hms 04 25 94 jcl2rex doc A638 254 Advantages and Benefits of REXX TSO Over JCL Automation Simplification Readability Write ability and Maintainability Modularity Environment dependant code can be isolated Portability and Reusability is feasible between Foreground TSO Batch VM
132. o been converted to REXX TSO PROC kwd val ARG kwd kwd if kwd then kwd val or ARG kwdl kwd2 kwd3 I EXEC CONDz O NE IF RC 0 THEN after commands IF RESULT 0 THEN after REXX CALL Save RC RESULT for complex or deferred tests hms 04 25 94 jcl2rext doc A638 DD Dataset Parameter Equivalents ICL ws REXX TSO Allocate Parameters DSNAME q1 q2 q3 DSNAME q1 q2 q3 DSN q1 q2 q3 DISP OLD KEEP DELETE OLD DELETE no wait see SOM VSE93039 IF RC 0 THEN FREE DDNAME KEEP DCB model dsn BLKSIZE bbb LIKE model dsn BLKSIZE bbb LRECLZII RECFM zabc LRECL lII RECFM a b c VOL SER vvvvvv volcount VOLUME vvvvvv MAXVOL volcount 4 LABEL n ll EXPDTzyyddd POSITION n LABEL 1 EXPTD yyddd ddd 0 not valid IBM future direction UNITz uuuu n UNIT uuuu UCOUNTY n SPACE CYL pp ss dd RLSE CYL SPACE pp ss DIR dd RELEASE SPACE 800 pp ss ROUND BLOCK 800 SPACE pp ss ROUND hms 04 25 94 jcl2rex 1 doc AGIS 258 JCL Label on DD Concatenated DD Repeated DD across steps DD or DD DATA SYSOUT c SYSOUT DEST rmt HOLD YES NO COPIES n FORMS ltrh OUTPUT opnam DUMMY JOBLIB STEPLIB ISPLLIB OUTPUT SUBSYS hms 04 25 94 jcl2rex 1 doc Other DD Equivalents REXX TSO Allocate Parameters DDNAME DSN q1 q2 q3 q4 q5 q6 REUSE required in absense of FREE ALLOC DD dddd UNIT VIO TRACK SPACE I 1 RECFM F B LRECL
133. ode from unsuccesful NUCXLOAD USERFN 903300098 ARGI R1 X FF Any arguments 087106068 gt Return code passed back from USERFN after 00340000 GOLOAD Br if not go instal 867299008 invocation with original PLIST 88358098 ARGI 8 R1 CL8 L0AD Is this explicit load 807 30060 s 4 to indicate bad PLIST 00360808 BADPL Br if not go complain 60740008 60376008 R2 RI Keep invocation PLIST 68756600 Exit 66386606 ki 68760000 Return to caller 86390008 NUCXLOAD USERFN as RXUSERFN 66779666 60400086 00709000 Operation 00410080 GOLOAD EQU 00799000 When invoked without argument NUCXLOAD USERFN as RXUSERFN 06426080 LA R1 MUCKLOAD Address NUCXLOAD Plist 66800008 a and pass back the return code obtained from NUCXLOAD 60430900 SVC 8 86810608 When invoked with LOAD es the first argument then NUCXLOAD 86440008 Dc AL4 I Return even if error 60620008 USERFN as RXUSERFN invoke RXUSERFN with the same PLIST as 88458686 LTR ALS RIS Did toad work 66830866 obtained on entry pass back the return code given back by 08460009 BNZR RIG Wo pass back rc 96846008 USERFN 98478660 s 66856966 Otherwise display message and return with return code 4 60480060 If explicit load requested pass through invocation PLIST 86860006 88490008 x 608706008 Maclibs 86588608 UR RY RZ explicit load 80088068006 CMSLIB or OMSGCPI 86516008 BIR RIG No return 66896008 605206808 svc 202 Invoke nucleus extension 80900060 Macros and
134. of a light interpretive language makes debugging easier for non professional users Though interpretive languages execute more slowly than compiled languages they are often easier for the novice to debug since there is no 114 Fri April 29 1994 Using REXX in a Unix Environment to Manage Network compilation wait involved Also unless the compiled language has a sophisticated debugger the source line is not displayed in association with a run time error In addition REXX has a built in trace feature which is easily used The use of a light language that didn t need extensive variable declarations etc was also an advantage While such languages become increasingly difficult to maintain as a single program grows larger and more structure is needed because of the anticipated size of the scripts 500 lines or less that was not a concern 1 4 External Access The first change we made to REXX was to give it the capability to connect with the EM s This was more complicated than simply opening a new file descriptor to a new tty port Connection to EM s for filtering and emulation are managed as resources by COMMAND Post A connection to a EM s system console might be used for a period of time by an operator via an emulation and later reassigned by the system for use by auto operation via a REXX program Connections were made from a program to a physical port using the UNIX socket stream facility The actual physical ports might
135. ommand language command These include user guides books on line references summary references electronic information servers electronic mailing lists user groups and colleagues 7 Do need third party extensions Third party extensions should be used in the following situations When portability is not a concern When the third party extension performs an operation not found in the command language such as network and database operations When you can afford the run time license costs for distributing the extension When the extension greatly enhances the look and feel of the application Such as any of the Visual REXXes Conclusions hope that this will be of use to you the next time that you are considering developing a command language application encourage others to look into this area Getting in touch with me Hallett German GTE Laboratories Inc 40 Sylvan Road Waltham Ma 02254 617 466 2290 hhg1 gte com T References German Hallett Command Language Cookbook VNR 1992 The approach is covered in detail Looks at many different type of REXX implementations German Hallett OS 2 2 1 REXX Handbook VNR 1994 A Rexx tutorial and the approach with some enhancements Table 1 Command Language Components by Application Type Front end Operating System Commands External Interfaces Input Output File operations amp Command Line operations Built In Fun
136. oo is a variable reference to access if exists a shortcut pointer for var then if points to a variable not deleted then if the generation number is correct then retrieve set the value return else decrement counter remove shortcut pointer else decrement counter remove shortcut pointer if counter 0 then delete deallocate variable box access variable the hard way cache the found boz in the shortcut pointer in the parse tree increment counter return Figure 5 Retrieving setting value of variable reference in the parse tree The second algorithm is used to delete variables during the execution of the RETURN clause from a routine which had its own private PROCEDURE clause It will always detach the variable boxes but it will only deallocate the space if there are no shortcut pointers pointing to the box as recorded by the counter in the box 3i for each local variable disconnect it from variable system if counter is greater than 0 then mark variable box as deleted else ES deallocate variable box Figure 6 Deleting local variables at return from routine 9 Why So Complicated Most computer languages keep track of their variables in much easier ways so why introduce this complexity for REXX Because of the enormous degree of freedom in REXX REXX does not have compile time routines it has only run time routine entry and exit points Therefore it is virtually impossible to bind a given clause to a particular routine at par
137. or if rc AON noError then do say Send failed on check rc rc return 1 end Search for a the expected pattern if pos pattern string 0 then do return 0 end end say did not find pattern return 1 124 REXX at Simware Luc Lafrance Simware 125 REXX at Simware by Luc Lafrance Software Developer LTI Multiple Scripting Uses 2 products A2B REXXWARE 3 platforms Windows Macintosh NetWare presentation automation reports 8c A2B BIFs e terminal emulation type press waitfor checkfor whenever e views presentation openview closeview addelement additem getelement getitem setelement selectelement readelement writeelement 621 REXXWARE BIFs 140 calls into the CLIB interface GetObjectID GetVolumeInformation LoginObject NWQAttachServer RCCs and client job scheduler utility functions currentpath listfile readscreen History of Development e 18 months to develop a 4 0 kernel e grammar defined with LEX YACC e written in C Microsoft C MPW C WATCOM C 386 Multiple Personalities ported to the Macintosh in days ported to NetWare in weeks abstraction of OS interfaces to file system and memory CEL Adapting REXX to an O S Windows and Macintosh hard issues to ADDRESS NetWare a console and a prompt multi threading the infernal data queue eel The Way to an Easy Port e SIMWARE h typedef signed short SHORT typedef
138. otix zi A Core Technology a Notrix Composer Ci A Notrix Application a Percussion Software Inc a aa a 143 144 Fields amp Formas J Searching Gu Full text li ear a Macros e Importing exporting a Conflicts 145 Typical Notes Applicatio a Discussion databases a Reference databases 2 Workflow applic penal a tO RIES Lotus Notes patabase Architecture 2 Document Architecture 3 Document Note Types un Help ACL etc 146 Mail a Workstation or Server dts server Components 147 Network a SPX a Vines a NetBios a TCP IP a Local Lotus Notes Security Ld esee 148 2 Domains LEO NEU a Bad things Relational Capabilities lelds No relational link Macro Language API Complexity 149 Product Issues Front End a Data pet Product Issues API 3 ict Programmin J 2 Contains over r 200 call ure Planning Certificate types i Anecdotal Informattot storing Reference ane E 151 Vise e Customer demands for data a Complexity of the API a Triggers amp Event Notification 152 Notrix Interface Variabl 34note stem Server database notelD a field stem name value type flags 153 3 NotesFieldList 154 Notrix Inte
139. ow and is ready to receive the next Values for the new row are written over and into the same variables used by the last row If all rows are exhausted the sqlCode variable returns an error value non zero If there is no need for additional pending row a special cancel command can be used to drop them A typical code fragment to print the item alertId from the ActiveAlert table might be address NCDB select alertId from activeAlerts if sqlCode 0 then do forever address NCDB fetch if sqlCode lt gt 0 then leave else say alertId end end One limitation created by this architecture is that all values returned by a select statement must have some associated name for creation of the variable This means that an SOL statement that used some function like SUM to create a value that would not have a name associated with it must be 118 Fri April 29 1994 Using REXX in a Unix Environment to Manage Network written in such a way that it is forced into a variable name For example select total sum occurrences from activeAlerts instead of select sum occurrences from activeAlerts To make common operations like creating an alert which would normally require multiple table inserts easier a number of stored procedure are included in the database This means that typically only a single address clause is needed for even a fairly complex database operation 1 7 Other Uses of REXX in the Product One of t
140. poration 1993 1994 e Trademarks The following terms used in this paper are trademarks or service marks of IBM Corporation in the United States or other countries CICS ESA IBM MVS ESA OfficeVision OS 2 May 4 1994 C Copyright IBM Corporation 1993 1994 234 What is REXX for CICS ESA REXX CICS e Two products e REXX language support for CICS ESA Native CICS application environment Run time facility e And More May 4 1994 C Copyright IBM Corporation 1993 1994 235 Background REXX CICS What were design goals for REXX CICS e Focus on Productivity e Common REXX across CICS platforms e Production REXX suitable for use in a production environment e Distributed REXX Client Server enabled e CICS REXX REXX language under CICS with CICS interfaces Integration Platform REXX is natural application integration platform May 4 1994 C Copyright IBM Corporation 1993 1994 236 Project history REXX CICS e REXX prototype to IBM PP a From Assembler amp REXX to PL X amp REXX for portability e FROM TSO E REXX base to direct use of REXX kernel F May 4 1994 C Copyright IBM Corporation 1993 1994 237 Background REXX CICS e Growing popularity of REXX e Growing emphasis on productivity e Additional REXX implementations e Product requirements e Need for Application Integration platform e Need for Common Production REXX e Need for high level Client S
141. pre WAIT 0 key num post if pre amp key WAIT amp post then do found wait num x end May 1994 Mike Cowlishaw 0S Parsing field oriented data Set up template matching structure x perhaps read from a file template socsecnum 9 name 40 40 last 20 first 20 balance 4 record charin myfile 80 interpret parse var record template balance c2d balance 4 May 1994 Mike Cowlishaw Using PARSE for POS SUBSTR Change all old to new in string If old is null new is prefixed Change procedure parse arg string old new if old then return newllstring out do while pos old string 0 parse var string prefix old string out out prefix new end return out string i May 1994 Mike Cowlishaw PROCEDURE EXPOSE lists Lists can be very useful with PROCEDURE EXPOSE errors sigl rc CleanupFlag shared masterlist CurName CurCount subfunction procedure expose errors shared return May 1994 Mike Cowlishaw TRACE Don t forget trace Labels lets you check the flow in a program and trace Intermediates lets you check expression evaluation in detail Note The TRACE instruction is completly ignored during interactive tracing but the TRACE built in function is not May 1994 Mike Cowlishaw Function names in quotes System dependent function names can be useful say e tools
142. procedure expose everything except the following and its use is not strongly reccommended at present The OPTIONS SETRC instruction makes all I O includ ing SAY and PARSE PULL set the variable RC to indicate the success or otherwise of the operation in order to allow this to be checked without calling STREAM It also causes a SIGNAL ON ERROR if that is appropriate This option was added in order to preserve backward compatibility with a previous version of REXX ime which had neither STREAM nor SIGNAL ON NOTREADY The extra tracing extension prints out a traceback in cluding the SIGNAL ON instruction and the cause of the error whenever the target label for the trap is not found For example the program signal on novalue call test exit test say xyz produces this traceback No value error on XYZ 1 signal on novalue 4 say xyz 2 call test Error 16 running test exec line 1 Label not found Notes REXX ime e REXX imc offers a variety of file access functions via the function call STREAM stream C command The open command allows any file to be attached to a stream in either read or read write mode The popen command starts a Unix command and attaches it to the named stream for reading or writing The fdopen command allows Rexx to access any Unix file number as a stream The file number of any Rexx stream is given by the fileno command The ftell command gives the file pointer which was set by the
143. re assumed shareable and not necessarily desired with REX X Sample REXX Script Load and initialize Multimedia REXX support lt call RXFUNCADD mciRxInit MCIAPI mciRxInit call mciRxInit rc if do Open default digital audio device exclusive use mciRxSendString open waveaudio alias wave wait RetStr 0 0 Check error call function to return error string rc lt gt 0 then 248 MacRC mciRxGetErrorString rc ErrStVar say rc rc ErrStVar ErrStVar en Load a digital audio file rc mciRxSendString load wave sample wav wait RetStr 0O 0 Obtain ID for device context that was just opened DevID mciRxGetDeviceID wave say DevID DevID Set the time format to milliseconds call mciRxSendString set wave time format ms RetStr 0 0O Determine whether the microphone connection enable call mciRxSendString connector wave query type microphone wait RetStr 0 O say connector query microphone RetStr RetStr Query length of the opened file value in ms call mciRxSendString status wave length wait RetStr 0 0O Say status wave length RetStr RetStr Play the multimedia file wait for completion call mciRxSendString play wave wait RetStr O O Rewind to the beginning of the file call mciRxSendString seek wave to start wait RetStr O O Close the device context call m
144. reamline development sequences e Help enable enterprise wide Client Server computing e Better enable CICS end user computing e CICS Application Integration May 4 1994 C Copyright IBM Corporation 1993 1994 LAL Basic Environment REXX CICS REXX CICS Basic Environment Support e Invoking REXX execs e Where execs run May 4 1994 C Copyright IBM Corporation 1993 1994 ia REXX File System RFS REXX CICS REXX File System RFS Features oer Directory structure like OS 2 AIX VSAM RRDS based No need to register most new users No need to register individual EXECs 4 Import Export to MVS Partitioned Datasets Management functions for members COPY DELETE RENAME FLST file directory interface utility An EXECIO like 1 O utility RFS Maximum records per member is approx 2 32 minus 2 Maximum VSAM datasets in a RFS filepool is 511 Number of filepools is only limited by DASD May 4 1994 C Copyright IBM Corporation 1993 1994 242 Summary REXX CICS REXX CICS Summary e REXX CICS is more than just support for another language e REXX CICS introduces significant new capability e REXX CICS provides new approaches to CICS computing e REXX is a good integration platform e REXX is useful for serious programming e REXX is a natural for Client Server computing e REXX is in step with current trends e REXX CICS Greater Productivity May 4 1994 C Copyright IBM Corporation 1993 1994 10
145. ring the loop which changes the scope of the i variable Thus the shortcut pointers cached during the first iteration must be tested during the second iteration and the fact that they are invalid must be detected This is achieved using a generation number which is identical to the number of currently nested functions having executed the PROCEDURE clause Whenever a new PROCEDURE clause is executed the generation number is incremented and whenever a RETURN clause is executed for a 29 routine which have during its course executed a PROCEDURE clause the generation number is decremented To verify the validity of a shortcut pointer the current generation number is recorded in the box pointed to by the pointer Whenever a recorded pointer is to be validated it is considered invalid if the current generation number is greater than the number recorded in the box pointed to by the shortcut pointer i e a PROCEDURE clause has been executed sirice this pointer was made invalidating the pointer In this case the recorded shortcut pointer is attempted deallocated and the variable is located using the standard procedure the new location is of course cached if the current generation number is greater than the recorded number The next example shows a function second example say bar 3 exit bar procedure parse arg i if i 1 then return 1 else return bar i 1 i Here the last clause in the routine is
146. rnal S DGA 155 Agenda Forms 2 Internals 156 Importing External Data Sources to Notes A 157 158 Notrix Composer User Interface a Complete ERO Notes SQL Notrix a Notrix har background vss 0003 S requests in 159 Notrix Oposers Features and Benefits icm p Current Development 160 Percussion Sotware and dE CHER A a Lotus Notes Development and Business Partner a Headquarters Boston Massachusetts Audrey Augun 617 267 6700 e 161 PRODUCT NAME Notrix Version 1 0 Notrix is a programming tool that lets you do complex manipulation of Lotus Notes data WITHOUT Lotus Notes API or C programming Lotus Notes database administrators or designers can quickly develop applications that easily manipulate Lotus Notes database documents and their fields Within Lotus Notes you can compose a REXX program document store it in a Notes database and schedule it to run automatically on the Lotus Notes server via the Lotus Notes Name and Address Book The program accesses Lotus documents by searching views and manipulates fields by reading writing documents in a Lotus Notes database Notrix runs on the Lotus Notes server and uses the Lotus Notes front end Notrix implements REXX IBM s powerful command processing language that possesses a rich set of built in functions REXX is supplied with OS 2 and its advantages inc
147. rson inheriting some Person methods this makes Grasuate a subclass of Person too through the intermediate class Student We sometimes use the terms direct and indirect superclasses or subclasses to distinguish these If you don t specify the SUBCLASS option your class becomes a subclass of the Object class When talking about a class s instance methods which ones do we mean just the ones it defines itself or those and the ones it inhcrits from its superclasses It s usually more convenient to take this as meaning the methods defined by the class itself and we will follow this convention from now on However it s important to remember that when the class creates instances the object methods of the instances include not only the instance methods of the class itself but also those of all the superclasses from which it inherits Abstract Classes and Object Classes Some classes have a close inheritance relationship like Graduate and Student Others are related in a slightly more distant way more like siblings than parents and children You can appreciate why the term inhcritance is used to describe the class family For example array and list objects share a number of methods FIRST LAST NEXT PREVIOUS SECTION and SUPPLIER Even so neither is a subclass of the other arrays have a DIMENSION method but lists don t and lists have a FIRSTITEM method but arrays don t So how can we express the common nature of
148. rt fields 1 5 Parameters The REXX interpreter was also augmented to accept command line arguments that could be passed in the the REXX programs as parameters The command line to the left of a remained the standard uni REXX command line The part to the right represented parameters passed to the REXX program Argument flags items starting with a became variable names in the program filled with the values that followed them The following command line ncrx customerName Fred would cause the REXX program to start execution with a variable called customerName initialized to the value of Fred This allowed the triggers to ass useful information to a REXX program Standard information passed included the number of alerts that caused the trigger to fire and the identification numbers of those alerts 1 6 Database Interface We aiso wanted the REXX auto operations programs to be able to access the COMMAND Post database so they could create query update and delete the alerts the system maintained COMMAND Post uses a relational database that is divided over two 117 Fri April 29 1994 Using REXX in a Unix Environment to Manage Network dataserver programs using the Sybase open server model The primary database is accessed through the standard Sybase dataserver Temporary high activity tables are assigned to the Event Handler server a memory resident server of our own design Access to either server is
149. ry excitement a ritus amp IBM REXX 6000 Use REXX 6000 to extend the Tritus SPF editor E Knozall amp IBM REXX for NetWare Use the REXX for NetWare scripting language module to extend and tailor the functionality of Knozall s NLMAuto a Professional and NLMerlin products pu Ci Trademarks IBM OS 2 AIX REXX 6000 IBM REXX for NetWare are registered trademarks of International Business Machines Corporation NetWare is a trademark of Novell Inc Tritus SPF is a trademark of Tritus Corporation NLMAuto Professional and NLMerlin are trademarks of Knozall Systems Inc Object REXX What s New Tom Brawn IBM tie GES Le UA yee es A 4 2 AE 1 bm NY tombrawn vnet 7 ICOtt Tom Brawn t REXX Development IBM End jec i Ob Internet i Background Work began in 1988 Prototyped since 1989 Complete rewrite of interpreter Language architecture in progress and subject to change Significant enhancements over the past 18 months Limited beta on OS 2 and Windows 4 94 ig 9r Why Object REXX Remove limitations of current REXX language Bring the power of OO programming to REXX Bring the usability of REXX to OO programming Extend REXX usage windowing What s New in Object REXX Objects Everything in Object REXX is an object Methods Everything that
150. s client Windows OS 2 Macintosh etc can be used ona LAN or dial up o Notrix Composer runs on OS 2 today future releases will add NT NLM and UNIX platforms for cross platform coverage o Notrix Composer includes a Notrix Composer Discussion Database for users who wish to exchange information with Percussion Software around topics such as feature wishlist items bug reporting and application examples built with Notrix Composer To receive updates to this database a user needs only to replicate with Percussion s Lotus Notes server o An Online Help Database is included with each copy of Notrix Composer to streamline the development process SOFTWARE REQUIREMENTS AND PACKAGING Software Requirements Notrix Composer requires OS 2 Version 2 1 or later OS 2 REXX Lotus Notes Version 3 0 or later Notrix Composer is supplied on 1 3 5 inch PC formatted diskette containing the EDA job definition database NXEDA NSF DLLs and the Notrix EDA Link interface library PRICING AND AVAILABILITY Notrix Composer is priced at 5 000 and will be available in May 1994 Percussion Software headquartered in Boston Massachusetts develops software products to help customers access integrate and manipulate information they need in their day to day business operations Percussion is both a Lotus Notes Business Partner and a member of the Lotus Professional 165 Developer s Program Percussion offers programs for
151. s document any references made to an IBM licensed program are not intended to state or imply that only IBM s licensed program may be used any functionally equivalent program may be used instead Any performance data contained in this document was determined in a controlled environment and therefore the results which may be obtained in other operating environments may vary significantly Users of this document should verify the applicable data for their specific environment Itis possible that this material may contain references to or information about IBM products machines and programs programming or services that are not announced in your country Such references or information must not be construed to mean that IBM intends to announce such IBM products programming or services in your country Agenda News from the REXX Compiler a Packaging an application General considerations DLINK Function packages Compiler IBM Compiler and Library for SAA REXX 370 Release 2 9695 013 9695 014 Available for CMS and MVS Library is part of REXX VSE Introduction of Copyright Alternate Library Copyright This program welcomes you www COPYRIGHT This program copyrighted for P N3 COPYRIGHT MY Company Vienna Austria 00000001 EXECPROCEAGRTPRC Compiled REXX 2 0 15 Mar 1994 1000000021 3 46 29 CMS REXXC370 3 48 28 May 1993 PTF UN51503 00000003 1 amp Sj 7 AE amp j 74 amp p A0 amp
152. screen Length is the 116 Fri April 29 1994 Using REXX in a Unix Environment to Manage Network length of that data string And pos is the position involved when data is written or read The API views the screen as an array of characters row one followed by row two etc and the position is a value pointing to that array Using the API model to connect with the target system has a number of advantages First as noted above it removes the need for an interrupt type interface when only simple communications are involved When only a single thread of communication is involved it is relatively easy to create a loop in REXX to read the screen write to it read the screen again identify what has changed and then act on the new data Another advantage is the interface allows some measure of emulation independence That is a REXX script can be designed that will operate with either a EM running a VT 320 interface or a IBM3151 Then the only change needed between the two would be in the definition of the pathway during the configuration step external to REXX The user would define the path as using a VT 100 API interface instead of an IBM3151 Despite the interface there are some restrictions on how transparently a REXX program can be written Some terminals support the use of fields A REXX program that made use of the API field related functions to interact with a Tandem 6539 would not work with a VT 100 because it does not suppo
153. se time The possibilities of SIGNAL ON and INTERPRET ensure that control can pass from virtually any clause to virtually any label in a REXX program Thus the techniques used for most compilers and some interpreters which allow them to bind the variable references in the source code to specific locations at compile or parse time do not work for REXX and more elaborate systems like the one described above are called for 32 REXX imc A REXX Interpreter for UNIX Ian Collier Oxford University 33 Work in progress REXX i A Rexx interpreter for Unix Ian Collier available from rexx uwaterloo ca in pub freerexx imc REXX imc Rexx Symposium 1994 History May 1989 Work begins Jan 1991 Interpreter has most language constructs except the stack but no I O functions May 1992 REXX imc is not ready in time for the Symposium Aug 1992 REXX imc release 1 2 released Sep 1992 Release 1 3 May 1993 Release 1 4 announced at the Symposium Jun 1993 Release 1 5 the first level 4 00 release of REXX imc Sep 1993 Release 1 5a with some bug fixes May 1994 Release 1 6 is presented at the Boston Symposium 1994 REXX imc Rexx Symposium 1994 Abstract Since 1989 I have been working on a Rexx interpreter for Unix in my spare time what little I get It was first released to the public in August 1992 and has had many improvements since then In my presentation I will demonstrate the most rece
154. se types are the following Front end Also called housekeeping applications In this case the command language sets up the proper environment for an application to execute This could be allocating files creating files or creating environment variables They also can receive output from or send input to the application view the startup or login programs as a special example of a front end application System and Utility This is like front end command language application However the emphasis is on doing system tasks such as backing up files and utility operations Such as being a function sub procedure that performs a date operation Self contained The other two types are blue collar applications The white collar application type is the self contained application It provides a dialog with the user usually full screen while maintaining strict control over the process 3 The Command Language Component The last and most important piece of the puzzle is the command language component All command languages that have examined to date have the following components Input Output File operations Stack operations Output to the screen Input from the keyboard Flow Control Conditional Loop Exception handling Exit and return codes Array operations 76 General Features Debugging Symbolic Substitution Labels Global Options Numeric format Interpreter Version Interfaces In
155. ses which were specially designed to mix in with each other However these classes were not designed to mix more gencrally with other classes You can try mixing them with other classes REXX won t stop you but it s unlikely that anything useful will result For more general mix in classes we ll have to look elsewhere in the hierarchy Mixins A class that is designed to be mixed in with other classes in a general fashion is called a mixin For example the Manyltem mixin can be inherited by any setlike class to allow multiple items to have the same index and is used by thc Bag and Relation classes It s important to understand the difference between mixins and abstract classes Both can be used with multiple inheritance but their purposes are very different Abstract classes are for the convenience of a class hierarchy implementer to prevent the same methods being duplicated among more than one object class They are of little use in themselves but enable the construction of object classes below them in the hierarchy Thcy are not part of the public interface of the class hierarchy for inheritance A mixin in the other hand allows some class and all the classes below it in the hierarchy to be enhanced in some way For example if Persistent is a mixin to the Object class all classes Copyright IBM Corporation 1994 The Object REXX Class Hierarchy in the hierarchy may exist in persistent and non persistent versions The per
156. sistent versions inherit the Persistent mixin but the non persistent versions don t For example to make a persistent directory class you would write class PersistentDirectory subclass Directory inherit Persistent which tells REXX that the PersistentDirectory class inherits from the Persistent mixin as well as the Directory class Any number of mixins may be inherited and a combination of inherited mixins and other inherited classes may be specified Since Persistent is a mixin to the Object class it applics to all subclasses of the Object class that is all classes Some mixins are more specialized for example the ManylItem mixin is a subclass of the Setlike class and so only applies to classes that inherit from the Sctlike class No other class for example a subclass of the Stream class is allowed to inherit the Manyltem mixin This is because the ManyItem mixin has been designed specifically to enhance the Setlike class it s tailor made to fit this class only and won t fit any other class The Setlike class is called the base class of the Manyltem mixin and we say that Manyltem is a mixin to the Setlike class So mixins like object classes but unlike abstract classes are intended for users of the class hierarchy and are part of its public interface for inheritance They provide enhancing options for the object classes in the hierarchy to be included or excluded at the user s discretion Some mixins provide a co
157. ss also has an OF class method but OF messages can t be sent to the Sequenced class to create sequenced objects because the Sequenced class is abstract and so can t create objects Instead OF becomes an object mcthod of any object classes that inherit from the Sequenced class such as the List class The List class doesn t have to do anything except inherit from the Sequenced class to make this happen Copyright IBM Corporation 1994 The Object REXX Class Hierarchy 215 So what object methods do abstract classes have They all have the same ones DEFINE DELETE ID INHERIT INITA METHOD METIIODS SUBCLASS SUBCLASSES SUPERCLASSES and UNINHERIT Of course like all objects their object methods include the instance methods of the Object class COPY STRING etc Object classes have two additional object methods NEW and ENHANCED the methods that create objects Class methods are inherited in exactly the same way as instance methods For example the List class inherits the OF class method from the Sequenced class just as it inherits the FIRST LAST MAKEARRAY NEXT PREVIOUS SECTION and SUPPLIER instance methods The Class Hierarchy We ve mentioned a number of REXX classes and the inheritance relationships between them Let s take a look at the complete hierarchy for the classes provided and used by REXX Object Closs Alarm Object Class Message Collection Mixin 7 Method Condition Queuelike Object
158. ss hierarchy was developed in a meeting of the REXX Architecture Review Board with contributions from Jim Babka Mike Cowlishaw Brian Marks Rick McGuire and the other board members The details took shape over several design iterations with vital contributions and encouragement to continue from Jim Babka Brian Marks and Dave Renshaw O Copyright IBM Corporation 1994 The Object REXX Class Hierarchy 222 Portable REXX Applications and Reusable Design Edmond Pruul Portable Rexx Applications and Reusable Design Edmond A Pruul RD 1 Box 632 Afton NY 13730 USA Electronic Mail p00146 psilink com Voice Mail 1 607 693 1030 ABSTRACT The application owner and developer want to port their applications to new operating system environments The Rexx language offers inherent advantages readability an active Standards organization available source code good input parsing functions easy source level debugging but no practical breakthrus have been identified in the Rexx community The same problems that plague application portability in general apply to Rexx programs also unwieldy code for several operating system environments ownership conundrums interface confoundment and many other problems old and new Using Rexx as an example of a language whose applications should port easily reveals the intractability of the portability problem Reusable Code is problematic in startlingly similar ways Reusable Design is a promisin
159. ssigns the alert a priority and an classification based on the OSI standard for network management COMMAND Post records the actions of supervisors and operators and tracks how the alert is handled and resolved COMMAND Post operators use terminal emulations windows to access the EMs from their workstations This allows operators to work on problems that might involve a dozen EM s without leaving their seat Figure 2 110 ALFE Rute Help Rute Help Token Help Token Help RuleQ1 T amtRAM Rule01 Thru ORestore amtSwap es AA j endid errcode j extractionName j filename j filter hostid j hours j noise nrFiles nrPaths nrProcesses nvClass nvType optionaiToken path pathname pct pctfull Open Save Select Retrieve Help j Trap none Filter fhome u NetC Having selected an alert you probably want to characterize its parts Do this by selecting words of the alert adding token and rule names and selecting Alert analysis pane options Copy Delete Modif Help i mmnd AlfeBFiltert fitr ToolType AlfeBTypel Delim s0 Separ Arf Engine yes Escape Characters As space r return n newline M tab i Generate ee An ALFE Screen Figure 1 Modem Monitor Serial Comm T 1 Monitor inae Application Ter
160. ster Hants S021 2JN England nash vnet ibm com Matthew Plager CTPS 10 Park Plaza Suite 2150 Boston MA 02116 617 973 7075 Fax 617 973 8855 Joe Player IBM 12200 Dancrest Dr Clarksberg MD 20871 301 564 2022 Fax 301 564 2580 Edmond Pruul R D 1 Box 632 Afton NY 13730 267 Peter Ricciardiello Carrier Corporation Building TRS Carrie Parkway Syracuse NY 13221 315 433 4014 Sara Rogers Mansfield Software Group P O Box 532 Storrs CT 06268 203 429 8402 Fax 203 487 1185 Roger Root 2963 Tillinghest Trail Raleigh North Carolina 27653 919 846 7101 70353 2753 compuserve com Pat Ryall 1124 Amur Creek Ct San Jose CA 95120 408 974 7354 ryall aol com Jonathan Schulman John Hancock Mutual Life John Hancock Place P O Box 111 Boston MA 02117 usjhcpu6 IBMMAIL com 617 572 8410 David Shriver IBM 40 D1 02 1 East Kirkwood Blvd Roanoke TX 76299 0015 Timothy Sipples IBM Corp One IBM Plaza 07 SS4 Chicago Ill 60611 312 245 4003 usibS8cS ibmmail com Hobart Spitz MTA New York City Transit 130 Livingston St Rm 5041 A Brooklyn NY 11201 5520808 mcimail com Stan Stocker IBM Canada 1150 Eglinton Ave East Toronto Ont M3C 1H7 416 448 4197 Fax 416 448 4414 stocker torolab2 vnet ibm com David Sutter IBM Corp 4912 Green Rd Raleigh North Carolina 27604 919 301 2196 Fax 916 301 2052 Peter Szabaga 1 Madison Ave Area 6 F New York NY 10010 212 578 2691 Fa
161. t used for stems Adventures in OO Programming with ROX Copyright IBM Com 1994 180 e RoxLoad cmd Calls the builtin ROX functions to load a ROX format file e Hoxlnfo cmd Prints class information for a given ROX file e RoxProf cmd Collects and analyzes output generated from RoxStats function to generate timing information Adventures in OO Programming with ROX Copyright IBM Corp 1994 181 list rox wordlist rox set rox collect rox various collection classes collect rox is an abstract class sessions rox illustrates multiple inheritance spinner rox sample threaded class that displays an in process spinner for activity cmdline rox implements a function to read a line from input with history editing etc socket rox usability enhancements for the rxSock function package SSS i Adventures in OO Programming with ROX Copyright IBM Corp 1994 182 e Performance 0 05 second overhead for message sends on 25 50 Mz 486 machine That s pretty good but still only 20 messages second e File i o Each invocation of a method opens a new file handle for a named file Unpredictable because of buffering Example file a file opened twice smethod foo rc lineout a file x 1 foo something foo something A Hoo Adventures in OO Programming with ROX Copyright IBM Corp 1994 183 Uses REXX external function interface for message sends Intern
162. t of class dog passing an additional parameter on the RoxCreate function which is the name of the dog The init method of the dog class will be invoked passing the name as the first parameter Next the bark method of the dog class is invoked in both function invocation formats available in REXX Both invocations do the same thing jackson RoxCreate dog Jackson call bark jackson g bark jackson As noted before during object creation the init message is sent to the object In order to allow an object s inherited classes to initialize themselves the init and deinit methods may be invoked as functions whose names are a class name and the method name concatenated together with a in between them For example assuming the dog class inherits from the animal class the dog init method can call the animal init method by invoking the function animal init 1 5 Variables Classes specify both the methods that can be used on an object and the state variables associated with the object The variables are plain old REXX vari ables whose values are available to methods of the classes The variables are non stem variables such as name size etc Stem variables are handled via per instance variables see below Any number of variables may be associated with a class and thus an object Per instance variables are variables that can be added to an object in an ad hoc manner For instance one object of class X might have obj
163. tCount or underlying alerts are available the value 19999 will be sent to the pager Note Triggering Alerts must be forwarded to the database so that the Severity can be obtained 1 e e e dede hee de ede jede dece e de e Ae de de e e e de Ae e Fe e e e e He He He e e e e e He Ve e Ae Fe de e de de e Ke de eeke ke y Get the OSI severity from the database if alertCount lt gt ALERTCOUNT then do cnt 1 alertid underlyingAlerts cnt address NCDB select OSISeverity from alerts where alertid alertId if sqlCode lt gt 0 then do say Could not get Severity from database exit end address NCDB fetch message OSISeverity end else 122 Fri April 29 1994 Using REXX in a Unix Environment to Manage Network message 9999 Connect to the modem nl Qa X path ao targetConnect pagerModem if rc AON noError then do say failed to make connection to pager exit end Get the dimensions of the emulation screen and calculate the Presentation Space size string A r ao targetComm path 22 string 1 0 colums delstr delstr string 16 0 13 rows delstr delstr string 14 0 11 PSsize columns rows Start the conversation with the modem if modemSend path ATV nl OK 1 then exit Dial the service if modemSend path ATDT9 18007597243a nl CONNECT 1 then exit Send the PIN if modemSend path ATDTU PIN Z nl OK
164. te class a subclass of the Student class This gives the Graduate class all the instance methods of the Student class and the Graduate class can then add or override any necessary instance methods If Graduate is a subclass of Student we call Student a superclass of Graduate The subclass superclass relationship is also called inheritance so we say that Graduate inherits the NAME method from Student The inheritance relationship can be used to arrange the classes into a class hierarchy a diagram in which superclasses are drawn above subclasses with lines connecting them The class at the top of this hierarchy is the Object class Its instance methods COPY STRING etc are inherited directly or indirectly by all other classes and so become object methods of all objects Most objects have additional object mcthods for example the Supplier class is a subclass of the Object class and has instance methods AVAILABLE INDEX ITEM and NEXT so all supplier objects have these object methods as well as COPY STRING etc O Copyright IBM Corporation 1994 The Object REXX Class Hierarchy 213 You can create a subclass by specifying the name of the superclass on the SUBCLASS option of the CLASS directive which is equivalent to sending a SUBCLASS message to a class object For example to make Graduate a subclass of Student you would write class Graduate subclass Student _ If Student were itself a subclass of Pe
165. tend to cause persistent changes to the en vironment rexx s queue cd tmp cd tmp AA pwa tmp Notes REXX imc Release 1 6 of REXX imc is the first to have an API The functions have been modelled on those of OS 2 It should be possible to compile a Rexx aware application such as Mark Hessling s editor THE with REXX imc without altering it as long as it uses only the functions which are currently supported In order to use the API an application includes the C header file rexxsaa h supplied with REXX imc which will declare the functions opposite and the associated constants and datatypes When the application is com piled it is linked with the library file which is created when REXX imc is compiled This file will be either librexx a in which case the code from REXX imc will be included in the application s object file static link age or librexx so 1 6 in which case only a reference to the library file will be included in the application s object file dynamic linkage If linkage is dynamic it will be possible to upgrade to a later release of REXX imc without recompiling the application just by copying the new library into the same directory as the old one REXX imc External Functions External functions or libraries for REXX imc can be written e in Rexx e using the SAA API e using REXX imc hooks e as a Unix program REXX imc Rexx Symposium 1994 Interpreting a program Re
166. ternal functions interface to operating system and external en vironments Built in Functions and System variables What the approach does is combine all three of the above elements First determine your type of application once you know that you know the command language components that are usually used by that application type Finally look up the commands corresponding to that command language component And not a single piece of code has been yet been written The approach is application centric because it encourages you to know your application requirements and data as much as possible before starting to code The approach The following are the steps of the approach 1 What type of application do have The three types were discussed above Which command language should use This is discussed in the presentation This includes a look at the following Type of data File type benchmarks Ease of use vs power features Which command language components Should use The components were listed above Which command h components This is the crucial step Table 1 lists a summary of the components 5 Which command language components match these commands Space does not permit listing this step However tables with this information can be found in the references section 6 Where can find more about these commands There are many places you can learn about a c
167. that it may cache the number of tails used at earlier calls Figure 4 shows how Regina stores its variables There is one hash table for each subroutine having a PROCEDURE clause and within each such hash table there is another hash table for each stem in use 6 Shortcut Pointers from Parse Tree A well known technique for optimizing computer code is to cache any value for which you may have need later Regina makes use of this several places For instance whenever Regina executes a CALL clause or a function call for the first time it must determine which routine to call If the destination routine is an internal or built in function it is cached by setting to pointer in the parse tree to point to it 7 Shortcut Pointers to the Variable Structure Whenever a REXX clause refers to a variable name the value of that variable must be retrieved from the variable structure This involves some navigating which can be time consuming However it often turns out that multiple invocations of the same variable reference in a clause navigate through the variable structure only to end up at the same variable box Thus it may be advantageous to cache the result of the most recent navigation for each variable reference of the program This means storing a pointer in the parse tree pointing into the hash table of the variable structure Consider the following trivial code foo 1 do 1000 foo foo 1 end If we restrict the analysis to the co
168. thods such as POS and SUBSTR and directory objects provide methods for collections such as ITEMS and SUPPLIER You can look at the descriptions of the String and Directory classes to find out what methods are available on string and directory objects In REXX everything is an object so classes are objects too Class objects are used in a number of ways the most important of which is their role in creating other objects They support this by providing NEW and ENIIANCED methods which create objects of the kind defined by the class l or example the Directory class object returns a new directory object in response to the message directory new Classes and instances The objects created by a class are known as its instances They are given methods that match the specification defined by the class for its instances l or example a Rectangle class might define methods AREA and PERIMETER using the directives class Rectangle method area expose width height return width height method perimeter expose width height return width height 2 O Copyright IBM Corporation 1994 The Object REXX Class Hierarchy 212 Then when rectangle objects instances of the Rectangle class are created by sending NEW messages to the Rectangle class object they will have methods AREA and PERIMETER with the REXX code shown above Object and Instance Methods There s an important difference between the AREA and PERIMETER methods of a rectangle object
169. ting of a series of high level English like commands entered interactively e g a keyboard mouse or other input device or non interactively that is created with an editors saved in a file and executed in foreground or background An interpreter or compiler for the command language then determines which user specified operating system tasks to perform and processes them using corresponding task values Whew A real mouthful So what does it mean Command languages are almost always interpreted languages REXX is one of the exceptions to this Command languages are usually executed in foreground Again REXX is one of the exceptions Command languages are comprised of English like verbs describing the task to perform REXX is typical with instruc tion keywords like SAY and PULL Command language provides a mean to directly or indirectly access the operating system REXX shines in this area with the ADDRESS instruction and the environment model Command languages offer user and third party extensions For REXX this includes functions sub procedures and interfaces to external environments 2 Identifying the types of command language applications In their CLIST manual IBM talked about three types of command language applications My eight years of working with various command languages have verified that this typology is a good match for the type of applications found in the real world The
170. tring pointer to the return value Most of these parameters will be familiar to those of you who have written external functions for REXX in C The only new one is the object parameter It can be used in the following functions ULONG RoxVariableGet void object PRXSTRING name PRXSTRING value ULONG RoxVariableSet void object PRXSTRING name PRKSTRING value Ji The functions above are used to query and set variables for an object The functions return 0 when successful 0 when not successful The data pointed to by the value parameter returned from RoxVariableGet must not be modified A sample of a compiled class is provided in roxsem c A DLL can provide a self loading function named RoxD lEntryPoint with the following function signature ULONG APIENTRY RoxDllEntryPoint ULONG init Currently the init parameter is ignored This function gets called when the REXX function RoxLoadDLL is invoked This function takes the name of the DLL usually sans DLL although you may specify an absolute path including the DLL suffix and calls the Rox DilEntryPoint function 199 This function in the DLL can call any of the functions defined in the ROX function package through their C bindings The call is made as if the call was being made to a REXX external function For example to call RoxAddClass you invoke it in C as RXSTRING parm result parm strptr myClassName parm strlength strlen parm
171. ts Low exposure e Low cost e Process can be automated High benefit e Probability of success is high Required software is already in house in most shops bms 04 25 94 jcl rex doc A638 263 Batch Comparison ISPF Skeletons JCL PROC JCL PROC PGMs Utilities Edit Macros TSO Commands ISPF Services Utilities CLISTs Batch REXX Allows Integration of Software Allocation Utilities Application Supports Multiple Levels of Invocation and Common Modules Removes Most Requirements for Manual Intervention Overrides Control Cards etc Summary E Brings Batch into 90s Portably and Productively Provides Real Programming Constructs Enables Application Based Scheduling Recovery etc Keeps Pace with PCs and Minis Breaks Down Wall Between Control and Software Functions Opens Exciting New Possibilities for Batch Processing hms 04 25 94 jcl2rex1 doc A638 264 Araceli Adriano IBM 40 D1 02 1 East Kirkwood Blvd Roanoke TX 76299 0015 Steve Bacher Draper Laboratory MS 33 555 Technology Square Cambridge MA 02139 seb draper com Doug Benson Lotus 1000 Abernathy Road Suite 1700 Atlanta GA 30328 Eric M Bitterman Teachers Insurance TIAA 67 85 223rd Pl Bayside NY 11364 212 916 6157 Fax 212 867 9075 Tom Brawn IBM Corporation Dept G79 1701 North St Endicott NY 13760 607 752 5166 tombrawn vnet ibm com Alex Brodsky S SE 154 H
172. urce manager for a certain specific authority The word SFS is superfluous The word administrator implies a permanent attribution of a human being Worse this label implies the reusable component has some power to enforce or guarantee its response for some un stated period of time False the answer is advisory only The power of authorization remains with the resource manager s authorization mechanism REUSABLE DESIGN CAN WE HAVE SERENDIPITY AND MASS Reusable design could mean good external design Good syntax is a given simple targeted for performance 3 no surprises and no side effects Semantic clarity is the rub Cultural tunnel vision is problematic by definition The cure is an accessible and readable design Early disclosure and serious attention to criticism are good continuous disclosure is better Rexx Library functions are outstanding example of reusable components the required attributes are present one responsible person expert in the field serious helpful customers What can we do _ Study and understand today s and tomorrow s methodologies Temporal Logic Gries Axiomatic technique SMALLTALK Finite State Machines Data Flow Analysis and Event Analysis amongst many others Buy and read books Take all the design courses available retake them a few years later Practice off the job Volunteer for inspections The more design and code we study the wiser we are Join the local Reuse Advisory Board evaluate reuse
173. us Use save area for PLIST DNLIST LNLIST NLIST Move skeleton to work area RS FUNLIST RI DNLIST CHMSPROG VMSP5 2622 RIS FUNOFFS RS RIS R15 R18 gt to list gt PLIST Are we on CMS release 5 Br if yes use SVC 262 Any wore to cancel 8 all done Get out DNLNAME B FUNLNAME R5 Copy stertup nave R15 X 0000B000 204 ignore errors e g RS LENTRY R5 SV2842 RIS FUNOFFS R5 R1S Ri5 tok Plist COPY FENCE flags function already cancelled next item in FUNLIST Any more to cancel all done Get out R16 DNLNAME 8 FONCRARE DG Copy startup name 292 ava i Ignore errors ignore errors e g function already cancelled AS LENTRY RS v2022 USING 7 next item in FUNLIST Restore USING status News from the REXX Compiler Supplement ems MM Rem 81830008 610409000 81850068 61666066 81878008 81880060 61890060 61966666 81910609 81928608 91930800 01940000 61950008 91960908 81976068 61588008 81396066 62606008 62616608 62029008 02030066 62049068 02050800 82060000 62070069 62089680 82898000 62108000 82116006 82126008 821308800 82140000 92158808 62160000 02170906 62180800 62190886 2200006 82218660 2220808 82230080 62240068 92250608 02260806 62276060 62280008 92290009 82300808 627316606 62320608 02330606 62346060 Using REXX as a Database Tool Mark Hessling Griffith University 95 Using R
174. via REXX s ADDRESS instruction Addressing NCDB connects the REXX program to the primary sybase dataserver using ALERTS connects it to the Event Handler To interact with eith r the programmer need only code an SQL command or use a stored procedure a Sybase term for SOL routines maintained in the dataserver in the address command The success of the command can be evaluated by looking at the special REXX variable sqlCode While for the most part addressing the dataservers via this command is straight forward a few SOL commands represent a problem For example SELECT command may return row after row of data from the table each row with many individual data items Each item can be of a variety of data types Here s where REXX s ability to create variables on the fly and have variables types change make it an excellent choice of our application Asa data item is returned let say the time field for particular alert a REXX variable named TIME is created if it does already exist It is filled with the text representation of the time The same thing for integers or for character strings which the database can store in several varieties The programmer need not immediately be concerned with making sure the variable type matches what s coming back from the database Multiple rows are handled by returning one row at a time and having a special fetch command The program can use to indicate that it is finished with the current r
175. x 212 578 7198 Pam Taylor The Workstation Group 6300 N River Road Rosemont IL 60018 708 696 4450 Fax 708 696 2277 pjt wrkgrp com Chuck Turco Monsanto 800 No Lindbergh O2J St Louis MO 63167 314 694 4227 Fax 314 694 7545 Melinda Varian Princeton University CIT 87 Prospect Ave Princeton NJ 08544 609 258 6016 melinda pucc princeton edu Heather Wassel 524 101 Benner Road Allentown PA 18104 215 653 8067 Tom Wassel 524 101 Benner Road Allentown PA 18104 215 653 8067 Robert Wilcox New World Technologies 85 Jones Hollow Rd Marlborough CT 06447 203 295 0680
176. xec and in C as the object file rxnathfn rxfn As shown opposite REXX imc comes with about 430K of source The four major documentation files shown opposite are rexx info which is my attempt at a tutorial for Rexx rexx ref which is a complete reference on the language features of REXX imc rexx summary which is a ref erence card on REXX imc and rexx tech which gives details to the application programmer or any programmer who is interested in the internals of REXX imc There are also several minor documentation files not shown here which give details about the current release the change history the installation instructions etc Notes REXX imc The OPTIONS instruction s most useful option for us ing on the command line is the tracefile f option which redirects tracing output to a file The t option can be followed by any Rexx trace setting which allows you to trace a program without altering it The v option can be used alone in which case the interpreter does nothing except print its version or with other options in which case it prints its version and then runs a program The x option is usually used for programs which invoke themselves on Unix by having a or a shell instruction on the first line REXX imc will treat the first line of the program as a comment and will not append anything to the program name If no program name is given or if the program name is then the program w
177. xstack 6600 const h 16140 functions h 16423 globals h 6165 rexxsaa h 5678 calc c 49157 globals c 8683 interface c 37875 main c 4896 rexx c 97258 rxfn c 77118 rxmathfn c 8061 rxque c 8610 rxstack c 6051 shell c 8228 util c 80214 33568 155257 12627 33320 REXX ime Rexx Symposium 1994 Invocation rexx options program arguments where options are lt option gt any option from OPTIONS v print version s lt string gt execute the string as a program t trace turn tracing on i enter interactive trace mode X run Unix executable Rexx program REXX imc Rexx Symposium 1994 The file librexx so 1 6 is the main library file which contains all the routines necessary for an application to use the SAA API of REXX imc On the SunOS system this is a dynamically loaded shared library which means that an application which uses the library does not need to include a copy of the library within its object code thus saving disk space This can be seen from the fact that the program rexx which is the interpreter itself is only a 6K file This program is merely an interface between the command line and the API library and is compiled from the source file main c The programs rxque and rxstack are for the Rexx stack which will be discussed later The file rxmathfn rxlib is a function dictionary for the REXX imc mathematical functions which are imple mented in Rexx as rxmathfn e
178. y Error preparing statement SQLCODE se ee ee ee ee ee ee ee te ee eee ee a ew er re ee ee Open the cursor associated with the SQL statement Do parm_var STAFF Call sqlexec OPEN cl USING parm var M M A Fetch and display each row selected Do While SQLCA SQLCODE 0 Call sqlexec FETCH cl INTO table name If SQLCA SQLCODE 0 Then SQLCA SQLCODE Say Table table name End Close the cursor and end the transaction Call sqlexec CLOSE cl Call sqlexec COMMIT End Disconnect from the database ll sqlexec CONNECT RESET turn X xf st pa Example 2 M M a we M m Display the names of all tables owned by the default user GUROO version M e ee e
179. yboard buffer REXX imc Rexx Symposium 1994 Application Programming Interface The following SAA API functions are implemented RexxStart RexxVariablePool except requests RXSHV EXIT and RXSHV PRIV RexxRegisterSubcomExe RexxDeregisterSubcom RexxQuerySubcom RexxRegsiterExitExe with exits RXCMDHST RXSIODTR RXSIOSAY RXSIOTRC RXSIOTRD RXINIEXT RXTEREXT RexxDeregisterExit RexxQueryExit RexxRegisterFunctionExe RexxDeregisterFunction RexxQueryFunction More will be added later REXX imc Rexx Symposium 1994 The program rxque forks off a stack daemon and prints out its process number and socket name in the form of two environment variables The format of the output is as either a Bourne shell command or with the flag csh a c shell command rxque may be given the name of a socket to create in which case the output is just the process number The stack daemon is usually started by REXX imc and killed with signal 15 when the Rexx program finishes REXX imc checks for the presence of a stack daemon by looking for environment variable RXSTACK If a stack exists then it uses that instead of creating one Queued entries may then persist between programs 4 eval rxque csh 1s al rxstack 4 rexx s say queued 45 X rexx s pull parse pull a say a 5 imc 1024 May 2 16 00 kill RXSTACKPROC On some systems REXX imc can be compiled with the preprocessor symbol STUFF STACK defined REXX imc can then pre

Download Pdf Manuals

image

Related Search

Related Contents

Bosch DVR670 User's Manual  FAX-8070P MFC-9070 - Top Edge Engineering  Philips Hairdryer HP8180/07  PNP202 Drawings  ヒューマログミックス50注カート / ヒューマログミックス50注ミリオペン  RS232 RS485 to ethernet convert module user guide USR    KWizCom List Chart web part User Manual  

Copyright © All rights reserved.
Failed to retrieve file