0% found this document useful (0 votes)
90 views10 pages

Tutor 13

Tutor 13

Uploaded by

mfeld1952
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views10 pages

Tutor 13

Tutor 13

Uploaded by

mfeld1952
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Tutorial 13

REXX Scripting Language

PHP, Python (popular with Linux users), Perl and Tcl/Tk are widely used Scripting Languages. REXX is the Scripting Language favoured by IBM. It is availabe on all IBM operating system platforms. A large number of both open source/public domain and of commercial versions are also available for just about any existing platform. E.g., Microsoft has for many years been distributing a REXX Interpreter as part of their SDKs . Besides JCL, REXX is widely used under z/OS and OS/390. There is another TSO scripting language CLIST which is not as popular as REXX. This tutorial walks you through the generation and execution of a simple REXX program. For me, scripting languages like REXX, PHP, Python, Perl and Tcl/Tk are all very similar (yes, the fanatics will disagree). If you know one, you know them all. If you are interested, you can write lengthy CICS transactions using REXX, and some people have done so. The American National Standard (ANSI Standard) for REXX is called "Programming Language - REXX" ; its number is X3.274-1996. The REXX Language Association (RexxLA) is an independent organization dedicated to promoting the use and understanding of the REXX programming language. Visit http://www.rexxla.org/ .

Menu Utilities Compilers Options Status Help -----------------------------------------------------------------------------ISPF Primary Option Menu 0 Settings Terminal and user parameters 1 View Display source data or listings 2 Edit Create or change source data 3 Utilities Perform utility functions 4 Foreground Interactive language processing 5 Batch Submit job for language processing 6 Command Enter TSO or Workstation commands 7 Dialog Test Perform dialog testing 8 LM Facility Library administrator functions 9 IBM Products IBM program development products E----------------------------------------------N r e Licensed Materials - Property of IBM e e 5647-A01 (C) Copyright IBM Corp. 1980, 1997. e e All rights reserved. e e US Government Users Restricted Rights e s e Use, duplication or disclosure restricted e e by GSA ADP Schedule Contract with IBM Corp. e D----------------------------------------------M Option ===> 3 F1=Help F3=Exit F10=Actions F12=Cancel User ID . : Time. . . : Terminal. : Screen. . : Language. : Appl ID . : TSO logon : TSO prefix: System ID : MVS acct. : Release . : PRAKT20 10:12 3278 1 ENGLISH PDF IKJACCNT PRAKT20 DAVI ACCT# ISPF 4.5

Starting from the ISPF Primary Option Menu we allocate a Partitioned Data Set to store our REXX Scripts. Enter .

Menu Help -----------------------------------------------------------------------------Utility Selection Panel 1 Compress or print data set. Print index listing. Print, rename, delete, browse, edit or view members 2 Data Set Allocate, rename, delete, catalog, uncatalog, or display information of an entire data set 3 Move/Copy Move, copy, or promote members or data sets 4 Dslist Print or display (to process) list of data set names. Print or display VTOC information 5 Reset Reset statistics for members of ISPF library 6 Hardcopy Initiate hardcopy output 7 Download Download ISPF C/S, VA for ISPF, transfer map, or data set. 8 Outlist Display, delete, or print held job output 9 Commands Create/change an application command table * Reserved This option reserved for future expansion. 11 Format Format definition for formatted data Edit/Browse 12 SuperC Compare data sets (Standard Dialog) 13 SuperCE Compare data sets Extended (Extended Dialog) 14 Search-For Search data sets for strings of data (Standard Dialog) 15 Search-ForE Search data sets for strings of data Extended (Extended Dialog) Option ===> 2 F1=Help F3=Exit F10=Actions F12=Cancel Library

Enter

Menu RefList Utilities Help -----------------------------------------------------------------------------Data Set Utility A R D blank Allocate new data set Rename entire data set Delete entire data set Data set information C U S M V Catalog data set Uncatalog data set Data set information (short) Allocate new data set VSAM Utilities

ISPF Library: Project . . PRAKT20 Group . . . REXX Type . . . . EXEC Other Partitioned, Sequential or VSAM Data Set: Data Set Name . . . Volume Serial . . . (If not cataloged, required for option "C") Data Set Password . . (If password protected)

Option ===> A F1=Help F3=Exit

F10=Actions

F12=Cancel

We name the new PDS PRAKT20.REXX.EXEC .

Allocate, Enter

Menu RefList Utilities Help -----------------------------------------------------------------------------Allocate New Data Set More: + Data Set Name . . . : PRAKT20.REXX.EXEC Management class Storage class . Volume serial . Device type . . Data class . . . Space units . . . . . . . . . . . . . . . . . . . . DEFAULT PRIM90 SMS001 MEGABYTE (Blank for default management class) (Blank for default storage class) (Blank for system default volume) ** (Generic unit or device address) ** (Blank for default data class) (BLKS, TRKS, CYLS, KB, MB, BYTES or RECORDS) (M, K, or U) (In above units) (In above units) (Zero for sequential data set) *

Average record unit Primary quantity . Secondary quantity Directory blocks . Record format . . . Record length . . . Block size . . . . Data set name type Command ===> F1=Help

. 2 1 . 5 . FB . 80 . 11440 : PDS F10=Actions

(LIBRARY, HFS, PDS, or blank) (YY/MM/DD, YYYY/MM/DD F12=Cancel

F3=Exit

Select the usual parameters for a Partitioned Data set . Press F3 key 3 times .

Menu Utilities Compilers Options Status Help -----------------------------------------------------------------------------ISPF Primary Option Menu 0 1 2 3 4 5 6 7 8 9 10 11 Settings View Edit Utilities Foreground Batch Command Dialog Test LM Facility IBM Products SCLM Workplace Terminal and user parameters Display source data or listings Create or change source data Perform utility functions Interactive language processing Submit job for language processing Enter TSO or Workstation commands Perform dialog testing Library administrator functions IBM program development products SW Configuration Library Manager ISPF Object/Action Workplace User ID . : Time. . . : Terminal. : Screen. . : Language. : Appl ID . : TSO logon : TSO prefix: System ID : MVS acct. : Release . : PRAKT20 10:21 3278 1 ENGLISH PDF IKJACCNT PRAKT20 DAVI ACCT# ISPF 4.5

Enter X to Terminate using log/list defaults

Option ===> 2 F1=Help F3=Exit

F10=Actions

F12=Cancel

Call the ISPF editor to write the REXX Program. Enter

Menu RefList RefMode Utilities LMF Workstation Help -----------------------------------------------------------------------------Edit Entry Panel ISPF Library: Project . . Group . . . Type . . . Member . . . . . . PRAKT20 REXX EXEC HALLOAA

. . .

. . .

. . .

(Blank or pattern for member selection list)

Other Partitioned or Sequential Data Set: Data Set Name . . . Volume Serial . . . (If not cataloged) Workstation File: File Name . . . . . Initial Macro . . Profile Name . . . Format Name . . . Data Set Password Command ===> F1=Help . . . . . . . . F10=Actions Options / Confirm Cancel/Move/Replace Mixed Mode Edit on Workstation Preserve VB record length F12=Cancel

F3=Exit

We write our REXX Program into the Member HALLOAA

File Edit Confirm Menu Utilities Compilers Test Help ------------------------------------------------------------------------------s EDIT PRAKT20.REXX.EXEC(HALLOAA) - 01.00 Columns 00001 00072 ****** ***************************** Top of Data ****************************** ==MSG> -Warning- The UNDO command is not available until you change ==MSG> your edit profile using the command RECOVERY ON. '''''' /****************** Programm mit REXX ***********/ '''''' say 'Hallo Welt' '''''' exit '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' Command ===> Scroll ===> PAGE F1=Help F3=Exit F5=Rfind F6=Rchange F12=Cancel

This is the program . A REXX Program always starts with a comment statement which may have arbitrary content. It is good programming practice to always end a REXX program with exit , alsough many implementations do not require it. In place of keywords like print, write, or put, REXX uses the keyword say. This is an easy way to recognise a program as being written in REXX. Press F3 . Call the editor again to confirm your input.
File Edit Confirm Menu Utilities Compilers Test Help ------------------------------------------------------------------------------s EDIT PRAKT20.REXX.EXEC(HALLOAA) - 01.00 Columns 00001 00072 ****** ***************************** Top of Data ****************************** ==MSG> -Warning- The UNDO command is not available until you change ==MSG> your edit profile using the command RECOVERY ON. 000100 /****************** Programm mit REXX ***********/ 000200 say 'Hallo Welt' 000300 exit ****** **************************** Bottom of Data ****************************

Command ===> F1=Help

Scroll ===> PAGE F3=Exit F5=Rfind F6=Rchange F12=Cancel

Looks ok. Press F3 2 times.

Menu Utilities Compilers Options Status Help -----------------------------------------------------------------------------ISPF Primary Option Menu 0 1 2 3 4 5 6 7 8 9 10 11 Settings View Edit Utilities Foreground Batch Command Dialog Test LM Facility IBM Products SCLM Workplace Terminal and user parameters Display source data or listings Create or change source data Perform utility functions Interactive language processing Submit job for language processing Enter TSO or Workstation commands Perform dialog testing Library administrator functions IBM program development products SW Configuration Library Manager ISPF Object/Action Workplace User ID . : Time. . . : Terminal. : Screen. . : Language. : Appl ID . : TSO logon : TSO prefix: System ID : MVS acct. : Release . : PRAKT20 10:35 3278 1 ENGLISH PDF IKJACCNT PRAKT20 DAVI ACCT# ISPF 4.5

Enter X to Terminate using log/list defaults

Option ===> TSO EXEC REXX.EXEC(HALLOAA) EXEC F1=Help F3=Exit F10=Actions F12=Cancel

Back to the ISPF Primary Option Menue . Enter the command TSO EXEC REXX.EXEC(HALLOAA) EXEC Press Enter

Menu Utilities Compilers Options Status Help -----------------------------------------------------------------------------ISPF Primary Option Menu 0 1 2 3 4 5 6 7 8 9 10 11 Settings View Edit Utilities Foreground Batch Command Dialog Test LM Facility IBM Products SCLM Workplace Terminal and user parameters Display source data or listings Create or change source data Perform utility functions Interactive language processing Submit job for language processing Enter TSO or Workstation commands Perform dialog testing Library administrator functions IBM program development products SW Configuration Library Manager ISPF Object/Action Workplace User ID . : Time. . . : Terminal. : Screen. . : Language. : Appl ID . : TSO logon : TSO prefix: System ID : MVS acct. : Release . : PRAKT20 10:35 3278 1 ENGLISH PDF IKJACCNT PRAKT20 DAVI ACCT# ISPF 4.5

Enter X to Terminate using log/list defaults Hallo Welt ***

This is the result. Simple, Isnt it ?

REXX permits you to do many things. The following code sample calculates a fraction

File Edit Confirm Menu Utilities Compilers Test Help ------------------------------------------------------------------------------s EDIT PRAKT20.REXX.EXEC(MEXEC) - 01.00 Columns 00001 00072 ****** ***************************** Top of Data ****************************** ==MSG> -Warning- The UNDO command is not available until you change ==MSG> your edit profile using the command RECOVERY ON. 000001 /******REXX****************************************************/ 000002 /* EXEC for the division of two numbers */ 000003 /**************************************************************/ 000004 say 'first number :' 000005 pull z 000006 say 'second number :' 000007 pull n 000008 if n=0 then say 'Division by zero not permitted' 000009 else do 000010 say z 'divided by' n 'is' z/n 000011 say 'or' 000012 say z 'divided by ' n 'is' z%n 'remainder' z//n 000013 end ****** **************************** Bottom of Data **************************** Command ===> F1=Help Scroll ===> PAGE F3=Exit F5=Rfind F6=Rchange F12=Cancel

You may store this code in another member besides HALLOAA , and give it any name. Execute it like before. If you do not need the data any longer, erase the dataset using the same menu you used to generate it: To delete a dataset proceed as follows : ISPF Primary Options Menu -> (3) Utility Selection Panel -> (2) Dataset Utility, then mark the dataset to be erased with a D (Delete entire data set). Thats it. Congratulations, you are now an expert REXX pogrammer.

To dig deeper - additional Literature


Internet REXX Language page at IBM Hursley http://www2.hursley.ibm.com/rexx/ Einfaches REXX Tutorial http://users.comlab.ox.ac.uk/ian.collier/Docs/rexx_info/whole.html Introductory REXX Tutorial http://www.rexxla.org/About_Rexx/rexxtut.html REXX Tutorial http://users.comlab.ox.ac.uk/ian.collier/Rexx/info.html Introductory Rexx Tutorial http://www.rexxla.org/About_Rexx/rexxtut.html

IBM Manuals SC28-1882 SC28-1883 SC23-3803 | SC31-8231 | SC28-1905 | SC28-1975 | SC28-1974 ZB35-5100 SC26-4358 SC24-5549 G511-1430 SH19-8160 SK2T1402 LY19-6264 SB20-0020 | SR23-8926 | SG24-2216 SH21-0482 TSO/E V2R1.1 REXX User's Guide TSO/E Version 2 REXX/MVS Reference Using REXX to Access OpenEdition MVS Services TME 10 NetView for OS/390 V1R2 Customization: Using REXX OS/390 Using REXX and OS/390 UNIX System Services OS/390 V2R10.0 TSO/E REXX Reference OS/390 V2R9.0-R10.0 TSO/E REXX User's Guide The REXX Language, 2nd Ed. -- Cowlishaw (see below) SAA CPI: Procedures Language Reference (Level 1) SAA CPI: REXX Level 2 Reference IBM REXX Compiler and Library/370: Introducing the Next Step in REXX REXX/370 (Compiler and Library/370): User's Guide and Reference REXX/370 Compiler and Library V1R2.0 Online Product Library IBM REXX Compiler and Library/370: Diagnosis Guide The REXX Handbook -- Ed. Goldberg & Smith (see below) The NetRexx Language -- M. F. Cowlishaw Creating Java Applications Using NetRexx -- U. Wahli et al REXX Development System for CICS/ESA and REXX Runtime Facility for CICS/ESA Guide and Reference GG24-1615 Using REXX in Practice: EXEC2 to REXX Conversion Experiences SC23-3803 Using REXX to Access OpenEdition MVS Services SC23-3501 OS/390 Internet BonusPak II: Web Programming

Books The REXX Language -- M. F. Cowlishaw In English: ISBN 0-13-780735-X Prentice-Hall, 1985 ISBN 0-13-780651-5 (Second edition), 1990 In German: ISBN 3-446-15195-8 Carl Hanser Verlag, 1988 ISBN 0-13-780784-8 P-H International, 1988 In Japanese: ISBN 4-7649-0136-6 Kindai-kagaku-sha, 1988 Modern Programming Using REXX -- Robert P. O'Hara and David R. Gomberg ISBN 0-13-597311-2 Prentice-Hall, 1985 ISBN 0-13-579329-5 (Second edition), 1988 (From REXXPress, [email protected]) REXX In the TSO Environment -- Gabriel F. Gargiulo

ISBN 0-89435-354-3, QED Information Systems Inc., Order #CC3543; 320pp, 1990 Revised edition: ISBN 0-89435-418-3, QED Information Systems Inc., 471pp, 1993 The REXX Handbook -- Edited by Gabe Goldberg and Phil Smith III ISBN 0-07-023682-8, 672pp, McGraw Hill, 1991 Practical Usage of REXX -- Anthony S. Rudd ISBN 0-13-682790-X, Ellis Horwood (Simon & Schuster), 1990 Using ARexx on the Amiga -- Chris Zamara and Nick Sullivan ISBN 1-55755-114-6, 424pp+diskette, Abacus, 1991 Programming in REXX -- Charles Daney ISBN 0-07-015305-1, 300pp, McGraw Hill, 1992 The ARexx Cookbook -- Merrill Callaway ISBN 0-9632773-0-8, 221pp, Whitestone, 1992 (Companion diskette: ISBN 0-9632773-1-6) Command Language Cookbook -- Hallett German ISBN 0-442-00801-5, 352pp, Van Nostrand Reinhold, 1992 REXX--Advanced Techniques for Programmers -- Peter C. Kiesel ISBN 0-07-034600-3, 239pp, McGraw Hill, 1993 REXX Tools and Techniques -- Barry K. Nirmal ISBN 0-89435-417-5, 264pp, QED, 1993 REXX in der Praxis -- Peter Kees ISBN 3-486-22666-5, 279pp, Oldenbourg, 1993 VX-Rexx for OS/2 (Programmer's Guide and Reference) 2.0 ISBN 1-55094-074-0 Watcom International Corp., 724pp, 1993 REXX Reference Summary Handbook (OS/2) -- Dick Goran ISBN 0-9639854-0-X C F S Nevada, Inc, 102pp, 1993. ISBN 0-9639854-1-8 (second edition), 148pp, 1994. ISBN 0-9639854-2-6 (third edition, for Warp), 208pp, 1995. ISBN 0-9639854-3-4 (fourth edition, for Warp 4), 270pp, 1997. OS/2 2.1 REXX Handbook: Basics, Applications, and Tips -- Hallett German ISBN 0442-01734-0, 459pp, Van Nostrand Reinhold, 1993 Proceedings of the REXX Symposium for Developers and Users SLAC Report-422, 247pp, May 18-20, 1993 Mastering OS/2 REXX -- Gabriel F. Gargiulo ISBN 0-471-51901-4, 417pp, Wiley-QED, 1994 Application Development Using OS/2 REXX -- Anthony S. Rudd ISBN 0-471-60691-X, 416pp, Wiley-QED, 1994 Writing VX-Rexx Programs -- Ronny Richardson ISBN 0-07911-911-5, 336pp+CD-ROM, McGraw-Hill, 1994 Teach Yourself REXX in 21 Days -- William F. Schindler & Esther Schindler ISBN 0-672-30529-1, 527pp, SAMS, 1994 Writing OS/2 REXX Programs -- Ronny Richardson

ISBN 0-07052-372-X, 390pp, McGraw-Hill, 1994 REXX Procedursprak--hur du programmerar din PC med OS/2 -- Bengt Kynning ISBN 91-44-48541-7, 300pp, Studentlitteratur (Sweden), 1994 The REXX Cookbook -- Merrill Callaway ISBN 0-9632773-4-0, 319pp, Whitestone, 1995 ISBN 0-9632773-5-9 The REXX files (Companion disk) Yasashii Rexx Nyumon (Introduction to Easy Rexx) -- Fumito Yamada ISBN 4-88648-434-4, Tokyo: Daiwa Art/Di Art, diskette, 1995 ISPF/REXX Development for Experienced Programmers -- Lou Marco ISBN 1-878956-50-7, 201pp, diskette, CBM Books, Ft. Washington, PA, 1995 REXX ni Yoru OS/2 Nyumon (Introduction to OS/2 via REXX) -- Naohiko Yamashita ISBN 4-7898-3562-6 Tokyo: CQ Shuppan, 1996 REXX Jiyu Jizai (Handy with REXX) -- Takanori Seki ISBN 4-7819-0810-1 Tokyo: Science-sha, 1996 Object REXX by Example -- Gwen L. Veneskey et al. ISBN 0-9652329-0-5, 331pp+disk, Aviar Inc. (+1-412-488-9730), 1996 Practical Usage of MVS REXX -- Anthony S. Rudd ISBN 3-540-19952-7, 310pp, Springer-Verlag, 1996 Object REXX for OS/2 Warp: Rexx Bytes Objects Now -- Trevor Turton et al. ISBN 0-13-273467-2, 320pp+disk, Prentice-Hall, 1997 Das REXX Lexikon -- Gerd Leibrock ISBN 3-486-23672-5, 598pp, Oldenbourg Verlag, 1997 The NetRexx Language -- M. F. Cowlishaw ISBN 0-13-806332-X, 197pp, Prentice-Hall, 1997 Object Oriented Programming with REXX -- Tom Ender ISBN 0-471-11844-3, 253 pp, Wiley Computer Publishing, diskette, 1997 Object REXX for Windows NT and Windows 95 -- Ueli Wahli et al ISBN 0-13-858028-6, 490pp+disk, Prentice-Hall, 1997 | Down to Earth REXX -- William F. (Bill) Schindler | ISBN 0-9677590-0-5, 507pp, Perfect Niche Software, 2000 | Practical Usage of TSO REXX -- Anthony S. Rudd ISBN 1-85233-261-1, 324pp, Springer-Verlag, 2000

You might also like