IBM AS/400 manual Passing by Value, Figures below

Page 160

Passing Prototyped Parameters

Passing by Value

With a prototyped procedure, you can pass a parameter by value inst reference. When a parameter is passed by value, the compiler passes value to the called procedure.

Note: OS/400 program calls require that parameters be passed by refere Consequently, you cannot pass a parameter by value to a program.

Passing by value allows you to:

¹ Pass literals and expressions as parameters.

¹Pass parameters that do not match exactly the type and length that expected.

¹ Pass a variable that, from the caller's perspective, will not be mod

When a parameter is passed by value, the called program or procedure change the value of the parameter, but the caller will never see the

One

primary use for

passing by

value

is

that

you

can

allow

less

strin

of the attributes of the passed parameter.

For

example,

if

the

def

numeric field

of type packed-decimal

and

length

5

with

2

decimal

posit

must

pass a

numeric

value, but

it can

be:

 

 

 

 

 

 

¹A packed, zoned or binary constant or variable, with any number of

number of decimal positions

¹

A

built-in function returning a numeric value

¹

A

procedure returning a numeric value

¹

A

complex numeric expression such as

 

 

2 * (Min(Length(First) + Length(Last) + 1): %size(Name))

If the prototype requires an array of 4 elements, the passed param

¹

An

array

with

fewer

than

4

elements. In this case, the remaining

 

the received

parameter will

contain the default value for

the

type

¹

An

array

with

4

elements.

In

this case, each element of

the

rece

 

will

correspond

to

an

element

of the passed parameter.

 

 

¹An array with more than 4 elements. In this case, some of the ele

passed array will not be passed to the received parameter.

¹ A non-array. In this

case, each element of the received parameter

the

passed

parameter

value.

 

To pass a parameter by

value, specify

the keyword VALUE on the para

nition

in the

prototype,

as shown in the

figures below.

136 ILE RPG for AS/400 Programmer's Guide

Image 160
Contents ÉÂÔ Page ÉÂÔ Third Edition May 1999 Contents SQL WithService Program ChapterVi ILE ExceptionWorking with Files and Devices ViiRPG FilesAppendixes ILECopy IndexDoes ApplyAny LawTrademarks and Service Programming Interface InformationMarks Trademarks Or se Marks OthersPage Xiv ILE RPG for AS/400 Programmers Guide About This Guide GuideWho Should Use This IIIHow to Send Your Comments Prerequisite and Related InformationWhat New This Release?UCS-2 RiscINZ*EXTDFT INZ*USERElement CCSID*GRAPH To this Guide ChangesSince For AS/400Xxii ILE RPG for AS/400 Programmers Guide ILE RPG Introduction Program creation strategiesILE RPG for AS/400 Programmers Guide RPG IV Specifications Control SpecificationsInput Specifications RPG IV OverviewThe.When You Let Compiler Provide Logic For Your Cycle ProgrammingSubprocedure logic IndicatorsFirst LastOperation Codes ProgramExample of an ILE RPG Example of an ILE RPG ProgramProgram File Description SpecificationsSecond file Output Specifications BonusChain EvalSubprocedure Heading Lines That Contain Constant String PayrollILE RPG NotReturn Entire Source ProgramFqsysprt Printer Rate Bonus PAY10U 0 Value Not *IN99 EvalCommonly Used Control Language Commands Interacting with the SystemOS/400 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 Program CreationRPG Programming in ILE ILE RPG, ILE C, ILE CoboCRTSRVPGM, and Crtpgm commands. They can also Specified Language You can CreateProcedure Followed Zero Or more subprocedures Program ManagementProgram Call ILEBindable APIs Source DebuggingWhile the progra Accesses Are Also Threadsafe Multithreaded ApplicationsAS/400 now supports multithreading. ILE Does Not DirectlyRPG Programming in ILE Program Creation Strategies Strategy 1 OPM-Compatible ApplicationMethod OPM-Compatible ApplicationExample of OPM-Compatible Program Effect of ILERelated Information ILE Program Using CrtbndrpgStrategy 2 ILE Program ILE Program Using Crtbndrpg Example of ILE Program Shows Run-time view Application in which an ILE CL pr CallsXYZ 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 Creating an Application Using Multiple Procedures Multiple Procedures ModuleProcedures OverviewPrototyped Calls What a module mightLike with Multiple Dures ModuleUsing prototyped calls you can call with the same syntax FmtCust Name 100A AddressNumToChar Numparm 30P 0 ValueExample of Module with Order to format Name Address ProperlyMade Expression Shows Call MultipleExample of Module with Multiple Procedures DDSISO Move ElseProcedures STATE, ZIP ThatZIP Module Meaning that it consists only of subprocedurModule, by Coding Keyword on the control specificatiEntire Arrsrpt Program Fcustfile Disk Fcustrpt PrinterCopy QRPGLE,CVTPROCP IcustrecCallp EndsrFollowing About ArrsrptISO Move Duedate Return Else EndifDDS When Coding Module with multiple procedures You Will Want Coding ConsiderationsGeneral Considerations Coding ConsiderationsMain Procedure Considerations Subprocedure ConsiderationsContain a program entry procedure and only a Cannot Contain Bound Procedure CallsMain Procedures SubproceduresFor Further Information ForPrototyped Call For Further InformationApplication Running anILE RPG for AS/400 Programmers Guide Statements FileSource Creating a LibraryUsing SEU Using the Source Entry UtilityEntry Utility IPC IpcxIPP IpprPress F3 Exit To the Exit display. Type Y Yes to save SavedUsing SQL Statements Using SQL StatementsStatements Calculation specification Start Your DB2 UDBReference for more Refer toADTS thefor AS/400 Source EntryUtilitymanual for Information about How SEU handles Statement Syntax CheckingUsing the Crtbndrpg Command CommandWith You can use the Crtbndrpg Command interactively Batch From Shows Their Default ValuesDebugged Using a Source View Program Type Creating a Program for Source DebuggingList Creates View similar Compiler listingBinding Creating a Program with StaticThis example you create Program Display Module SourceCommand Bnddir¹ Wrkjob ¹ Wrkoutq queue-nameDisk Fqsysprt Printer Chain Emprec Not *IN99Payroll Register Date Empname EmprateUsing a Compiler Listing Using a Compiler ListingListing Obtaining a CompilerCustomizing a Compiler Listing Customizing a Page HeadingCompiler Listing XrefLast Update Customizing the SpacingIndenting Structured Operations PAGE/LINEErrors ListingEither Create This Will Add Sec Level text to the messages listed MessageUsing In-Line Diagnostic Messages FLD2FLD1 SEUCorrecting Run-time Errors Using Additional-Diagnostic MessagesBrowsing a Compiler Listing Using SEU Source Entry UtilityUsing a Compiler Listing for Maintenance Expdds these are the defaultsCoordinating Listing Options with Debug View Options Specified, and in the column labeled as Sta MentArea DataAccessing the Returncode Data Area Accessing the Returncode Data Area Commands CreatingModule Object ChapterUsing the Crtrpgmod CommandYou Create a Module using the Create Creating a Nomain Module RequestedCreates a compiler listing which Crtrpgmod MODULEMYLIB/TRANSSVC SRCFILEMYLIB/QRPGLESRC¹ Dspjob Then Select option Display4 spooledFiles Related Files N/A Related Source TransrptEndsl Return OtherEndsl Creating a Module for Prototype for TransIncProd Prototype for ProdNameItrnsrec Ftrnsdta Disk Fqsysprt PrinterQTY Related CL Commands RPG, mainthe procedureisAdditional Examples ModulesBinding Modules into a Program Binding Modules into a ProgramBinder Using CommandInto a CrtclmodGroup Export Concepts forModules 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 Creating a Service Program Service Program OverviewService Program Overview Dspsrvpgm Payroll DETAIL*PROCEXP *DATAEXPStrategies for Creating Service Programs Creating a Service Program Using CrtsrvpgmCreating a Service Program Using CrtsrvpgmChanging a Service Program Service Program Using CrtsrvpgmSample Service Program Sample Service ProgramAPI Opdesc Const OPTIONS*VARSIZEOPTIONS*VARSIZE CeedodExsr EnddoBegsr Eval DIV MVRCreating the Service Program Parameters Crtsrvpgm commandStrpgmexp Signaturecvthex Export Symbolcvttohex Endpgmexp Input String Charactern Output Hex string Character2 * nBinding to a Program Create the program by typingCrtrpgmod MODULEMYLIB/CVTHEXPGM SRCFILEMYLIB/QRPGLESRC Call CvthexpgmCopy RPGGUIDE/QRPGLE,CVTHEXPR Clear CallpExcept ClearUpdating the Service Sample Binder ListingBasic Binder listing for Cvthexpgm Sample Service Program Running a Program Using the CL Call Command Running a Program UsingRunning a Program 103Passing Parameters using 106 shows DDS That is Referenced by the EMPRPT2 Source Application Running a Program From a Menu-Driven ApplicationRunning a Program From a Selecting Option Design menusRpginq You Run Menu by EnteringRPGCHG, or Rpgadd respectively Command Running a Program Using User-CreatedReplying to Run-Time Inquiry Messages Replying to Run-Time InquiryEnding an ILE Program GroupsManaging Activation Wheresequence-noManaging Activation Groups Specifying an ActivationGroup OFFDefault CompatibilityRunning in the OPM ActivationReclaim Resources Command Deleting an ActivationGroup 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 DeallocRPG procedure This Managing Your Own HeapBindable APIs Call SomepgmSeeAPI theReference DynarrayCeegtst Copy DynarriCeecrhp Initalloc SubsallocReset DynainitADD Initalloc Enddo DynainitDynaset Export IfgtExsr Realloc Endif Eval Realloc BegsrElse ADD Subsalloc Enddo Endsr DynasetDynaget Export IfleGet Heap Storage CrtsrvpgmCalling Programs and Procedures Program/Procedure Call OverviewProgram/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 Using the Callp Operation ¹ Subprocedures in the same module RPG Prototyped calls Are also Known CallpUsing a Prototyped Call Calling within an Expression31A 30PExamples of Free-Form Call Passing Prototyped ParametersParameter Passing Styles Passing by ReferencePassing by Value Figures belowPassing ExtprocdocalcDocalc Export DocalcILE CEE API Using Operational DescriptorsCeetsta Extprocceetsta When Calling Procedure You may sometimes want Leave Out Par Omitting ParametersOPTIONS*OMIT OmitPassing *OMIT Leaving Out ParametersOPTIONS*OMIT*NOPASS API QcmdexcPassing Prototyped Parameters Checking for the Number PsdsCopy Fmtaddrp OPTIONS*NOPASS ConstEval Address = %TRIMRCSTREET# + + Trimrprovince ReturnCheck Begsr MovelEndif Endsr 144 OPTIONS*NOPASSCtdata 5P 0 DIM2 CtdataTo create PRTADDR, using the source in on page 144, typ Passing Less Data Than RequiredParameters To create the program, PRTADDR, typeInterlanguage Calls Order of EvaluationEffect Interlanguage Calling ConsiderationsTo obtain Actual Returned value 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 Passing Parameters Using Parm Examples of Call and CallbOperations OperationFixed-Form Call Operations Using the Plist OperationPlist Returning from a Main Procedure ProcedureNormal End Returning from a CalledAbnormal End Returning from a Called Program or ProcedureEntry Parm operation is perfor Returning from a Subprocedure WithoutFor the AS/400 Reference RetuUsing Bindable APIs Returning using ILE BindableSubprocedure ends abnormally APIsExamples of Using Bindable APIs Calling a Graphics RoutineCalling a Graphics Routine CeeutxCalling Special Routines Multithreading ConsiderationsMultithreading Considerations TheGDDM Programming GuideAcross How toShare Data Example, consider the situation where two procedures Called Will Wait For MOD1 Unlock. Procedures NotHow To Avoid DeadlockConsiderations PROC1MOD2 MOD1Debugging and Exception Handling 161ILE RPG for AS/400 Programmers Guide Debugging Programs ILE Source DebuggerILE Source Debugger 163Debug Commands AttrEquate EvalTbreak ThreadWatch FindOrder Debug it using Preparing a Program for DebuggingPreparing a Program for SourceCreating a Root Source View Options On the Dbgview parameter for EitherCrtbndrpg PGMMYLIB/DEBUGEX SRCFILEMYLIB/QRPGLESRC Crtrpgmod MODULEMYLIB/DBGEX SRCFILEMYLIB/QRPGLESRCListing View ViewDbgview ModuleView Program for DebuggingStarting the ILE Source Debugger Starting the ILE SourceOPMSRC*NO Setting Debug Options Strdbg ExampleStart a Debug Session for the sample debug program Debugex IntoSET OPM source debug support field,Example of Adding a Service Example of Removing ILE Programs from a Debug SessionAdding/Removing Programs from a Debug Session Debug SessionViewing the Program Source Viewing the Program SourceCobol Lstdbg ILEDbgex Viewing a DifferentLibl PGM Changing the View of a ModuleSeveral Different views CprocSetting and Removing Breakpoints Setting and Removing BreakpointsSpecified You Not Erate Breakpoints Specify OPTION*NODEBUGIOSetting and Removing With the source positioned at the line where the breakpointDebug Command to set a job breakpoint BreakpointsJob Setting anBreakpoint Setting and Removing Unconditional Thread Breakpoints Debug Command Sets a Thread breakpo Single CurrentDebug Greater Than Equal To oneJob BreakpointsExample of Setting a Conditional Job Breakpoint Using F13 LineConditional Breakpoint Work with Module BreakpointsCommand Setting a Conditional Job Breakpoint UsingBreak 128 when BigDate=1994-09-30 National Language Sort Sequence NlssControl Spec Tion Is not available Sort SequenceOn the debug command line One procedure per module,procedurethe -namecan EitherMain procedure or one of the subprocedures VariaThis Example Statement View Is used to Set Breakpoint For Set a breakpoint for Module WithSet Breakpoint For Module with Listing, typeSetting and Removing Conditional Thread Breakpoints Using the Work with Module Breakpoints DisplayProcedurevariables-name and statement-number Main Procedure ExitDebug Commands Setting and Removing Watch ConditionsRemoving All Job ConditionsCharacteristics of Watches DisplayProgram statemen You Debug One Job From AnotherSetting Watch Conditions On the debug command line, without any parametersWatch SalaryPayroll ABC PGM ¹ To specify a variable or expression to be watched, typePayroll Displaying Active Watches Removing Watch ConditionsEnddbg IPLExample of Setting a Watch Condition Example of Setting a Watch ConditionBlankDisplay Module Source 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 F22 This example, you use F22 Step Into to step Into the OPMFrom Program 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 ConstUnexpected Results when Evaluating Variables Scalar Fields RPG DefinitionBased Fields 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 FormatData Displaying Variable-Length FieldsBy Pointers Displaying Null-Capable FieldsSTRING=%SUBSTRBIGDATE 1 4 = String = 1ABCD6Fields Changing the Value of Fields = AbcdefOr Command Equating a Name with a Field, Expression, or CommandDisplaying Attributes of a Field Equating a Name withSample Source for Debug Examples ForExamples Program using Source 215, type Sample Source for Debug ExamplesTo create the program DEBUGEX, type First ModuleDIM3 Ctdata DS1Inzabcde DS2Plist Parm Occur DS2 MoveCall Rpgpgm Dump Seton Else EvalEntry Plist Parm Dsply SetonSource for C Procedure cproc. cproc is called by Dbgex Handling Exceptions Exception Handling OverviewException Handling Overview 217Indicates That Severe error has been detected Program Procedure P1 is Contro BoundaryDescribes Status Work Being done by a program Call stException Message Active onILE RPG Exception Handling Dure will Only Handle Errors That SubprocedureException Handling within Operation For OPM PGM CUsing Exception Handlers Using Exception HandlersException Handler Priority Nested ExceptionsFor other Types Messages Escape MessagePGM2 PRC1Example of Unhandled Function Check Operation as wellPGM1 PGM2, each Containing a procedurUsing RPG-Specific Handlers Optimization ConsiderationsFor More Information Optimization See Changing Level Built-in-functionsThis Section Provides Some Examples How to Use Each These R Infsr error Subroutines, on Exsr Operation Code InfdsExtender ILE RPG For AS/400 Reference providesUsing an Error Subroutine Program ErrorOperation. If Either Explicitly cUsing a File Error Infsr Subroutine INFSRPrdInfsr INFDSPrdInfds Disk Ftrnbacklg O Fprint PrinterPrdInfds PrdStatus StatusInfds Using a Program Error Subroutine Position Definition Specification EnterAfter Keyword Operation With Factor EntryParms Proc Body of Code Goes HerePssr Begsr Move GetinIf this is a divide-by-zero error, add 1 to the divisor If control reaches ENDSR, the procedure will failTAG DIV Try again Err =Exceptions Order Show how to avoid looping Within PssrWhich is designed to ge SubrouMove Inlr After the ElseElse ADD Specifying a Return Point OFLUsing a Condition Handler ILE Condition HandlersILE Condition Handlers Handlers132 Printer RpghdlrLIKECondTok Action 10I OutCondTok LIKECondTokShows Source For Procedure Is registered Procedure Parameters Include PointerCondition Handler Communication Area Which Contains PointerARR1 CeehdluProcptr NooptSDS Noopt ProcSubst Begsr CallpCancel Handlers 244Ceertx Ceeutx ILEProcedure to SubProc will not fail Pssr has a Return operation, so the call from the mainSubproc Pssrdsply Return EndsrINZ0 Static Callb Ceertx ParmParm Omit Select WhenRPG using Condition Handlers Enabled UsingCancel Hdlr Dsply Msg CanHdlr Likely Occur WithCondition Handler that Ignores CPF4906 Endif ReturnHandle information or warning messages, otherwise percolate MsgSev = WarningILE RPG for AS/400 Programmers Guide Using the Dump Operation Code Using the Dump Operation CodeObtaining a Dump 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 Defining Files Associating Files with Input/Output DevicesAssociating Files with Input/Output Devices 261Compilation Time Certain Operation Device Dependent Device dependency Is thatOperation Code is Valid Only WriteTypes of File Descriptions Naming FilesTypes of File Descriptions Using Files with Program-DescribedFiles Example of Some Typical Relationships betweenDefining Externally Described Defining Externally Described FilesOPTION*EXPDDS Renaming Record-Format Names Ignoring Record FormatsRenaming Field Names Nbrofcharreplaced. FigureUsing Input Specifications Modify anDescription ExternalYou Then Fixed Name Specification Will Get Error Indicator RecordFiles Used Program This Example FieldUsing Output Specifications Level Checking For Character Fields zeroIs written ALLDefining Program-Described Files Data Management Operations and ILE RPG I/O OperationsRPG I/O Operations SEQ SpecialData Management Operations and ILE RPG I/O Operations DeleteFile Considerations Overriding and Redirecting File Input and OutputOverriding and Redirecting File Input and Output 273Input Output Input OutputExample of Redirecting FMT1File Locking File LockingData Management manual Program Can Chang Allocate ObjectRecord Locking Record LockingSee Using PathSharing an Open Data Control For More InformationSpooling SpoolingProgram Details System Open Options Allowed for Each Can SpecifyOutput Spooling Program VersusSRTSEQ/ALTSEQ Accessing Database FilesPhysical Files and Logical Files Data Files and SourceUsing Externally Described Disk Files Record Format SpecificationsAccess Path Using Externally Described Disk FilesUnique Contained Physical file CUSMSTP, which is IdentifiedUnique Dstref Distribution Application Field Reference Basdat EdtcdeyCust Checkmf Addr ReffldnameValid Keys for a Record File DiskCity EdtcdejPartial Key ArgumentsReferring to Record Blocking and Unblocking Used,Using Program-Described Disk Files Using Program-Described Disk FilesIndexed File ValidKeyword specifies position 15 as the starting po Logical file ORDDTLL. For the two fieldsSequential File Record Address File10AIDISK Move Order KEY ChainMethods for Processing Disk Files Limits RecordsRelative Record Numbers Methods for Processing Disk FilesSubsequent Text Describes Each Method Processing Consecutive ProcessingADD Sequential-by-Key Processing Examples of Sequential-by-Key ProcessingDatabase Programming Database Programming manualExample, the employee master record Weekly hours workedYTDRPT1 Related Files EMPL1 FprintFEMPL1 Disk Iemprec IrcweekYTDRPT2 Related Files EMPL1 Setoff Read EMPL1 Goto Eofend Move Enum EmpnoSeton Endif Eofend TAG SetonFor Processing Disk Files Records Are Processed as Matching records WithADD Tothrs Totovt Setoff ADD Ehwrk TothrsSUB Enhrs Ovthrs ADD Ovthrs Totovt Seton Endif OprintRandom-by-Key Processing Example of Random-by-Key ProcessingEmstupd Descriptions NnhrsChange Sequential-within-Limits ProcessingFchange Examples of Sequential-within-Limits Processing Disk FilesESWLIM1 Related Files Empmst LimitsFlimits Disk 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 Using Files ForSpecifying Concepts,Receiver Example of Using Commitment ControlJournal This command calls the program Revise Update Mastrec TranrecControl Disk Commit FtransDDM Files CycleDDM Files Pre-V3R1 DDM ReferDistributedto the DataDDM Files Accessing Types of Device Files ChapterAttached 315Accessing Printer Devices Accessing Printer DevicesSpecifying Printer Files Handling Page OverflowOverflow On an and notline,anoverflowthe linelineis Example of Printing Headings on Every Example of Printing a Field on EveryOANL2 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 Accessing Tape Devices Accessing Tape DevicesPrint File Name Associated Data Structure isAccessing Display Devices Using Sequential FilesUsing Sequential Files OvrdbfUsing Special Files Using Special FilesFile Program nameStatus ErrorDescription Example of Using a Special File Special PgmnameuserioFLD 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-devicRefdstref PromptOverlay DescrpSpecifying Command Keys Display Specifying Function Key Indicators on Display Device FilesDevice Using Subfiles Processing an Externally Described Workstn FileField SfileUse of Subfiles You press Specified Function key During ReadName Search SFL TEXTSubfile RecordUsing Program-Described Workstn Files Using Program-Described Workstn FilesSubfil Using a Program-Described WithInput Specifications Calculation SpecificationsName FormatValid Workstn File Operations Input FileOutput File Combined FileExfmt Operation Read OperationWrite Operation Multiple-Device FilesDevid Is updatedKeyword. This field Initialized Multiple-Device Files Example of an Interactive Application Database Physical FileDatabase Physical File 345Inquiry DDS for aDisplay Device 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 File Maintenance File MaintenanceCUSMSTL1 DDS for a 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 ADD Mode When Move Update Mode WhenMove Delete Mode When Move Display Mode Endsl MODE1 EndsrDisplay Mode Customer File MaintenanceCstinq 223021On page 357 a new customer is added to the Customer Mast 22310630/94 Customer 00007 223143Delete Mode ADD ModeBathurst Avenue Zip Search bySearch by Zip Code CodeSzipmenu Related Files CUSMSTL2File SZIPMENU. IT has REFCUSMSTL2 Printqsysprt IndaraIndicates when to display Subfile When Indicator 55 is Schzip RPG Source Move OFF Write Subctl Move OFFADD Zero Recnum Endsr File indicator 71 on th ZipRoutine Fills Subfile Record Read From Subfile Is written to the screen as shown in onSearch and Inquiry by Name Search and Inquiry by NameFor Database File Used This Program Defines one reco Identifies Name field Key FieldsDevice File Snammenu DDS for a DisplayFOOT2 SubfileRecords Using Subfiles Schnam RPG SourceThis Program Prompts the User for the Customer File by the Setll OPERATION. then IT DisplaysExample of an Interactive 367Application File Indicator On the Read operation File Record CountRecnum IncJudah Gould Inquiry by Name 233948 30/94 Customer 00012 NameGould YorktownAppendixes 371ILE RPG for AS/400 Programmers Guide RPG/400 ILE For AS/400Appendix DifferencesRunning Debugging and ExceptionRPG III Will issue the RNQ1222 inquiry Message RPG/400 Will IssueWill issue the RNQ1022 inquiry Message Will IssueCompiler Such Programs Will Get Compilation errors Dbcs Data in Character FieldsDifferences Between OPM RPG/400 Appendix B. Using Conversion Overview379 HurryFile Considerations File Record LengthConversion Aid Tool Requirements Log FileUSE Wont Do Converting Your SourceConverting Your Source AidCvtrpgsrc Command Fromfile LiblCurlib FrommbrTofile QrpglesrcNone TombrExpcpy YESCvtrpt Seclvl YES InsrtplConverting a Member Using DefaultsSource Converting All Members in a File Performing a Trial ConversionConverting Some Members Cvtrpgsrc FROMFILEOLDRPG/QRPGSRC Frommbrpayroll TOFILE*NONEObtaining Conversion Reports Converting Auto ReportSource Members CVTRPT*NOInserting Specification Templates DataExample of Source Conversion Example of Source ConversionTo convert this source, enter Example Source ConversionConverted source is shown in on ARR2 III specifications for ARR2. The Conversion Aid Analyzing Your ConversionAnalyzing Your Conversion DS1Using the Conversion Shows Command summary for a sample ConversionReport Conversion Aid generates a conversion report if you specifyYour Call PROG1Using the Log File Qrncvtfm Lgcent Colhdgcvt Cent Lgdate Colhdgcvt DateYmmdd Lgtime Colhdgcvt TimeResolving Conversion Problems Compilation Errors in Existing RPG III CodeUnsupported RPG III Features Use of the /COPYTEST1 Context-Sensitive Problems Records UsingMembers in the converted RPG IV source member CompCommand Or manually Correct Code After Conversion Use of ExternallyStructures CharWhen converted Merging an Array with an Externally Described DS SubfieldInitializing ExtrecRun-time Differences Behavior WithXYZ Dsone Extnameextrec CharResolving Conversion Problems Appendix C. The Create Commands Using CL CommandsHow to Interpret Syntax Diagrams Reading Syntax DiagramsCrtbndrpg Command Crtbndrpg CommandValues KEYWORDREQUIRED-VALUEAppendix C. The Create Commands407 Description of the Crtbndrpg Command PGMProgram-name SrcfileSrcmbr GenlvlText SrcmbrtxtOption NoxrefGEN NogenNoext ElseifEventf DbgviewStmt ListALL OutputPrint OptimizeCvtopt DatetimeGraphic VarcharLangid ReplaceUsrprf UserIssued ChangeUSE ExcludeFixnbr ZonedTgtrls PRVAlwnull InputonlyBnddir Binding-directory-nameUsrlibl ActgrpQile NEWCrtrpgmod Command Crtrpgmod CommandPrfdta NocolAppendix C. The Create Commands421 Description of the Crtrpgmod command UsrprfPF4 PF1Compiler Listings Appendix D. Compiler Listings423 Which was Compiled Using Compiler ListingReading a CrtbModule or Program Source memberCompiler options 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 1a/ *NOSRCSTMT Source Heading Line NumberRuler Line Do NumberDiagnostic AdditionalOutput Buffer Positions Copy Member TableCompile-Time Data Total Number of Characters AlteredCharacter to be 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