第五章 系统编程工具REXX与CLIST
合集下载
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Say指令:
语法: Say expression
每个Say指令显示一行输出. 例:
Say “Hello, world.” Say 25 * (9 / 3) Say “The answer is:” num1 + num2 Say Say ‘’
Parse指令
语法: Parse source variabletemplate
变量不用必须声明.REXX中的变量是无类 型划分的,所有的数据都是字符型数据.
算术运算:
运算符: ** 指数运算 * 乘法 / 除法 % 整除 // 取余 + 加法 - 减法
算术优先规则:
REXX的通常优先级规则: () 圆括号 +, - 前缀符号 ** 指数运算符号 *, /, %, // 乘法和除法 +, - 加法和减法
REXX简介
REXX在z/OS上的使用 Command procedures Personal programming Application initiation Application prototyping Application programming Common macro language for varied applications
REXX不支持缩排: If a = b Then Say “a and b are equal.” Else Say “a and b are not equal.”
变量
REXX中,变量的命名规则: - 最多包含250个字符 - 可以包含字母,数字和一些特殊字符 (TSO中: # $ ! ? _ . ¢). - 不能以数字或.开头
it may span multiple lines */ 5. /* Comments may /* Comments may be nested */ be
nested */
继续和缩排
短指令可以用“;”分开: a = ‘Cat’; b = ‘Dog’; c = 17
长指令可以用“,”分行: sentence = “The quick brown fox ”, “jumps over the lazy dog.”
百度文库
Rexx中的注释:
注释以/*开始,以*/结尾. 注释可以嵌套. 例: 1. /* REXX execs should begin with a comment */ 2. Say “Hello!” /* comment may follow instruction */ 3. /* comment may precede instruction */ Say “Hello!” 4. /* A comment may be long, up to 250 characters, and
第五章 系统编程工具REXX和CLIST
第一部分(REXX): 1. REXX简介 2. Rexx入门学习 3. REXX编程基础 4.程序调试和错误处理 第二部分(CLIST): 1. CLIST简介
第一部分(REXX)
1. REXX简介 2. Rexx入门学习 3. REXX编程基础 4. 程序调试和错误处理
- ISPF Edit macros, ISPF Dialogs, Netview - CICS, DB2, QMF - Other vendor products
REXX简介
Interpreted versus Compiled 解译器:
- 当程序在运行时,翻译并执行每个程序语句 编译器:
Say answer == “YES” /* strict comparison */
Say 5 == 5.0
/* strict comparison */
数值比较
比较符: = equal \= not equal ﹁= not equal <> not equal (less than or greater than) >< not equal (greater than or less than) <= less than or equal to \> less than or equal to (not greater than) ﹁> less than or equal to (not greater than) >= greater than or equal to \< greater than or equal to (not less than) ﹁< greater than or equal to (not less than) < less than > greater than
Trace指令:
语法: Trace option
有用的选项: - N Normal(default) - O Off - R Results - I Intermediates
注: Trace指令通常被用语Rexx exec程序的调试.跟踪一个 exec也就意味着你希望在exec中的指令被执行前Rexx可 以在屏幕上显示出这些指令.
membername parameters
- Extended implicit execution:
%membername parameters
查找包括:
//SYSEXEC DD concatenation
then //SYSPROC DD concatenation
用来作为命令行上的成员名.
3. REXX编程基础
比较关系 REXX中的比较关系有时被称为二进制条件
表达试, 因为它们总是只有两种可能结 果:True(值为1)和False(值为0). REXX中有两种类型的比较关系: - 字符串比较 - 数值比较
字符串比较
两种字符串比较类型:
- 普通: 忽略字符串前后的空格
2. Rexx入门学习
REXX under TSO
REXX exec 可以是一个顺序数据集或一个PDS成员
TSO EXEC命令调用一个REXX或CLIST程序
三种使用EXEC命令的方法:
- Explicit execution:
EXEC dataset parameters
- Implicit execution:
REXX简介
REXX特点: 易学易用性 自由的语法格式 Either interpreted or compiled 丰富的built-in函数 Typeless variables Very strong parsing 好的调试工具 提供和其他语言的接口 可扩展性
- 严格: 每个字符必须精确匹配
例:
answer = “ YES “ /* assign variable */
Say answer = “YES” /* normal comparison */
Say answer = “yes” /* comparisons are */
/* case sensitive */
从键盘读(Parse Pull)
语法: Parse Upper Pull variabletemplate - or – Pull variabletemplate variabletemplate是变量名的列表. 在给模板中的变量赋值前,将输入数据自动 转换成大写形式.
例:
/* REXX sample */ Say “Please enter your name:” Parse Upper Pull name Say “Hello” name”.” Say “Enter 2 numbers:” Parse Upper Pull numa numb Say “You entered these numbers:” numa “and” numb
REXX简介
运行平台: IBM的所有平台:
- VM – REXX首次出现(1983) - OS/2 - AIX - VSE - OS/390 TSO(1988) 1987年被选为SAA Procedural Language 也可以用在许多非IBM平台上: - Tandem, VAX, Amiga - Several UNIX versions (including Linux) - windows (Object REXX from IBM) - NetRexx
如果保留输入数据的大小写形式,则删除关键字Upper: Parse Pull variabletemplate
从命令行接收参数(Parse Arg)
语法: Parse Upper Arg variabletemplate - or – Arg variabletemplate
例: /* REXX sample */ Parse Upper Arg inparms Say inparms Parse Upper Arg parm1 parm2 parm3 rest Say parm1 Say parm2 如果保留输入数据的大小写形式,则删除关键字Upper: Parse Arg variabletemplate
算术优先规则:
例: Say 7 * 3 + 4 Say 2 ** 3 ** 2 Say 7 + 3 * 4 Say 2 ** (3 ** 2) Say 7 – 3 + 4 Say -5 + 6 Say 7 + 3 – 4 Say -5 + 6 * 2 Say 3 ** 2 Say –(5 + 6) * 2
1. REXX简介
REXX的起源和历史: 由Mike Cowlishaw设计
- 1979-1982,IBM Hursley Labs, UK - Using feedback from over 300 users on VNET Designed to make the ack of programming easier Intended uses: - personal programming - Tailoring user commands - Macros - Prototyping - Applications Now runs on many vendors platforms
READY
%myrexx 24 72 my.data
REXX execs在TSO下的执行:
在TSO/E中用EXEC命令运行非编译的程序。精确运行一个REXX可 执行程序格式如下: EXEC DSName(数据集名字) Parameter exec 例如:名为USERID.REXX.EXEC(TIMEGAME)的数据集被执行,格 式如下: 完整数据集被调用,数据集名要被引号标记,如下: EXEC ‘userid.rexx.exex(timegame)’ exec 非完整数据集被调用,如下: EXEC rexx.exex(timegame) exec /* eliminates prefix */ EXEC rexx(timegame) exec /* eliminates prefix and exec */ 通常REXX命令的输入执行可以在ISPF.6对应面板中的COMMAND后 面输入,也可以在READY提示符下面输入。
Where source is the input source of the data to be parsed, and variabletemplate are the rules for parsing that data,and the variables to which the data parts will be assigned.
- 首先将整个程序翻译成机器语言 - 然后通过链接-编辑成加载模块 - 然后用户可以运行该程序
REXX简介
一个简单的REXX程序 /* REXX exec to introduce REXX */ Say “Hello! My name is REXX. What’s yours?” Parse Pull name If name = ‘’ Then Say “You’re not friendly” Else Say name “is a nice name.” Exit 0