![系統(tǒng)編程工具REXX和CLIST_第1頁](http://file4.renrendoc.com/view/3c68f785934d0ee8f79e532d6337b2ac/3c68f785934d0ee8f79e532d6337b2ac1.gif)
![系統(tǒng)編程工具REXX和CLIST_第2頁](http://file4.renrendoc.com/view/3c68f785934d0ee8f79e532d6337b2ac/3c68f785934d0ee8f79e532d6337b2ac2.gif)
![系統(tǒng)編程工具REXX和CLIST_第3頁](http://file4.renrendoc.com/view/3c68f785934d0ee8f79e532d6337b2ac/3c68f785934d0ee8f79e532d6337b2ac3.gif)
![系統(tǒng)編程工具REXX和CLIST_第4頁](http://file4.renrendoc.com/view/3c68f785934d0ee8f79e532d6337b2ac/3c68f785934d0ee8f79e532d6337b2ac4.gif)
![系統(tǒng)編程工具REXX和CLIST_第5頁](http://file4.renrendoc.com/view/3c68f785934d0ee8f79e532d6337b2ac/3c68f785934d0ee8f79e532d6337b2ac5.gif)
版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
第五章系統(tǒng)編程工具REXX和CLIST第一部分(REXX):
1.REXX簡介
2.Rexx入門學習
3.REXX編程基礎
4.程序調(diào)試和錯誤處理第二部分(CLIST):
1.CLIST簡介第一部分(REXX)1.REXX簡介
2.Rexx入門學習
3.REXX編程基礎
4.程序調(diào)試和錯誤處理
1.REXX簡介REXX的起源和歷史:由MikeCowlishaw設計
-1979-1982,IBMHursleyLabs,UK-Usingfeedbackfromover300usersonVNETDesignedtomaketheackofprogrammingeasierIntendeduses:-personalprogramming-Tailoringusercommands-Macros-Prototyping-ApplicationsNowrunsonmanyvendorsplatformsREXX簡介運行平臺:IBM的所有平臺:
-VM–REXX首次出現(xiàn)(1983)
-OS/2-AIX-VSE-OS/390TSO(1988)1987年被選為SAAProceduralLanguage也可以用在許多非IBM平臺上:
-Tandem,VAX,Amiga-SeveralUNIXversions(includingLinux)-windows(ObjectREXXfromIBM)-NetRexxREXX簡介REXX特點:易學易用性自由的語法格式Eitherinterpretedorcompiled豐富的built-in函數(shù)TypelessvariablesVerystrongparsing好的調(diào)試工具提供和其他語言的接口可擴展性REXX簡介REXX在z/OS上的使用CommandproceduresPersonalprogrammingApplicationinitiationApplicationprototypingApplicationprogrammingCommonmacrolanguageforvariedapplications-ISPFEditmacros,ISPFDialogs,Netview-CICS,DB2,QMF-OthervendorproductsREXX簡介InterpretedversusCompiled解譯器:
-當程序在運行時,翻譯并執(zhí)行每個程序語句編譯器:
-首先將整個程序翻譯成機器語言
-然后通過鏈接-編輯成加載模塊
-然后用戶可以運行該程序REXX簡介一個簡單的REXX程序
/*REXXexectointroduceREXX*/Say“Hello!MynameisREXX.What’syours?”ParsePullnameIfname=‘’ThenSay“You’renotfriendly”ElseSayname“isanicename.”Exit02.Rexx入門學習REXXunderTSOREXXexec可以是一個順序數(shù)據(jù)集或一個PDS成員TSOEXEC命令調(diào)用一個REXX或CLIST程序三種使用EXEC命令的方法:
-Explicitexecution:EXECdatasetparameters-Implicitexecution:membernameparameters-Extendedimplicitexecution:%membernameparameters查找包括:
//SYSEXECDDconcatenationthen//SYSPROCDDconcatenation
用來作為命令行上的成員名.READY%myrexx2472my.dataREXXexecs在TSO下的執(zhí)行:在TSO/E中用EXEC命令運行非編譯的程序。精確運行一個REXX可執(zhí)行程序格式如下:
EXECDSName(數(shù)據(jù)集名字)Parameterexec例如:名為USERID.REXX.EXEC(TIMEGAME)的數(shù)據(jù)集被執(zhí)行,格式如下:完整數(shù)據(jù)集被調(diào)用,數(shù)據(jù)集名要被引號標記,如下:
EXEC‘userid.rexx.exex(timegame)’exec非完整數(shù)據(jù)集被調(diào)用,如下:
EXECrexx.exex(timegame)exec/*eliminatesprefix*/
EXECrexx(timegame)exec/*eliminatesprefixandexec*/通常REXX命令的輸入執(zhí)行可以在ISPF.6對應面板中的COMMAND后面輸入,也可以在READY提示符下面輸入。Rexx中的注釋:注釋以/*開始,以*/結尾.注釋可以嵌套.例:1./*REXXexecsshouldbeginwithacomment*/2.Say“Hello!”/*commentmayfollowinstruction*/3./*commentmayprecedeinstruction*/Say“Hello!”4./*Acommentmaybelong,upto250characters,anditmayspanmultiplelines*/5./*Commentsmay/*Commentsmaybenested*/benested*/繼續(xù)和縮排短指令可以用“;”分開:
a=‘Cat’;b=‘Dog’;c=17長指令可以用“,”分行:
sentence=“Thequickbrownfox”,“jumpsoverthelazydog.”REXX不支持縮排:
Ifa=bThenSay“aandbareequal.”ElseSay“aandbarenotequal.”變量REXX中,變量的命名規(guī)則:
-最多包含250個字符
-可以包含字母,數(shù)字和一些特殊字符(TSO中:@#$!?_.¢).-不能以數(shù)字或.開頭變量不用必須聲明.REXX中的變量是無類型劃分的,所有的數(shù)據(jù)都是字符型數(shù)據(jù).算術運算:運算符:**指數(shù)運算*乘法
/除法
%整除
//取余
+加法
-減法算術優(yōu)先規(guī)則:REXX的通常優(yōu)先級規(guī)則:()圓括號+,-前綴符號**指數(shù)運算符號*,/,%,//乘法和除法+,-加法和減法算術優(yōu)先規(guī)則:例:Say7*3+4Say2**3**2Say7+3*4Say2**(3**2)Say7–3+4Say-5+6Say7+3–4Say-5+6*2Say3**2Say–(5+6)*2Say指令:語法:Sayexpression每個Say指令顯示一行輸出.例:Say“Hello,world.”Say25*(9/3)Say“Theansweris:”num1+num2SaySay‘’Parse指令
語法:ParsesourcevariabletemplateWheresourceistheinputsourceofthedatatobeparsed,andvariabletemplatearetherulesforparsingthatdata,andthevariablestowhichthedatapartswillbeassigned.從鍵盤讀(ParsePull)語法:ParseUpperPullvariabletemplate-or–Pullvariabletemplatevariabletemplate是變量名的列表.
在給模板中的變量賦值前,將輸入數(shù)據(jù)自動轉(zhuǎn)換成大寫形式.例:/*REXXsample*/Say“Pleaseenteryourname:”ParseUpperPullnameSay“Hello”name”.”Say“Enter2numbers:”ParseUpperPullnumanumbSay“Youenteredthesenumbers:”numa“and”numb如果保留輸入數(shù)據(jù)的大小寫形式,則刪除關鍵字Upper:ParsePullvariabletemplate從命令行接收參數(shù)(ParseArg)語法:ParseUpperArgvariabletemplate-or–Argvariabletemplate例:/*REXXsample*/ParseUpperArginparmsSayinparmsParseUpperArgparm1parm2parm3restSayparm1Sayparm2
如果保留輸入數(shù)據(jù)的大小寫形式,則刪除關鍵字Upper:ParseArgvariabletemplateTrace指令:語法:Traceoption有用的選項:-NNormal(default)-OOff-RResults-IIntermediates注:Trace指令通常被用語Rexxexec程序的調(diào)試.跟蹤一個exec也就意味著你希望在exec中的指令被執(zhí)行前Rexx可以在屏幕上顯示出這些指令.3.REXX編程基礎比較關系REXX中的比較關系有時被稱為二進制條件表達試,因為它們總是只有兩種可能結果:True(值為1)和False(值為0).REXX中有兩種類型的比較關系:-字符串比較
-數(shù)值比較字符串比較兩種字符串比較類型:-普通:忽略字符串前后的空格
-嚴格:每個字符必須精確匹配例:answer=“YES“/*assignvariable*/Sayanswer=“YES”/*normalcomparison*/Sayanswer=“yes”/*comparisonsare*//*casesensitive*/Sayanswer==“YES”/*strictcomparison*/Say5==5.0/*strictcomparison*/數(shù)值比較比較符:=equal\=notequal﹁=notequal<>notequal(lessthanorgreaterthan)><notequal(greaterthanorlessthan)<=lessthanorequalto\>lessthanorequalto(notgreaterthan)﹁>lessthanorequalto(notgreaterthan)>=greaterthanorequalto\<greaterthanorequalto(notlessthan)﹁<greaterthanorequalto(notlessthan)<lessthan>greaterthan數(shù)值比較例:num1=31;num2=30Saynum1=num2Saynum1\=num2Saynum1>num2Saynum1<num2If-Then-Else用法:語法:IfcomparisonTheninstruction1Elseinstruction2例:Ifvar1=var2ThenSay“Thevaluesareequal.”ElseSay“Thevaluesarenotequal.”Do-End組在Then或Else后面,多于一條指令時,將這些指令包含在Do和End之間.Ifvar1=var2ThenDoinstruction1instruction2etc…End邏輯操作符比較結果(false是0,True是1)可能和這些操作符結合.操作符是:&與
|或
&&異或
\非邏輯操作符例:var1=1;var2=0Sayvar1&var2/*bothtrue?*/Sayvar1|var2/*eitheronetrue?*/Sayvar1&&var2/*onlyonetrue?*/邏輯表達試例:var1=41;var2=1;var3=0Sayvar1>var2&var3>var2Sayvar1>var2|var3>var2Sayvar1>var2&&var3<var2Sayvar1>(var2|var3)>var2
If-Then-Else嵌套If-Then-Else結構可以被嵌套.例:Iftoken1=“CONCAT”ThenDo..instructions..EndElseIFtoken1=“BLK”|token1=“BLOCK”ThenDo..instructions..EndElseIftoken1=“DATASET”ThenDo..instructions..End選擇結構TEST1TEST2TEST3instruction(s)instruction1instruction2instruction3TRUETRUETRUESelect-When-Then-Otherwise用法Select結構可以代替多I-T-Es.例:SelectWhentoken1=“CONCAT”ThenDo..instructions..EndWhentoken1=“BLK”|token1=“BLOCK”ThenDo..instructions..EndWhentoken1=“DATASET”ThenDo..instructions..EndOtherwiseSay“Error–unrecognizedtoken:”token1End/*ofSelect*/DoWhile循環(huán)語法:DoWhilelogicalexpression..loopinstructions..End例:var1=12DoWhilevar1>6Sayvar1var1=var1–1End/*DoWhile*/TESTProcessFALSETRUEDoUntil循環(huán)語法:DoUntillogicalexpression..loopinstructions..End例:var1=1DoUntilvar1>6Sayvar1var1=var1+1End/*DoUntil*/TESTProcessFALSETRUE控制重復次數(shù)的循環(huán)語法:Docntlvar=initTofinalByincrFormaxloopscntlvar-循環(huán)控制變量名
init-控制變量的初始值
final-控制變量的最大值
incr–循環(huán)變量循環(huán)一次增加的值
maxloops–最大循環(huán)次數(shù)控制重復次數(shù)的循環(huán)例如:Doi=1To100/*theseinstructionswillexecutewhilethevalueofthevariableichangesfrom1to2to3…to100.Thedefaultincrementvalueis1*/EndDoi=1To100By10/*execute10times*/Doi=100To1/*wrong,notbeexecuted*/Doi=100To1By-1/*execute100times*/
控制重復次數(shù)的循環(huán)下列循環(huán)將被執(zhí)行多少次?1.Doi=1…End/*forever*/2.Do5…End/*Do5*/3.DoForever…End/*Forever*/避免可怕的GoTo因為GoTo語句經(jīng)常在程序中產(chǎn)生一些很嚴重的bug,所以REXX提供了一些其他的指令代替它執(zhí)行相應功能,如下:-Leave-Iterate-Return-Exit-SignalReturnandExitwillbothcauseimmediatecessationofthecurrentlyexecutingroutine.Controlisreturnedtothecallingenvironment.LeaveandIterateLeave指令使得REXX終止當前循環(huán):DoForever……Leave…EndIterate指令使得REXX經(jīng)由其余循環(huán)指令并將控制傳遞到End指令:DoForever……Iterate…End如何確定屬于哪個循環(huán)?循環(huán)是可以進行嵌套的.循環(huán)控制變量可以作為循環(huán)的名字用在End,Leave和Iterate指令上.例:Doouter=1…Doinner=1…If…ThenIterateinnerIf…ThenIterateouterIf…ThenLeaveinnerEndinner…Endouter函數(shù)和子程序本節(jié)目標:1.明確什么是函數(shù)和子程序
2.明確函數(shù)和子程序間的不同點
3.Built-in函數(shù)的使用
4.如何寫內(nèi)部函數(shù)和子程序
5.如何寫外部函數(shù)和子程序什么是函數(shù)?向主調(diào)度程序返回一個值的一個程序或routine。返回值是一個單獨串。返回值代替函數(shù)調(diào)用,因此函數(shù)根本不回獨立使用。語法:
functionname(argument1,argument2,…)例:
parm=“Thisistheparameter.”n=Words(parm)4<wordsfunction>函數(shù)類型InternalBuilt-inExternal-TSO/Eexternal-YourownREXXcode-ProgramsinotherlanguagesSearchorder:-Internal-REXXBuilt-in-TSO/EExternal-FunctionPackage-Programsinotherlanguages-ExternalExecsandCLISTSBuilt-in函數(shù)最簡單和最有用的函數(shù)類型:-Stringmanipulation-Comparison-Formatting-Conversion-Binary-Arithmetic-Information-Programdiagnostic字符串操作函數(shù)Thesefunctionsextractportionsofstrings:-Substr(),Strip(),Left(),Right(),Delstr()Thesefunctionsaddtostrings:-Insert(),Center(),Justify(),Overlay()Thesefunctions“find”withstrings:-Pos(),Lastpos(),Verify(),Abbrev()Thesefunctionsmanipulatein“words”:-Word(),Wordindex(),Wordlength(),Wordpos()-Words(),Delword(),Subword()Togetthelengthofastring–Length()Totranslateastring–Translate()Toreversethecharactersinastring–Reverse()Substr()Substr()函數(shù)將一個輸入串分成幾個部分并返回其中的一部分.語法:Substr(input,n),length,padSubstr()例:x=Substr(‘a(chǎn)bcdefg’,3)==>returns‘cdefg’
x=Substr(‘a(chǎn)bcdefg’,3,4)==>returns‘cdef’x=Substr(‘a(chǎn)bcdefg’,3,7,‘!’)==>returns‘cedfg!!’Formatting函數(shù)Center()/Centre()Copies()Format()Justify()Left()Right()Space()Strip()Formatting函數(shù)函數(shù)解釋:NotethatboththeUSEnglishandtheUKEnglishspellingsofCenterareaccepted.Tomakemultiplecopiesofastring,useCopies().Toformatandroundanumber,useFormat().Toaddordeletespacesandothercharactersbetweenwords,useSpace().Toremoveleadingand/ortrailingcharactersfromastring,useStrip().例:x=Left(‘a(chǎn)bcdefg’,4)returns’abcd’x=Right(‘a(chǎn)bcdefg’,4)returns‘defg’x=Left(‘a(chǎn)bcdefg’,10)returns‘a(chǎn)bcdefg’x=Right(‘a(chǎn)bcdefg’,10)returns‘a(chǎn)bcdefg’Conversion函數(shù)字符,十六進制和十進制數(shù)之間的轉(zhuǎn)換
-用于任何比較
C2X(),C2D(),D2C(),D2X(),X2C(),X2D()-二進制和十六進制之間的轉(zhuǎn)換
B2X(),X2B()其他函數(shù)二進制邏輯函數(shù)
-Bitand()-Bitor()-Bitxor()數(shù)值函數(shù)
-Abs(),Min(),Max(),Sign(),Trunc(),Format()-Random()-Digits(),Form(),Fuzz()信息函數(shù)常規(guī)信息函數(shù):-Date(),Time(),Userid()系統(tǒng)程序信息函數(shù):-SYSVAR(),MVSVAR(),SYSCPUS()程序診斷函數(shù):-Sourceline(),Errortext(),Condition()終端寬度:-Linesize()子程序子程序與函數(shù)的區(qū)別:1.Functionmustreturnavaluesubroutinemayormaynot2.Valuereturnedfromfunctionreplacesfunctioncall,valuereturnedfromsubroutinepassedtoREXXspecialvariable‘result’3.Functioninvokedwithfunctioncall–funcname(args)4.SubroutineinvokedwiththeCallinstructionCall指令語法:CALLsubrtnarguments所有的函數(shù)都可以被作為子程序調(diào)用.為什么要用函數(shù)和子程序?結構化程序所必須的將程序分為多個模塊代碼的重復利用函數(shù)和子程序可以是內(nèi)部或外部的4.程序調(diào)試和錯誤處理程序目標:-可靠性
-能處理不可預測事件
-給用戶發(fā)送有意義的錯誤信息
-錯誤返回非零值
-易維護性易維護性包括好的注釋大多數(shù)可執(zhí)行程序還包括:-包含修改歷史的文檔
-主程序
-子程序
-錯誤恢復程序使用有意義的變量名采用一致的設計方法形成一種編碼風格Signal指令CauseunusualtransferofcontrolUsedtotraperrorconditionsDestroyscontrolstructures-Do–End,If,SelectFivesignaltraps:-Error-uninitializedvariablehasbeenused-Failure–non-zeroreturncodefromhostcommand-Halt–negativereturncodefromhostcommand-Novalue–externalattempttointerruptexec:PA1,thenHI-Syntax–syntaxerrorsandrun-timeerrorsSignal指令Toturnthetrapon,theinstructionis:SignalOntrapnameToturnthetrapoff,theinstructionis:SignalOfftrapnameForexample:AlmosteveryexecshouldincludeSignalonNovalueAtornearthebeginningoftheprogram.返回值的規(guī)定0=complete,unambiguoussuccess4=verylikelysuccessful,butwarning8=probablefailure,butthesystemisstillworking12=certainfailure16=worsethan1220=fundamentalsystemenvironmenterrorThehigherthenumber,theworsetheerror.Diagnostic函數(shù)Sourceline()-Returnsnumberoflinesofcode,oractuallineofsourcecodeCondition()-Returnsinformationdependingononeoffourarguments(C(condition),D(descriptive),I(instruction)andS(status))Errortext()-ReturntextofREXXerrormessageassociatedwithargumentnumberREXXspecialvariablesigl-Assignedwithlinenumberwhereconditiontraperroroccurred測試測試的數(shù)量取決于可能的最終用戶規(guī)模開始用少量數(shù)據(jù)測試測試代碼的所有部分從錯誤中測試可恢復性UseREXXaidstoconfirmtheprogramflow-TraceinstructionTrace指令REXXTrace指令-有用的選項:TraceR–“Results”–mostusefulTraceN–“Normal”–tracesnegativereturncodesTraceO–“Off”–turnstracingoffTraceI–Intermediates–mostinformation其它Trace選項:-A,C,E,F,L,S,?,!,+n,-nTrace-不修改代碼
-TSO命令EXECUTILTS–運行可執(zhí)行程序之前REXXTrace()函數(shù):-trace_actions_in_effect=Trace()
交互式調(diào)試Trace?在每個指令處停止:-Pressentertocontinue-type“=”tore-executelastclause-typeanythingelse–likeREXXTRY–processlineimmediatelyTracen–skipnpause(nisawholenumber)其他調(diào)試工具Attentionmode(PA1)immediatecommands-HE–haltexecution-HI–haltinte
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年其他計算機信息服務項目申請報告模稿
- 2025年多孔微孔陶瓷材料項目規(guī)劃申請報告模板
- 2025年企業(yè)高校實習生三方協(xié)議
- 2025年人才共享協(xié)議標準化文本
- 2025年合作共管協(xié)議示范文本
- 2025年借款合同范本速覽
- 2025年個人公積金貸款合同調(diào)整全覽
- 2025年專利權使用和解協(xié)議指南
- 2025年養(yǎng)老院入住協(xié)議標準
- 2025年供電設施更新改造協(xié)議
- 關于餐飲合同范本
- 2023高考數(shù)學藝考生一輪復習講義(學生版)
- CHT 4019-2016 城市政務電子地圖技術規(guī)范(正式版)
- 廣西壯族自治區(qū)南寧市2024年七年級下學期語文期末試卷附答案
- 冀教版五年級數(shù)學下冊全冊課件【完整版】
- 微量注射泵安全使用和維護保養(yǎng)
- 高二物理人教版(2019)選擇性必修第一冊教學設計
- 《短視頻拍攝與制作》課件-2短視頻前期創(chuàng)意
- 污水處理廠運營維護移交 投標方案(技術方案)
- 部編版歷史八年級上冊 第八單元 教學設計
- 高中英語元宵節(jié)猜燈謎活動英文課件
評論
0/150
提交評論