您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 招聘面试 > RPGIV 程序员面试初级题288
RPGIV程序员面试初级题288(1)HowdoItrimleadingzeroes?IsthereaBIFtotrimleading0'soffofanumericfieldANDreducethefieldsizeaccordingly?i.e.afieldwithavalueof000012345Iwanttoprint:value:12345insteadofvalue:000012345orvalue:12345Answer:Useacombinationof%editand%trim.The%editBIFwilledityournumberanywayyouwish:suppressleadingzeroes,addcommas,etc.The%trimBIFwillstriptheblanksoffthefront.Typicaluseforthisistoinsertanumericamountintoamessage,likeYourbalanceis$25.00(2)%sizegivesmeacompiletimeerroronmyDspecs%sizedoesn'tacceptanexpressioninDspecs;Try%leninstead.(3)%trimisveryslow,Ididaquickietestofthisonmyheavilyloaded620.5000loopsof%trim(String).StringcontainstheliteralA:Answer:IfStringisdeclared20byteslong,ittakes01.Tryvariablelengthfieldsforyourstringmanipulationchores.(4)HowcanIrightjustifyafield?Answer:ForV4R4andabove:CEvalroutput=%trimr(input)Forearlierreleases:CEvaloutput=%subst(FLDBLANKS:1:%len(input)-%len(%trimr(input)))+InputwhereinputandFLDBLANKSareequallengthcharacterfields.(5)HowcanIcentreafield?Basically,takehalfthelengthoftheoutputfield,subtracthalfthelengthofthetrimmedinputfield,putthatmanyblanksatthefrontoftheoutputfieldandaddtheinputfield.Watchoutforoutputsizelessthaninputsizeandblankinput!dinputs24inz('1234567890')doutputs40inzdBLANKSslike(output)inzdlens10i0cevallen=(%len(output)/2)–%len(%trimr(input))/2ciflen+%len(%trimr(input))=%len(output)cevaloutput=%subst(BLANKS:1:len)+inputcelsecevaloutput=inputcendif(6)Does%lencountthenullinanullterminatedstring?Answer:No.(7)IgetRNX0112whenIuseL(date)datatypeswithCAnninmydisplayfile.IfyouuseCAnninsteadofCFnn,thiswillhappenbecauseofthewaytheI/ObufferisvaliditycheckedbytheRPGruntime.WhentheuserusesaCFkey/ENTER/etc.thecurrentdisplayvaluesaremovedtothisWBandverified.Don'tuseCAkeysorDon'tusefunctionssuchasVALUES,RANGE,CHECK(VN),etc.AsDatevaliditycheckingisdoneinthesamemannerastheseotherDDSkeywords(thatis,inWSDMandnottheworkstationcontroller)itfallsintothesameclassification.(8)ErrorhandlingI'musingthe*PSSRandwanttoreturntothelineofcodefollowingtheoneinerror.HowdoIdothat?Answer:Youcan'tdirectlyGOTOthelineaftertheerroroccurred.Basically,you'llneedtosetaflagtoindicatewhereyouare,thenyour*PSSRdoesanENDSR*DETC.Nowthatyou'reatthetopofthedetailcalcs,youcheckyourflagandGOTOthespotaftertheerror(9)APIsCanIuseRPGtoreadandwritetotheIFS?IFSprototypeheader/COPYIFSAPIexamples(10)WhatdoesBINARY4mean?SeveralIBMAPIdocumentsrefertobinary4.Whatexactlydoesthatmean?BINARY(4)meansa4-bytebinarynumber.InRPGIII,thismeansasubfieldofadatastructurethatisdefinedwith4bytes,andhasthe'B'type.InRPGIV,therearetwokindsof4-bytebinarynumber:the10-digitintegerorthe9-digitbinary.(11)HowcanIgetalistofjobsforauser?QUSCRTUS-CreateuserspaceQUSLJOB-ListuserjobsintouserspaceQUSRTVUS-RetrievedatafromuserspaceQCMDEXEC-ExecuteOS/400commandQUSDLTUS-DeleteuserspaceTheprogramgetsalistofjobsforthecurrentuseratstatus*JOBQandputsthelistinauserspace.Itthenbuildsanarrayofjobsthatcanbereadilymanipulated.ThisexampleperformsanENDJOBcommandoneachone.(12)HowcanIpositionthecursorinadisplayfilewithoutusingupanindicator?UsetheCSRLOCDDSkeyword,andyoucanpositionexactlybyrowandcolumn.Answer:HowcanIhighlightafieldinadisplayfilewithoutusingupanindicator?UseDSPATRwithaprogramtosystemfield.HereareDDSandRPGIVexamples.Youcan'tsetPositionCursor,unfortunately.(13)DebuggingHowcanIdebugILEprograms?Submityourprogramtobatch.ThejobMUSTbeheld.Youcaneitherholdthejobqueue(HLDJOBQ)orholdtheindividualjob(HLDJOB)orspecifyHOLD(*YES)ontheSBMJOBcommand.WRKSBMJOB/WRKUSRJOB/WRKACTJOBandfindyoursubmittedjob.NotethattheSBMJOBcommandgivesyouaninformationalmessagewiththejobname/number.Whatyouneedisthejobname,userIDandjobnumber-thefullyqualifiedjobname.Example:123456/BUCK/MONTHENDSTRSRVJOBontheheldbatchjob.STRDBGonyourprogram.SpecifyUPDPROD(*YES)ifneeded.You'llseethesourcelistingifyoucompiledwithDBGVIEW(*LIST)or*SOURCE.PressF12toexit-youcannotsetabreakpointyet.ReleasethejobsothatitbecomesSTATUS(*ACTIVE).You'llseeadisplayaskingifyouwanttodebugorcontinue.PressF10todebug.DSPMODSRCtoseethesourcelistingagain.Alternately,pressF10tostepintothefirstinstruction.Nowyoucanaddyourbreakpoints.PressF3untilyou'rebacktothedebugorcontinuedisplay.PressEntertoruntheprogramwithyourbreakpointsset.Whenyou'redone,doanENDDBGandENDSRVJOB.(14)HowcanIdebugOPMprograms?Ifyou'rewillingtousetheoldOPMdebugger,youcanusetheILEstepsoutlinedabove.compilingtheprogramwithOPTION(*SRCDEBUG)andthenusingSTRDBGOPMSRC(*YES),whichshouldworkwiththestepsgivenabove.STRISDBwon'tworkunlessthejobisrunning,soyoucan'tputitonholdandenteryourbreakpoints.(15)Whyisgarbageinmy*ENTRYparameters?Thisisundoubtedlyaresultofamis-matchbetweenthedefinitionoftheparametersbetweenthecallerandthecalledprogram.Veryoften,thismis-matchisunwittinglycausedbycallingaprogramfromacommandline(orSBMJOB).(16)Howmanyterminalscanbeconnectedtoaport?Answer:7terminals(17)WhatdothetermsCUAandSAAstandfor?CommonUserAccessSystemsApplicationArchitecture(18)WhatarethecommunicationprotocolssupportedbyAS/400?APPC(AdvancedProgramtoProgramCommunication)BSCEL(Binary
本文标题:RPGIV 程序员面试初级题288
链接地址:https://www.777doc.com/doc-4819331 .html