Example: dental hygienist

An Introduction to REXX for OS/390 Users - …

BY LIONEL B. DYCK REXXis a popular programming language thatMichael Cowlishaw of IBM developed forthe VM environment. The language was ported to MVS andOS/2, and today you can find versions of REXX for mostplatforms. There is also NetRexx, which can generate Javaand Object REXX if you are into objects. Additionally,there is object-oriented (OO) definitive book for REXX beginnersis The REXX Languageby (ISBN 0-13-780735-XPrentice-Hall, 1985, ISBN 0-13-780651-5 second edition, 1990).Note that on OS/390 the IBMsoftcopy publications are excellentreference BASICSOS/390 REXX is a procedurallanguagewith a simple syntax.

BY LIONEL B. DYCK REXXis a popular programming language that Michael Cowlishaw of IBM developed for the VM environment. The language was ported to MVS and OS/2, and today you can find versions of REXX for most

Tags:

  Introduction, Introduction to

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of An Introduction to REXX for OS/390 Users - …

1 BY LIONEL B. DYCK REXXis a popular programming language thatMichael Cowlishaw of IBM developed forthe VM environment. The language was ported to MVS andOS/2, and today you can find versions of REXX for mostplatforms. There is also NetRexx, which can generate Javaand Object REXX if you are into objects. Additionally,there is object-oriented (OO) definitive book for REXX beginnersis The REXX Languageby (ISBN 0-13-780735-XPrentice-Hall, 1985, ISBN 0-13-780651-5 second edition, 1990).Note that on OS/390 the IBMsoftcopy publications are excellentreference BASICSOS/390 REXX is a procedurallanguagewith a simple syntax.

2 Withmost programming languages you have tospend a great deal of time learning the codingstyle rules, where to put parentheses, when to usebrackets, how to use quotes (single or double), how tocomment,and how to continue a statement across multiplerecords. With REXX, you will learn these things in less timethan it takes to learn when to use braces in C or C++.Note that OS/390 REXX is also an interpretive is no compile, link, or execute required. Just put theREXX program in the proper DD concatenation and executeit. Although there are several REXX compilers available,including one from IBM, this article will not address goal of this article is to teach you how to code inREXX by demonstrating how to actually code a simpleREXX program that will: obtain a list of all members of a partitioned data set read each member report on each member that contains a specific stringFigure 1 shows the entire REXX code sample for FIRST STATEMENTThe first statement in any REXX program should be a comment contain-ing the word REXX.

3 This commentline is a standard in OS/390 REXX that lets the REXX program beincluded in the SYSPROC or theSYSEXEC DD 2 shows an example of validfirst in REXX appear between theslash asterisk (/*) and the asterisk slash (*/). Thesedelimiters can appear on the same record or you can separatethe delimiters by multiple :You can include additional slash asterisks (/*) within acomment; however, when the system encounters the firstslash asterisk (*/), it ends your shown in Figure 2, the first statement is just a ISPF Edit, enter Hilite and a pop-up panel like to set the language type explicitly to REXX.

4 I setAn Introduction to REXX forOS/390 UsersThis article provides an OS/390 user with the necessary information to code a simple REXX program and to use the provided IBM documentation to build complex applications in , the author demonstrates how to write a program in REXX to read every member ofa PDS and report on every member that contains a particular SUPPORT MARCH 2001 Note that OS/390 REXX is also aninterpretive is no compile,link, or execute put the REXX programin the proper DDconcatenation andexecute it. 2001 Technical Enterprises, Inc. Reproduction of this document without permission is to 3 so that both the IF and DOlogic are colored.

5 I then place a slash (/)next to each of the following: parenthesesmatching, highlight FIND strings, andhighlight cursor phrase. This will makecoding easier, as it will hilite any mismatchedquotes and/or UP ARGUMENTS FROMTHE COMMAND LINE ANDVARIABLE NAMESA REXX program executes like a CLIST because the user can specify options whenissuing the command. For this program, youcan specify two options: the name of thepartitioned data set and the name of thestring to report on. The code to capture theoptions is as follows:Arg pds_dsname stringThe ARG instruction tells REXX to accessthe command line arguments,andpds_dsname and string are the variableswhere you place the arguments.

6 A variablename can be anything that begins with analphabetic or national character (forexample,$@#!?_) but not a number. Thename can contain any alphanumeric ornational character. I will discuss other variablenaming conventions, including the stemvariables, you place the arguments into thevariables, you need to verify the existenceof both arguments. Figure 3 shows the codefor 1 and 7 are IF statementswhich test the variable for a null ( ).Statements 2 and 8 are THEN statementsthat follow the IF to indicate that someaction will be performed.

7 The DO statementindicates processing for a single pass DOloop. The DO loop ends with the ENDstatement(statements 6 and 12). Within theDO loops, the SAY instruction writes outputto the screen consisting of whatever 5 and 11 cause the REXX pro-gram to terminate immediately with a returncode of 8. The indentation is not critical toREXX but is helpful to the human coderand AND LITERALSBy default, variables will be the value ofthe variable name. Thus, a variable nameof pds_dsname will have a default value ofPDS_DSNAME. Literals are any characterstring in either single or double that the case of the variable name isnot THE VALIDITY OF THEINPUT PDSNext, it is helpful to verify that the inputpds provided is a valid data set name.

8 Youcan use the code shown in Figure 4 to doyour 1 uses the SYSDSN function,which uses a parameter of the input data setname to test if the data set exists. The <> isthe same as saying, not equal, and the testis for a literal of OK. If the result of theSYSDSN test is not equal to OK, then a DOLoop is 2 issues an error messagestarting with the literal of Error: fol-lowed by the input data set name. Theresults of the SYSDSN function call follow,TECHNICAL SUPPORT MARCH 2001/* rexx procedure ** Name: DoAll ** Syntax: %DOALL pds string ** */arg pds_dsname stringIf pds_dsname = Then doSay Error.

9 No arguments entered. Say Ending. Exit 8 EndIf string = Then doSay Error. No program name entered. Say Ending. Exit 8 Endif sysdsn(pds_dsname) <> OK then dosay Error: pds_dsname sysdsn(pds_dsname)exit 8endcall outtrap trap. LISTD pds_dsname MEMBERS call outtrap off do i = 1 to = MEMBERS then leaveendcall listdsi pds_dsname dsname = sysdsnamei = i + 1do j = i to value with memmem = strip(mem)say Checking Member: Alloc f(xxin) ds( dsname ( mem ) ) shr reuse Execio * diskr xxin (finis stem in. Free f(xxin) hit = 0do z = 1 to pos(string, ) > 0then hit = 1endif hit = 1 thensay Found in Member: memendFIGURE 1: COMPLETE REXX PROGRAM SOURCE/* rexx *//* - a rexx program *//* - a rexx programthat does something */FIGURE 2: VALID FIRST STATEMENTS 2001 Technical Enterprises, Inc.)

10 Reproduction of this document without permission is provide a short phrase describingthe 3 will exit the REXX programwith a return code of 8, and Statement 4ends the DO THE LIST OFPDS MEMBERSTo process every member of a partitioneddata set you will use the TSO commandLISTD. This code segment will demonstratethe use of a TSO command, the use of theOUTTRAP instruction to capture outputnormally written to the TSO screen, a some-what more complex DO loop, the use of thePARSE instruction, the use of stem variables,and the use of the CALL instruction. TheOUTTRAP instruction is shown in Figure first statement in Figure 5 calls theOUTTRAP REXX function.


Related search queries