欢迎来到天天文库
浏览记录
ID:23141638
大小:298.69 KB
页数:63页
时间:2018-11-04
《rpgiv程序员面试初级题288》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、RPG/V程序员面试初级题288⑴Howdo■trimleadingzeroes?Istherea巳IFtotrimleading0'soffofanumericfieldANDreducethefieldsizeaccordingly?i.e.afieldwithavalueof0000123451wanttoprint:’’value:12345”insteadof’value:000012345”orHvalue:12345”Answer:Useacombinationof%editand%trim.The%edit
2、BIFwilledityournumberanywayyouwish:suppressleadingzeroes,addcommas,etc.Theo/otrimBIFwillstriptheblanksoffthefront.Typicaluseforthisistoinsertanumericamountintoamessage,like"Yourbalanceis$25.00”(2)%sizegivesmeacompiletimeerroronmyDspecs%sizedoesn’tacceptanexpressio
3、ninDspecs;Try%leninstead.(3)%trimisveryslow,Ididaquickietestofthisonmyheavilyloaded62CL5000loopsofo/otrim(String).’’String”containstheliteral’’A”:Answer:If’’String’’isdeclared20byteslong,ittakes01.Tryvariablelengthfieldsforyourstringmanipulationchores.(4)Howcan■ri
4、ghtjustifyafield?Answer:ForV4R4andabove:CEvalroutput=%trimr(input)Forearlierreleases:CEvaloutput=%subst(FLDBLANKS:1:%len(input)-%len(%trimr(input)))+Inputdlenwhere"input"and”FLDBLANKS”areequallengthcharacterfields.(2)Howcan■centreafield?Basically,takehalfthelength
5、oftheoutputfield,subtracthalfthelengthofthetrimmedinputfield,putthatmanyblanksatthefrontoftheoutputfieldandaddtheinputfield.Watchoutforoutputsizelessthaninputsizeandblankinput!dinput24inz(.1234567890*)doutput40inzdBLANKSslike(output)inz10i0evallen=(%len(output)/2)
6、-%len(%trimr(input))/2iflen4-%len(%trimr(input))<=%len(output)evaloutput=%subst(BLANKS:1:len)+inputelseevaloutput=inputendif(3)Does%lencountthenullinanullterminatedstring?Answer:No.(4)IgetRNX0112whenIuseL(date)datatypeswithCAnninmydisplayfile.IfyouuseCAnninsteadof
7、CFnn,thiswillhappenbecauseofthewaytheI/ObufferisvaliditycheckedbytheRPGruntime.WhentheuserusesaCFkey/ENTER/etc.thecurrentdisplayvaluesaremovedtothisWBandverified.Don’tuseCAkeysorDon'tusefunctionssuchasVALUES,RANGE,CHECK(VN),etc.AsDatevaliditycheckingisdoneinthesam
8、emannerastheseotherDDSkeywords(thatis,inWSDMandnottheworkstationcontroller)itfallsintothesameclassification.(2)ErrorhandlingI’musingthe*PSSRandwanttoret
此文档下载收益归作者所有