IBM AS/400 manual Sample Service Program, Api

Page 118

Sample Service Program

Sample Service Program

The following example shows how to create a service program CVTTOHEX whi converts character strings to their hexadecimal equivalent. Two paramete passed to the service program:

1. a character field (InString) to be converted

2.a character field (HexString) which will contain the 2-byte hexade alent

The field

HexString is used to contain

the

result

of

the

conversion

an

cate

the

length

of

the

string

to

be

converted. For example, if

a

ch

30 characters is passed, but

you

are only

interested

in

converting

th

would

pass

a

second

parameter

of 20 bytes (2 times

10). Based on t

the passed fields, the service program determines

the

length

to

handle

Figure 42

on

page 95

shows

the

source

for the service

program.

Figure

page 97

shows

the

/COPY member

containing

the

prototype

for

CvtToHex.

 

The basic logic of the procedure contained within the service program below:

1.Operational descriptors are used to determine the length of the eters.

2.The length to be converted is determined: it is the lesser of th

character string, or one-half the length of the hex string field.

3.Each character in the string is converted to a two-byte hexadeci using the subroutine GetHex.

Note

that GetHex

is coded

as

a subroutine rather than a subproce

to improve run-time performance.

An EXSR operation runs much faster tha

bound

call, and

in

this

example,

GetHex is called many times.

4. The

procedure

returns

to

its

caller.

The service program makes use of operational descriptors, which is an struct used when the precise nature of a passed parameter is not kn time, in this case the length. The operational descriptors are create

procedure

when

you

specify

the

operation

extender

(D)

on the

CALLB

o

when

OPDESC

is

specified

on

the

prototype.

 

 

 

 

 

 

To use the

operational

descriptors, the service program

must

call

the

 

API,

CEEDOD

(Retrieve Operational Descriptor). This API

requires certain

ters

which

must

be

defined for the CALLB

operation.

However,

it

is

t

eter which provides the information needed, namely, the length. For more information on operational descriptors, see “Using Operational Descriptors page 138.

94 ILE RPG for AS/400 Programmer's Guide

Image 118
Contents ÉÂÔ Page ÉÂÔ Third Edition May 1999 Contents SQL WithService Program ChapterVi ILE ExceptionWorking with Files and Devices ViiRPG FilesAppendixes ILECopy IndexAny DoesApply LawMarks Trademarks and ServiceProgramming Interface Information Trademarks Or se Marks OthersPage Xiv ILE RPG for AS/400 Programmers Guide Who Should Use This About This GuideGuide IIIHow to Send Your Comments Prerequisite and Related InformationUCS-2 What New ThisRelease? RiscINZ*EXTDFT INZ*USERElement CCSID*GRAPH Since To this GuideChanges For AS/400Xxii ILE RPG for AS/400 Programmers Guide ILE RPG Introduction Program creation strategiesILE RPG for AS/400 Programmers Guide Input Specifications RPG IV SpecificationsControl Specifications RPG IV OverviewThe.When You Let Compiler Provide Logic For Your Cycle ProgrammingFirst Subprocedure logicIndicators LastExample of an ILE RPG Operation CodesProgram Example of an ILE RPG ProgramProgram File Description SpecificationsSecond file Chain Output SpecificationsBonus EvalILE RPG SubprocedureHeading Lines That Contain Constant String Payroll NotReturn Entire Source ProgramFqsysprt Printer 10U 0 Value RateBonus PAY Not *IN99 EvalOS/400 System Commonly Used Control Language CommandsInteracting with the System System LibrarySystem Offers Full Set Tools That You May find usef Application Development ManagerAS/400 Tools ServicesILE R Overview of the RPG IV Programming15 Language AS/400 Tools RPG Programming in ILE RPG Programming in ILEProgram Creation ILE RPG, ILE C, ILE CoboCRTSRVPGM, and Crtpgm commands. They can also Specified Language You can CreateProgram Call Procedure Followed Zero Or more subproceduresProgram Management ILEBindable APIs Source DebuggingWhile the progra AS/400 now supports multithreading. ILE Accesses Are Also ThreadsafeMultithreaded Applications Does Not DirectlyRPG Programming in ILE Method Program Creation StrategiesStrategy 1 OPM-Compatible Application OPM-Compatible ApplicationExample of OPM-Compatible Program Effect of ILERelated Information ILE Program Using CrtbndrpgStrategy 2 ILE Program XYZ ILE Program Using Crtbndrpg Example of ILE ProgramShows Run-time view Application in which an ILE CL pr Calls Although Actual Storage Not Deleted As itUsing ILE Application Using CrtrpgmodStrategy 3 ILE Application Scenario Single-Language ILE ApplicationSingle-Language Application Using Crtrpgmod and Crtpgm Mixed-Language ILE Application ScenarioAdvanced Application Scenario Strategy to Avoid Strategy to AvoidActivation Group Procedures Creating an Application Using Multiple ProceduresMultiple Procedures Module OverviewLike with Multiple Dures Prototyped CallsWhat a module might ModuleNumToChar Using prototyped calls you can call with the same syntaxFmtCust Name 100A Address Numparm 30P 0 ValueMade Expression Shows Call Example of Module withOrder to format Name Address Properly MultipleISO Move Example of Module with Multiple ProceduresDDS ElseProcedures STATE, ZIP ThatZIP Module, by Coding ModuleMeaning that it consists only of subprocedur Keyword on the control specificatiEntire Arrsrpt Program Fcustfile Disk Fcustrpt PrinterCallp Copy QRPGLE,CVTPROCPIcustrec EndsrISO Move Duedate Following AboutArrsrpt Return Else EndifDDS General Considerations When Coding Module with multiple procedures You Will WantCoding Considerations Coding ConsiderationsContain a program entry procedure and only a Main Procedure ConsiderationsSubprocedure Considerations Cannot Contain Bound Procedure CallsFor Further Information Main ProceduresSubprocedures ForPrototyped Call For Further InformationApplication Running anILE RPG for AS/400 Programmers Guide Source StatementsFile Creating a LibraryUsing SEU Using the Source Entry UtilityEntry Utility IPP IPCIpcx IpprPress F3 Exit To the Exit display. Type Y Yes to save SavedStatements Calculation specification Start Your Using SQL StatementsUsing SQL Statements DB2 UDBUtilitymanual for Information about How SEU handles Reference for moreRefer toADTS thefor AS/400 Source Entry Statement Syntax CheckingUsing the Crtbndrpg Command CommandWith You can use the Crtbndrpg Command interactively Batch From Shows Their Default ValuesList Debugged Using a Source View Program TypeCreating a Program for Source Debugging Creates View similar Compiler listingThis example you create Program BindingCreating a Program with Static Display Module Source¹ Wrkjob CommandBnddir ¹ Wrkoutq queue-namePayroll Register Date Disk Fqsysprt PrinterChain Emprec Not *IN99 Empname EmprateListing Using a Compiler ListingUsing a Compiler Listing Obtaining a CompilerCompiler Listing Customizing a Compiler ListingCustomizing a Page Heading XrefIndenting Structured Operations Last UpdateCustomizing the Spacing PAGE/LINEEither Create ErrorsListing This Will Add Sec Level text to the messages listed MessageFLD1 Using In-Line Diagnostic MessagesFLD2 SEUBrowsing a Compiler Listing Using SEU Correcting Run-time ErrorsUsing Additional-Diagnostic Messages Source Entry UtilityCoordinating Listing Options with Debug View Options Using a Compiler Listing for MaintenanceExpdds these are the defaults Specified, and in the column labeled as Sta MentArea DataAccessing the Returncode Data Area Accessing the Returncode Data Area Module Object CommandsCreating ChapterUsing the Crtrpgmod CommandYou Create a Module using the Create Creates a compiler listing which Creating a Nomain ModuleRequested Crtrpgmod MODULEMYLIB/TRANSSVC SRCFILEMYLIB/QRPGLESRCFiles ¹ DspjobThen Select option Display4 spooled Related Files N/A Related Source TransrptEndsl Return OtherEndsl Prod Creating a Module forPrototype for TransInc Prototype for ProdNameItrnsrec Ftrnsdta Disk Fqsysprt PrinterQTY Additional Examples Related CL CommandsRPG, mainthe procedureis ModulesBinding Modules into a Program Binding Modules into a ProgramBinder Into a UsingCommand CrtclmodGroup Modules ExportConcepts for TrptUsing a Binder Listing Using a Binder ListingChanging a Module or Program Changing a Module orUsing the Updpgm Command LevelSize Removing ObservabilityReducing an Objects Changing a Changing a Module or Program Service Program Overview Creating a Service Program Service Program Overview Dspsrvpgm Payroll DETAIL*PROCEXP *DATAEXPCreating a Service Program Strategies for Creating Service ProgramsCreating a Service Program Using Crtsrvpgm Using CrtsrvpgmChanging a Service Program Service Program Using CrtsrvpgmSample Service Program Sample Service ProgramAPI OPTIONS*VARSIZE OpdescConst OPTIONS*VARSIZE CeedodBegsr Eval ExsrEnddo DIV MVRStrpgmexp Signaturecvthex Export Symbolcvttohex Endpgmexp Creating the Service ProgramParameters Crtsrvpgm command Input String Charactern Output Hex string Character2 * nCrtrpgmod MODULEMYLIB/CVTHEXPGM SRCFILEMYLIB/QRPGLESRC Binding to a ProgramCreate the program by typing Call CvthexpgmExcept Copy RPGGUIDE/QRPGLE,CVTHEXPRClear Callp ClearUpdating the Service Sample Binder ListingBasic Binder listing for Cvthexpgm Sample Service Program Running a Program Running a Program Using the CL Call CommandRunning a Program Using 103Passing Parameters using 106 shows DDS That is Referenced by the EMPRPT2 Source Running a Program From a ApplicationRunning a Program From a Menu-Driven Application Selecting Option Design menusRpginq You Run Menu by EnteringRPGCHG, or Rpgadd respectively Replying to Run-Time Inquiry Messages CommandRunning a Program Using User-Created Replying to Run-Time InquiryManaging Activation Ending an ILE ProgramGroups Wheresequence-noGroup Managing Activation GroupsSpecifying an Activation OFFRunning in the OPM DefaultCompatibility ActivationGroup Reclaim Resources CommandDeleting an Activation Activation Groups SuchManaging the Default Heap Using RPG Operations Referenceto AbridgedINZ*NULL Managing Dynamically-Allocated StorageDsply Alloc AddName 40AElem@ = next@ = *NULL Namelen = %len%trimrnameNull DOW Heap Storage Problems DeallocBindable APIs RPG procedure ThisManaging Your Own Heap Call SomepgmSeeAPI theReference DynarrayCeegtst Copy DynarriCeecrhp Initalloc SubsallocADD Initalloc ResetDynainit Enddo DynainitExsr Realloc Endif Eval Dynaset ExportIfgt Realloc BegsrDynaget Export Else ADD SubsallocEnddo Endsr Dynaset IfleGet Heap Storage CrtsrvpgmProgram/Procedure Call Overview Calling Programs and ProceduresProgram/Procedure Call Overview 127Calling Programs Calling ProceduresStatic Call stack Call StackStack Recursive calls are only allowed For Recursive CallsThat Most r Stack Entry is Bottom Parameter-Passing Considerations Recent CallerProgram/Procedure Call Overview RPG Prototyped calls Are also Known Using the Callp Operation¹ Subprocedures in the same module Callp31A Using a Prototyped CallCalling within an Expression 30PParameter Passing Styles Examples of Free-Form CallPassing Prototyped Parameters Passing by ReferencePassing by Value Figures belowDocalc Export PassingExtprocdocalc DocalcILE CEE API Using Operational DescriptorsCeetsta Extprocceetsta OPTIONS*OMIT When Calling Procedure You may sometimes want Leave Out ParOmitting Parameters OmitOPTIONS*OMIT*NOPASS Passing *OMITLeaving Out Parameters API QcmdexcPassing Prototyped Parameters Checking for the Number PsdsEval Address = %TRIMRCSTREET# + + Copy FmtaddrpOPTIONS*NOPASS Const Trimrprovince ReturnCheck Begsr MovelEndif Endsr Ctdata 144OPTIONS*NOPASS 5P 0 DIM2 CtdataParameters To create PRTADDR, using the source in on page 144, typPassing Less Data Than Required To create the program, PRTADDR, typeInterlanguage Calls Order of EvaluationEffect To obtain Actual Returned value InterlanguageCalling Considerations DCL &RET2 TYPE*CHAR LEN2 DCL &RET1 TYPE*CHAR LEN1Call Operations Fixed-FormFor Callb only Using the Fixed-Form Call OperationsOperation Operation extender is Used With Operations Passing Parameters Using ParmExamples of Call and Callb OperationFixed-Form Call Operations Using the Plist OperationPlist Normal End Returning from a Main ProcedureProcedure Returning from a CalledAbnormal End Returning from a Called Program or ProcedureEntry Parm operation is perfor For the AS/400 Reference Returning from a SubprocedureWithout RetuSubprocedure ends abnormally Using Bindable APIsReturning using ILE Bindable APIsCalling a Graphics Routine Examples of Using Bindable APIsCalling a Graphics Routine CeeutxMultithreading Considerations Calling Special RoutinesMultithreading Considerations TheGDDM Programming GuideAcross How toShare Data How Example, consider the situation where two procedures CalledWill Wait For MOD1 Unlock. Procedures Not To Avoid DeadlockMOD2 ConsiderationsPROC1 MOD1Debugging and Exception Handling 161ILE RPG for AS/400 Programmers Guide ILE Source Debugger Debugging ProgramsILE Source Debugger 163Equate Debug CommandsAttr EvalWatch TbreakThread FindPreparing a Program for Order Debug it usingPreparing a Program for Debugging SourceCrtbndrpg PGMMYLIB/DEBUGEX SRCFILEMYLIB/QRPGLESRC Creating a Root Source ViewOptions On the Dbgview parameter for Either Crtrpgmod MODULEMYLIB/DBGEX SRCFILEMYLIB/QRPGLESRCDbgview Listing ViewView ModuleView Program for DebuggingStarting the ILE Source Debugger Starting the ILE SourceOPMSRC*NO Start a Debug Session for the sample debug program Debugex Setting Debug OptionsStrdbg Example IntoSET OPM source debug support field,Adding/Removing Programs from a Debug Session Example of Adding a ServiceExample of Removing ILE Programs from a Debug Session Debug SessionCobol Viewing the Program SourceViewing the Program Source Lstdbg ILEDbgex Viewing a DifferentLibl PGM Several Different views Changing the View of aModule CprocSpecified You Not Erate Breakpoints Specify Setting and Removing BreakpointsSetting and Removing Breakpoints OPTION*NODEBUGIODebug Command to set a job breakpoint Setting and RemovingWith the source positioned at the line where the breakpoint BreakpointsJob Setting anBreakpoint Debug Setting and Removing Unconditional Thread BreakpointsDebug Command Sets a Thread breakpo Single Current Greater Than Equal To oneJob BreakpointsConditional Breakpoint Example of Setting a Conditional Job Breakpoint Using F13Line Work with Module BreakpointsBreak 128 when BigDate=1994-09-30 CommandSetting a Conditional Job Breakpoint Using National Language Sort Sequence NlssControl Spec Tion Is not available Sort SequenceMain procedure or one of the subprocedures On the debug command lineOne procedure per module,procedurethe -namecan Either VariaSet Breakpoint For Module with This Example Statement View Is used to Set Breakpoint ForSet a breakpoint for Module With Listing, typeProcedurevariables-name and statement-number Setting and Removing Conditional Thread BreakpointsUsing the Work with Module Breakpoints Display Main Procedure ExitRemoving All Job Debug CommandsSetting and Removing Watch Conditions ConditionsProgram statemen Characteristics of WatchesDisplay You Debug One Job From AnotherWatch Setting Watch ConditionsOn the debug command line, without any parameters SalaryPayroll ABC PGM ¹ To specify a variable or expression to be watched, typePayroll Enddbg Displaying Active WatchesRemoving Watch Conditions IPLBlankDisplay Module Source Example of Setting a Watch ConditionExample of Setting a Watch Condition Display as shown below. InsteadStepping Through the Program Object ObjectStepping Through Stepping Over Call Statements Over Into SubproceduresSubroutines You Can Step Into Stepping Into Call StatementsTIP From Program F22This example, you use F22 Step Into to step Into the OPM DebugexInputParm This example, you use F22 Step Into to Subpr Which ModuleStep completed at line Displaying Data and Expressions SwitchElse On page 201 shows Use ConstBased Fields Unexpected Results when Evaluating VariablesScalar Fields RPG Definition Date, Time, Timestamp FieldsDisplaying the Contents of an Array Displaying the Contents of a TableDisplaying Data Structures Eval DS12Displaying Indicators Which is discussed BelowDisplaying Fields as Hexadecimal Values Character FormatBy Pointers DataDisplaying Variable-Length Fields Displaying Null-Capable FieldsSTRING=%SUBSTRBIGDATE 1 4 = String = 1ABCD6Fields Changing the Value of Fields = AbcdefDisplaying Attributes of a Field Or CommandEquating a Name with a Field, Expression, or Command Equating a Name withSample Source for Debug Examples ForExamples To create the program DEBUGEX, type Program using Source 215, typeSample Source for Debug Examples First ModuleInzabcde DIM3 CtdataDS1 DS2Plist Parm Occur DS2 MoveCall Rpgpgm Entry Plist Parm Dump SetonElse Eval Dsply SetonSource for C Procedure cproc. cproc is called by Dbgex Exception Handling Overview Handling ExceptionsException Handling Overview 217Describes Status Work Being done by a program Indicates That Severe error has been detectedProgram Procedure P1 is Contro Boundary Call stException Message Active onILE RPG Exception Handling Dure will Only Handle Errors That SubprocedureException Handling within Operation For OPM PGM CException Handler Priority Using Exception HandlersUsing Exception Handlers Nested ExceptionsPGM2 For other Types MessagesEscape Message PRC1PGM1 Example of Unhandled Function CheckOperation as well PGM2, each Containing a procedurFor More Information Optimization See Changing Level Using RPG-Specific HandlersOptimization Considerations Built-in-functionsExtender This Section Provides Some Examples How to Use Each These RInfsr error Subroutines, on Exsr Operation Code Infds ILE RPG For AS/400 Reference providesOperation. If Either Using an Error SubroutineProgram Error Explicitly cUsing a File Error Infsr Subroutine PrdInfds PrdStatus INFSRPrdInfsr INFDSPrdInfdsDisk Ftrnbacklg O Fprint Printer StatusInfds After Keyword Using a Program Error SubroutinePosition Definition Specification Enter Operation With Factor EntryPssr Begsr ParmsProc Body of Code Goes Here Move GetinTAG DIV If this is a divide-by-zero error, add 1 to the divisorIf control reaches ENDSR, the procedure will fail Try again Err =Which is designed to ge Exceptions Order Show how to avoid looping WithinPssr SubrouMove Inlr After the ElseElse ADD Specifying a Return Point OFLILE Condition Handlers Using a Condition HandlerILE Condition Handlers HandlersLIKECondTok 132Printer Rpghdlr Action 10I OutCondTok LIKECondTokCondition Handler Shows Source For ProcedureIs registered Procedure Parameters Include Pointer Communication Area Which Contains PointerARR1 CeehdluSDS Noopt ProcptrNoopt ProcSubst Begsr CallpCeertx Cancel Handlers244 Ceeutx ILESubproc Pssrdsply Procedure to SubProc will not failPssr has a Return operation, so the call from the main Return EndsrParm Omit INZ0 StaticCallb Ceertx Parm Select WhenCancel Hdlr Dsply Msg CanHdlr RPG usingCondition Handlers Enabled Using Likely Occur WithCondition Handler that Ignores CPF4906 Endif ReturnHandle information or warning messages, otherwise percolate MsgSev = WarningILE RPG for AS/400 Programmers Guide Obtaining a Dump Using the Dump Operation CodeUsing the Dump Operation Code Obtaining an ILE RPG Formatted Dump¹ If a Dump operation is bypassed By a Goto operation, Formatted DumpDoes not Occur Dump Example of a Formatted Dump QsplAgement DumpPart 1 of 2. Data section of Formatted Dump 125 Part Data section of Formatted Dump Beginning of user variables, listed in alphabetical order, Order Which they are defined GapsWorking with Files and Devices 259ILE RPG for AS/400 Programmers Guide Associating Files with Input/Output Devices Defining FilesAssociating Files with Input/Output Devices 261Operation Code is Valid Only Compilation Time CertainOperation Device Dependent Device dependency Is that WriteTypes of File Descriptions Naming FilesTypes of File Descriptions Files Using Files withProgram-Described Example of Some Typical Relationships betweenDefining Externally Described Defining Externally Described FilesOPTION*EXPDDS Renaming Field Names Renaming Record-Format NamesIgnoring Record Formats Nbrofcharreplaced. FigureDescription Using Input SpecificationsModify an ExternalFiles You Then Fixed Name Specification Will Get ErrorIndicator Record Used Program This Example FieldUsing Output Specifications Is written Level CheckingFor Character Fields zero ALLRPG I/O Operations Defining Program-Described FilesData Management Operations and ILE RPG I/O Operations SEQ SpecialData Management Operations and ILE RPG I/O Operations DeleteOverriding and Redirecting File Input and Output File ConsiderationsOverriding and Redirecting File Input and Output 273Example of Redirecting Input OutputInput Output FMT1Data Management manual File LockingFile Locking Program Can Chang Allocate ObjectRecord Locking Record LockingSharing an Open Data See UsingPath Control For More InformationProgram Details System Open Options Allowed for Each SpoolingSpooling Can SpecifyOutput Spooling Program VersusSRTSEQ/ALTSEQ Physical Files and Logical Files AccessingDatabase Files Data Files and SourceAccess Path Using Externally Described Disk FilesRecord Format Specifications Using Externally Described Disk FilesUnique Contained Physical file CUSMSTP, which is IdentifiedUnique Cust Checkmf Dstref Distribution Application Field ReferenceBasdat Edtcdey Addr ReffldnameCity Valid Keys for a Record FileDisk EdtcdejPartial Key ArgumentsReferring to Record Blocking and Unblocking Used,Indexed File Using Program-Described Disk FilesUsing Program-Described Disk Files ValidKeyword specifies position 15 as the starting po Logical file ORDDTLL. For the two fields10AIDISK Sequential FileRecord Address File Move Order KEY ChainRelative Record Numbers Methods for Processing Disk FilesLimits Records Methods for Processing Disk FilesSubsequent Text Describes Each Method Processing Consecutive ProcessingADD Database Programming Sequential-by-Key ProcessingExamples of Sequential-by-Key Processing Database Programming manualExample, the employee master record Weekly hours workedFEMPL1 Disk YTDRPT1 Related Files EMPL1Fprint Iemprec IrcweekSeton Endif YTDRPT2 Related Files EMPL1Setoff Read EMPL1 Goto Eofend Move Enum Empno Eofend TAG SetonFor Processing Disk Files Records Are Processed as Matching records WithSUB Enhrs Ovthrs ADD Tothrs Totovt SetoffADD Ehwrk Tothrs ADD Ovthrs Totovt Seton Endif OprintEmstupd Descriptions Random-by-Key ProcessingExample of Random-by-Key Processing NnhrsChange Sequential-within-Limits ProcessingFchange Examples of Sequential-within-Limits Processing Disk FilesFlimits Disk ESWLIM1 Related Files EmpmstLimits 3PIDISK KEYLOC1 FprintESWLIM2 Related Files Empmst Relative-Record-Number ProcessingFempmst Disk Fprint Valid File Operations Valid File OperationsZ/F Recno Using Commitment Control Using Commitment ControlStarting and Ending Commitment Commitment Control Locks See theBackup and Recovery manualAbridged for Specifying UsingFiles For Concepts,Receiver Example of Using Commitment ControlJournal Control This command calls the program ReviseUpdate Mastrec Tranrec Disk Commit FtransDDM Files CycleDDM Files Pre-V3R1 DDM ReferDistributedto the DataDDM Files Attached AccessingTypes of Device Files Chapter 315Specifying Printer Files Accessing Printer DevicesAccessing Printer Devices Handling Page OverflowOverflow On an and notline,anoverflowthe linelineis OANL2 Example of Printing Headings on EveryExample of Printing a Field on Every AccountRoutine in Program-Described Files Using the Fetch-OverflowOverf Overflow Printing Setting of the Overflow Indicator Fetch Overflow Example of Specifying Fetch OverflowFile Changing Forms ControlOPM Prtctl data structure Dat Values Contained First four subfieldsForms Print Accessing Tape DevicesAccessing Tape Devices File Name Associated Data Structure isUsing Sequential Files Accessing Display DevicesUsing Sequential Files OvrdbfFile Using Special FilesUsing Special Files Program nameStatus ErrorDescription FLD Example of Using a Special FileSpecial Pgmnameuserio Spcl Plist Parm FLD1 Movel Hello Write Excptn Outbuf SetonProgram User-written routine Are Added To the end of the RPG-created Parameter listUserio Using Externally Described Workstn Files Using Workstn FilesFunction ¹ Output On page 333 shows an example of the DDS for a display-devicOverlay RefdstrefPrompt DescrpSpecifying Command Keys Display Specifying Function Key Indicators on Display Device FilesDevice Using Subfiles Processing an Externally Described Workstn FileField SfileName Search Use of SubfilesYou press Specified Function key During Read SFL TEXTSubfile RecordUsing Program-Described Workstn Files Using Program-Described Workstn FilesSubfil Using a Program-Described WithName Input SpecificationsCalculation Specifications FormatOutput File Valid Workstn File OperationsInput File Combined FileWrite Operation Exfmt OperationRead Operation Multiple-Device FilesDevid Is updatedKeyword. This field Initialized Multiple-Device Files Database Physical File Example of an Interactive ApplicationDatabase Physical File 345Display Device InquiryDDS for a Main Menu InquiryCusmain RPG Source First option specifies that the first module in the list Using Crtrpgmod Create Program By enteringMain menu will appear as in on CUSMSTL1 DDS for a File MaintenanceFile Maintenance LogicalDisplay Device70DATE Edtcdey ModeEdtcdez Record Format contains Constant Customer File Maintenance Cusmnt RPG SourceAddsub Begsr Cstkey Chain CMLREC1 Not *IN50 Move Subroutine Addsub PurposeElse Move OFF Move Delete Mode When Move ADD Mode WhenMove Update Mode When Move Display Mode Endsl MODE1 EndsrCstinq Display ModeCustomer File Maintenance 22302130/94 Customer 00007 On page 357 a new customer is added to the Customer Mast223106 223143Delete Mode ADD ModeBathurst Avenue Search by Zip Code ZipSearch by CodeFile SZIPMENU. IT has SzipmenuRelated Files CUSMSTL2 REFCUSMSTL2 Printqsysprt IndaraIndicates when to display Subfile When Indicator 55 is Schzip RPG Source Move OFF Write Subctl Move OFFADD Zero Recnum Endsr Routine Fills Subfile Record Read From File indicator 71 on thZip Subfile Is written to the screen as shown in onFor Database File Used This Program Defines one reco Search and Inquiry by NameSearch and Inquiry by Name Identifies Name field Key FieldsFOOT2 Device FileSnammenu DDS for a Display SubfileThis Program Prompts the User for the Customer Records Using SubfilesSchnam RPG Source File by the Setll OPERATION. then IT DisplaysExample of an Interactive 367Application Recnum File Indicator On the Read operationFile Record Count IncJudah Gould Gould Inquiry by Name233948 30/94 Customer 00012 Name YorktownAppendixes 371ILE RPG for AS/400 Programmers Guide Appendix RPG/400 ILEFor AS/400 DifferencesRunning Debugging and ExceptionRPG III Will issue the RNQ1022 inquiry Message Will issue the RNQ1222 inquiry MessageRPG/400 Will Issue Will IssueCompiler Such Programs Will Get Compilation errors Dbcs Data in Character FieldsDifferences Between OPM RPG/400 379 Appendix B. UsingConversion Overview HurryFile Considerations File Record LengthConversion Aid Tool Requirements Log FileUSE Converting Your Source Wont DoConverting Your Source AidCvtrpgsrc Command Curlib FromfileLibl FrommbrNone TofileQrpglesrc TombrCvtrpt ExpcpyYES Seclvl YES InsrtplConverting a Member Using DefaultsSource Converting Some Members Converting All Members in a FilePerforming a Trial Conversion Cvtrpgsrc FROMFILEOLDRPG/QRPGSRC Frommbrpayroll TOFILE*NONESource Members Obtaining Conversion ReportsConverting Auto Report CVTRPT*NOExample of Source Conversion Inserting Specification TemplatesData Example of Source ConversionTo convert this source, enter Example Source ConversionConverted source is shown in on ARR2 Analyzing Your Conversion III specifications for ARR2. The Conversion AidAnalyzing Your Conversion DS1Report Using the ConversionShows Command summary for a sample Conversion Conversion Aid generates a conversion report if you specifyYour Call PROG1Using the Log File Ymmdd Qrncvtfm Lgcent Colhdgcvt CentLgdate Colhdgcvt Date Lgtime Colhdgcvt TimeUnsupported RPG III Features Resolving Conversion ProblemsCompilation Errors in Existing RPG III Code Use of the /COPYTEST1 Members in the converted RPG IV source member Context-Sensitive ProblemsRecords Using CompStructures Command Or manually Correct Code After ConversionUse of Externally CharInitializing When convertedMerging an Array with an Externally Described DS Subfield ExtrecXYZ Run-time DifferencesBehavior With Dsone Extnameextrec CharResolving Conversion Problems How to Interpret Syntax Diagrams Appendix C. The Create CommandsUsing CL Commands Reading Syntax DiagramsValues Crtbndrpg CommandCrtbndrpg Command KEYWORDREQUIRED-VALUEAppendix C. The Create Commands407 Program-name Description of the Crtbndrpg CommandPGM SrcfileText SrcmbrGenlvl SrcmbrtxtGEN OptionNoxref NogenNoext ElseifStmt EventfDbgview ListPrint ALLOutput OptimizeGraphic CvtoptDatetime VarcharUsrprf LangidReplace UserUSE IssuedChange ExcludeTgtrls FixnbrZoned PRVBnddir AlwnullInputonly Binding-directory-nameQile UsrliblActgrp NEWPrfdta Crtrpgmod CommandCrtrpgmod Command NocolAppendix C. The Create Commands421 PF4 Description of the Crtrpgmod commandUsrprf PF1Compiler Listings Appendix D. Compiler Listings423 Reading a Which was Compiled UsingCompiler Listing CrtbCompiler options Module or ProgramSource member Indentation MarkEndif SectionEject Listings Sequence Numbers RootPart 1 of 3. Sample Source Part of the Listing Part 2 of 3. Sample Source Part of the Listing Ruler Line 1a/ *NOSRCSTMT Source HeadingLine Number Do NumberDiagnostic AdditionalOutput Buffer Positions Copy Member TableCharacter to be Altered Compile-Time DataTotal Number of Characters Altered Alternate SequenceKey Field Information Cross-Reference TableExternal References List DuedateMessage Summary Final SummaryCode Generation and Binding Errors N a L M M a R YCompiler Listings Bibliography 439Iddu ILE RPG ILE RPG for AS/400 Programmers Guide 443 SpecialCharacters See Ceeutx See AlsoILE Control-record format, subfile Create Program Dbcs Describing Dsppgmref Binder Listing 100 Exception Service Find See halt See file See last See long Plist Methods Qual OA-OG, OV SEU See DB2 Totc ILE RPG for AS/400 Programmers Guide Éâôù
Related manuals
Manual 104 pages 4.57 Kb Manual 516 pages 58.6 Kb