IBM AS/400 manual Managing the Default Heap Using RPG Operations, Referenceto Abridged

Page 137

 

 

 

 

 

 

 

Managing

 

Dynamically-Allocated Storage

 

 

 

 

For

more

information

on the RCLRSC command, referCL

Referenceto the

 

 

 

(Abridged).

For

more

information

on

the

RCLRSC

and

activation

groups, refe

ILE

Concepts.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Managing Dynamically-Allocated

Storage

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ILE

allows

you

to

directly manage run-time

storage

from your

program

heaps. heapA

is

an

area

of

storage

used

for

allocations

of

dynamic

amount of dynamic storage required by an application depends on the

processed

by

the

programs

and

procedures

that

use the

heap.

You

manage

heaps

by using the storage management operations ALLOC,

REALLOC, and

DEALLOC

or by using

ILE

bindable

APIs.

 

 

 

 

You

are

not required to

explicitly

manage

run-time storage. However,

to do so if you

want to make use of dynamically allocated run-time

example, you may want to do

this

if

you

do not know exactly how la

multiple-occurrence data structure should be. You could define the a

structure

as

BASED,

and acquire the actual storage for the array o

once

your

program

determines

 

how

large

it

should

be.

 

 

 

There are two types of heaps available on the system: a default created heap. The RPG storage management operations use the default following sections show how to use RPG storage management operations wi default heap, and also how to create and use your own heap using management APIs. For more information on user-created heaps and other storage management concepts referILE Conceptsto .

Managing the Default Heap Using RPG Operations

The first request for dynamic storage within an activation group res

ation ofdefault heap from which the storage allocation takes place. Addi requests for dynamic storage are met by further allocations from th there is insufficient storage in the heap to satisfy the current storage, the heap is extended and the additional storage is alloca

Allocated dynamic storage remains allocated until it is explicitly free heap is discarded. The default heap is discarded only when the o group ends.

Programs in the same activation group all use the same default heap. program accesses storage beyond what has be allocated, it can caus another program. For example, assume that two programs, PGM A and PGM B running in the same activation group. 10 bytes are allocated for PGM bytes are changed by PGM A. If the extra byte was in fact alloc problems may arise for PGM B.

You can use the following RPG operations on the default heap:

¹

The

ALLOC

operation

allocates

storage within

the default heap.

¹

The

DEALLOC

operation

frees

one

previous

allocation of

heap storage

 

any

heap.

 

 

 

 

 

 

¹

The

REALLOC

operation

changes

the

size

of

previously

allocated stor

 

any

heap.

 

 

 

 

 

 

Chapter 9. Running a Program113

Image 137
Contents ÉÂÔ Page ÉÂÔ Third Edition May 1999 Contents With SQLChapter Service ProgramException Vi ILEVii Working with Files and DevicesFiles RPGILE AppendixesIndex CopyApply DoesAny LawProgramming Interface Information Trademarks and ServiceMarks Trademarks Or se Marks OthersPage Xiv ILE RPG for AS/400 Programmers Guide Guide About This GuideWho Should Use This IIIPrerequisite and Related Information How to Send Your CommentsRelease? What New ThisUCS-2 RiscINZ*USER INZ*EXTDFTElement CCSID*GRAPH Changes To this GuideSince For AS/400Xxii ILE RPG for AS/400 Programmers Guide Program creation strategies ILE RPG IntroductionILE RPG for AS/400 Programmers Guide Control Specifications RPG IV SpecificationsInput Specifications RPG IV OverviewCycle Programming The.When You Let Compiler Provide Logic For YourIndicators Subprocedure logicFirst LastProgram Operation CodesExample of an ILE RPG Example of an ILE RPG ProgramSecond file File Description SpecificationsProgram Bonus Output SpecificationsChain EvalHeading Lines That Contain Constant String Payroll SubprocedureILE RPG NotFqsysprt Printer Entire Source ProgramReturn Bonus PAY Rate10U 0 Value Not *IN99 EvalInteracting with the System Commonly Used Control Language CommandsOS/400 System System LibraryApplication Development Manager System Offers Full Set Tools That You May find usefILE R ServicesAS/400 Tools Overview of the RPG IV Programming15 Language AS/400 Tools Program Creation RPG Programming in ILERPG Programming in ILE ILE RPG, ILE C, ILE CoboLanguage You can Create CRTSRVPGM, and Crtpgm commands. They can also SpecifiedProgram Management Procedure Followed Zero Or more subproceduresProgram Call ILEWhile the progra Source DebuggingBindable APIs Multithreaded Applications Accesses Are Also ThreadsafeAS/400 now supports multithreading. ILE Does Not DirectlyRPG Programming in ILE Strategy 1 OPM-Compatible Application Program Creation StrategiesMethod OPM-Compatible ApplicationEffect of ILE Example of OPM-Compatible ProgramStrategy 2 ILE Program ILE Program Using CrtbndrpgRelated Information Shows Run-time view Application in which an ILE CL pr Calls ILE Program Using Crtbndrpg Example of ILE ProgramXYZ Although Actual Storage Not Deleted As itStrategy 3 ILE Application ILE Application Using CrtrpgmodUsing Single-Language ILE Application ScenarioMixed-Language ILE Application Scenario Single-Language Application Using Crtrpgmod and CrtpgmAdvanced Application Scenario Strategy to Avoid Strategy to AvoidActivation Group Multiple Procedures Module Creating an Application Using Multiple ProceduresProcedures OverviewWhat a module might Prototyped CallsLike with Multiple Dures ModuleFmtCust Name 100A Address Using prototyped calls you can call with the same syntaxNumToChar Numparm 30P 0 ValueOrder to format Name Address Properly Example of Module withMade Expression Shows Call MultipleDDS Example of Module with Multiple ProceduresISO Move ElseProcedures ZIP ThatSTATE, ZIP Meaning that it consists only of subprocedur ModuleModule, by Coding Keyword on the control specificatiFcustfile Disk Fcustrpt Printer Entire Arrsrpt ProgramIcustrec Copy QRPGLE,CVTPROCPCallp EndsrArrsrpt Following AboutISO Move Duedate Return Else EndifDDS Coding Considerations When Coding Module with multiple procedures You Will WantGeneral Considerations Coding ConsiderationsSubprocedure Considerations Main Procedure ConsiderationsContain a program entry procedure and only a Cannot Contain Bound Procedure CallsSubprocedures Main ProceduresFor Further Information ForFor Further Information Prototyped CallRunning an ApplicationILE RPG for AS/400 Programmers Guide File StatementsSource Creating a LibraryEntry Utility Using the Source Entry UtilityUsing SEU Ipcx IPCIPP IpprSaved Press F3 Exit To the Exit display. Type Y Yes to saveUsing SQL Statements Using SQL StatementsStatements Calculation specification Start Your DB2 UDBRefer toADTS thefor AS/400 Source Entry Reference for moreUtilitymanual for Information about How SEU handles Statement Syntax CheckingWith CommandUsing the Crtbndrpg Command Shows Their Default Values You can use the Crtbndrpg Command interactively Batch FromCreating a Program for Source Debugging Debugged Using a Source View Program TypeList Creates View similar Compiler listingCreating a Program with Static BindingThis example you create Program Display Module SourceBnddir Command¹ Wrkjob ¹ Wrkoutq queue-nameChain Emprec Not *IN99 Disk Fqsysprt PrinterPayroll Register Date Empname EmprateUsing a Compiler Listing Using a Compiler ListingListing Obtaining a CompilerCustomizing a Page Heading Customizing a Compiler ListingCompiler Listing XrefCustomizing the Spacing Last UpdateIndenting Structured Operations PAGE/LINEListing ErrorsEither Create This Will Add Sec Level text to the messages listed MessageFLD2 Using In-Line Diagnostic MessagesFLD1 SEUUsing Additional-Diagnostic Messages Correcting Run-time ErrorsBrowsing a Compiler Listing Using SEU Source Entry UtilityExpdds these are the defaults Using a Compiler Listing for MaintenanceCoordinating Listing Options with Debug View Options Specified, and in the column labeled as Sta MentData AreaAccessing the Returncode Data Area Accessing the Returncode Data Area Creating CommandsModule Object ChapterYou Create a Module using the Create CommandUsing the Crtrpgmod Requested Creating a Nomain ModuleCreates a compiler listing which Crtrpgmod MODULEMYLIB/TRANSSVC SRCFILEMYLIB/QRPGLESRCThen Select option Display4 spooled ¹ DspjobFiles Related Files N/A Related Source TransrptEndsl OtherEndsl Return Prototype for TransInc Creating a Module forProd Prototype for ProdNameQTY Ftrnsdta Disk Fqsysprt PrinterItrnsrec RPG, mainthe procedureis Related CL CommandsAdditional Examples ModulesBinder Binding Modules into a ProgramBinding Modules into a Program Command UsingInto a CrtclmodGroup Concepts for ExportModules TrptUsing a Binder Listing Using a Binder ListingChanging a Module or Changing a Module or ProgramLevel Using the Updpgm CommandReducing an Objects Removing ObservabilitySize Changing a Changing a Module or Program Service Program Overview Creating a Service ProgramService Program Overview Dspsrvpgm Payroll DETAIL*PROCEXP *DATAEXPCreating a Service Program Using Crtsrvpgm Strategies for Creating Service ProgramsCreating a Service Program Using CrtsrvpgmService Program Using Crtsrvpgm Changing a Service ProgramAPI Sample Service ProgramSample Service Program Const OPTIONS*VARSIZE OpdescOPTIONS*VARSIZE CeedodEnddo ExsrBegsr Eval DIV MVRParameters Crtsrvpgm command Creating the Service ProgramStrpgmexp Signaturecvthex Export Symbolcvttohex Endpgmexp Input String Charactern Output Hex string Character2 * nCreate the program by typing Binding to a ProgramCrtrpgmod MODULEMYLIB/CVTHEXPGM SRCFILEMYLIB/QRPGLESRC Call CvthexpgmClear Callp Copy RPGGUIDE/QRPGLE,CVTHEXPRExcept ClearSample Binder Listing Updating the ServiceBasic Binder listing for Cvthexpgm Sample Service Program Running a Program Using Running a Program Using the CL Call CommandRunning a Program 103Passing Parameters using 106 shows DDS That is Referenced by the EMPRPT2 Source Running a Program From a Menu-Driven Application ApplicationRunning a Program From a Selecting Option Design menusRPGCHG, or Rpgadd respectively You Run Menu by EnteringRpginq Running a Program Using User-Created CommandReplying to Run-Time Inquiry Messages Replying to Run-Time InquiryGroups Ending an ILE ProgramManaging Activation Wheresequence-no Specifying an Activation Managing Activation Groups Group OFFCompatibility DefaultRunning in the OPM ActivationDeleting an Activation Reclaim Resources CommandGroup Activation Groups SuchReferenceto Abridged Managing the Default Heap Using RPG OperationsDsply Managing Dynamically-Allocated StorageINZ*NULL Elem@ = next@ AddName 40AAlloc Namelen = %len%trimrname = *NULLNull DOW Dealloc Heap Storage ProblemsManaging Your Own Heap RPG procedure ThisBindable APIs Call SomepgmDynarray SeeAPI theReferenceCeecrhp Copy DynarriCeegtst Subsalloc InitallocDynainit ResetADD Initalloc Enddo DynainitIfgt Dynaset ExportExsr Realloc Endif Eval Realloc BegsrEnddo Endsr Dynaset Else ADD SubsallocDynaget Export IfleCrtsrvpgm Get Heap StorageProgram/Procedure Call Overview Calling Programs and ProceduresProgram/Procedure Call Overview 127Static Calling ProceduresCalling Programs Stack Call StackCall stack That Most r Stack Entry is Bottom Recursive CallsRecursive calls are only allowed For Recent Caller Parameter-Passing ConsiderationsProgram/Procedure Call Overview ¹ Subprocedures in the same module Using the Callp OperationRPG Prototyped calls Are also Known CallpCalling within an Expression Using a Prototyped Call31A 30PPassing Prototyped Parameters Examples of Free-Form CallParameter Passing Styles Passing by ReferenceFigures below Passing by ValueExtprocdocalc PassingDocalc Export DocalcCeetsta Extprocceetsta Using Operational DescriptorsILE CEE API Omitting Parameters When Calling Procedure You may sometimes want Leave Out ParOPTIONS*OMIT OmitLeaving Out Parameters Passing *OMITOPTIONS*OMIT*NOPASS API QcmdexcPsds Passing Prototyped Parameters Checking for the NumberOPTIONS*NOPASS Const Copy FmtaddrpEval Address = %TRIMRCSTREET# + + Trimrprovince ReturnEndif Endsr Begsr MovelCheck OPTIONS*NOPASS 144Ctdata 5P 0 DIM2 CtdataPassing Less Data Than Required To create PRTADDR, using the source in on page 144, typParameters To create the program, PRTADDR, typeEffect Order of EvaluationInterlanguage Calls Calling Considerations InterlanguageTo obtain Actual Returned value DCL &RET2 TYPE*CHAR LEN2 DCL &RET1 TYPE*CHAR LEN1Fixed-Form Call OperationsOperation Operation extender is Used With Using the Fixed-Form Call OperationsFor Callb only Examples of Call and Callb Passing Parameters Using ParmOperations OperationPlist Using the Plist OperationFixed-Form Call Operations Procedure Returning from a Main ProcedureNormal End Returning from a CalledEntry Parm operation is perfor Returning from a Called Program or ProcedureAbnormal End Without Returning from a SubprocedureFor the AS/400 Reference RetuReturning using ILE Bindable Using Bindable APIsSubprocedure ends abnormally APIsCalling a Graphics Routine Examples of Using Bindable APIsCalling a Graphics Routine CeeutxMultithreading Considerations Calling Special RoutinesMultithreading Considerations TheGDDM Programming GuideShare Data How toAcross Will Wait For MOD1 Unlock. Procedures Not Example, consider the situation where two procedures CalledHow To Avoid DeadlockPROC1 ConsiderationsMOD2 MOD1161 Debugging and Exception HandlingILE RPG for AS/400 Programmers Guide ILE Source Debugger Debugging ProgramsILE Source Debugger 163Attr Debug CommandsEquate EvalThread TbreakWatch FindPreparing a Program for Debugging Order Debug it usingPreparing a Program for SourceOptions On the Dbgview parameter for Either Creating a Root Source ViewCrtbndrpg PGMMYLIB/DEBUGEX SRCFILEMYLIB/QRPGLESRC Crtrpgmod MODULEMYLIB/DBGEX SRCFILEMYLIB/QRPGLESRCView Listing ViewDbgview ModuleProgram for Debugging ViewOPMSRC*NO Starting the ILE SourceStarting the ILE Source Debugger Strdbg Example Setting Debug OptionsStart a Debug Session for the sample debug program Debugex IntoOPM source debug support field, SETExample of Removing ILE Programs from a Debug Session Example of Adding a ServiceAdding/Removing Programs from a Debug Session Debug SessionViewing the Program Source Viewing the Program SourceCobol Lstdbg ILELibl PGM Viewing a DifferentDbgex Module Changing the View of aSeveral Different views CprocSetting and Removing Breakpoints Setting and Removing BreakpointsSpecified You Not Erate Breakpoints Specify OPTION*NODEBUGIOWith the source positioned at the line where the breakpoint Setting and RemovingDebug Command to set a job breakpoint BreakpointsBreakpoint Setting anJob Debug Command Sets a Thread breakpo Single Current Setting and Removing Unconditional Thread BreakpointsDebug Greater Than Equal To oneBreakpoints JobLine Example of Setting a Conditional Job Breakpoint Using F13Conditional Breakpoint Work with Module BreakpointsSetting a Conditional Job Breakpoint Using CommandBreak 128 when BigDate=1994-09-30 National Language Sort Sequence NlssSort Sequence Control Spec Tion Is not availableOne procedure per module,procedurethe -namecan Either On the debug command lineMain procedure or one of the subprocedures VariaSet a breakpoint for Module With This Example Statement View Is used to Set Breakpoint ForSet Breakpoint For Module with Listing, typeUsing the Work with Module Breakpoints Display Setting and Removing Conditional Thread BreakpointsProcedurevariables-name and statement-number Main Procedure ExitSetting and Removing Watch Conditions Debug CommandsRemoving All Job ConditionsDisplay Characteristics of WatchesProgram statemen You Debug One Job From AnotherOn the debug command line, without any parameters Setting Watch ConditionsWatch SalaryPayroll ¹ To specify a variable or expression to be watched, typePayroll ABC PGM Removing Watch Conditions Displaying Active WatchesEnddbg IPLExample of Setting a Watch Condition Example of Setting a Watch ConditionBlankDisplay Module Source Display as shown below. InsteadStepping Through ObjectStepping Through the Program Object Subroutines You Can Over Into SubproceduresStepping Over Call Statements TIP Stepping Into Call StatementsStep Into This example, you use F22 Step Into to step Into the OPM F22From Program DebugexStep completed at line This example, you use F22 Step Into to Subpr Which ModuleInputParm Else SwitchDisplaying Data and Expressions Const On page 201 shows UseScalar Fields RPG Definition Unexpected Results when Evaluating VariablesBased Fields Date, Time, Timestamp FieldsDisplaying the Contents of a Table Displaying the Contents of an ArrayEval DS12 Displaying Data StructuresWhich is discussed Below Displaying IndicatorsCharacter Format Displaying Fields as Hexadecimal ValuesDisplaying Variable-Length Fields DataBy Pointers Displaying Null-Capable FieldsString = 1ABCD6 STRING=%SUBSTRBIGDATE 1 4 =Fields = Abcdef Changing the Value of FieldsEquating a Name with a Field, Expression, or Command Or CommandDisplaying Attributes of a Field Equating a Name withExamples ForSample Source for Debug Examples Sample Source for Debug Examples Program using Source 215, typeTo create the program DEBUGEX, type First ModuleDS1 DIM3 CtdataInzabcde DS2Call Rpgpgm Occur DS2 MovePlist Parm Else Eval Dump SetonEntry Plist Parm Dsply SetonSource for C Procedure cproc. cproc is called by Dbgex Exception Handling Overview Handling ExceptionsException Handling Overview 217Program Procedure P1 is Contro Boundary Indicates That Severe error has been detectedDescribes Status Work Being done by a program Call stActive on Exception MessageException Handling within Dure will Only Handle Errors That SubprocedureILE RPG Exception Handling Operation For PGM C OPMUsing Exception Handlers Using Exception HandlersException Handler Priority Nested ExceptionsEscape Message For other Types MessagesPGM2 PRC1Operation as well Example of Unhandled Function CheckPGM1 PGM2, each Containing a procedurOptimization Considerations Using RPG-Specific HandlersFor More Information Optimization See Changing Level Built-in-functionsInfsr error Subroutines, on Exsr Operation Code Infds This Section Provides Some Examples How to Use Each These RExtender ILE RPG For AS/400 Reference providesProgram Error Using an Error SubroutineOperation. If Either Explicitly cUsing a File Error Infsr Subroutine Disk Ftrnbacklg O Fprint Printer INFSRPrdInfsr INFDSPrdInfdsPrdInfds PrdStatus StatusInfds Position Definition Specification Enter Using a Program Error SubroutineAfter Keyword Operation With Factor EntryProc Body of Code Goes Here ParmsPssr Begsr Move GetinIf control reaches ENDSR, the procedure will fail If this is a divide-by-zero error, add 1 to the divisorTAG DIV Try again Err =Pssr Exceptions Order Show how to avoid looping WithinWhich is designed to ge SubrouElse ADD After the ElseMove Inlr OFL Specifying a Return PointILE Condition Handlers Using a Condition HandlerILE Condition Handlers HandlersPrinter Rpghdlr 132LIKECondTok Action 10I OutCondTok LIKECondTokIs registered Procedure Parameters Include Pointer Shows Source For ProcedureCondition Handler Communication Area Which Contains PointerCeehdlu ARR1Noopt ProcptrSDS Noopt ProcBegsr Callp Subst244 Cancel HandlersCeertx Ceeutx ILEPssr has a Return operation, so the call from the main Procedure to SubProc will not failSubproc Pssrdsply Return EndsrCallb Ceertx Parm INZ0 StaticParm Omit Select WhenCondition Handlers Enabled Using RPG usingCancel Hdlr Dsply Msg CanHdlr Likely Occur WithEndif Return Condition Handler that Ignores CPF4906MsgSev = Warning Handle information or warning messages, otherwise percolateILE RPG for AS/400 Programmers Guide Using the Dump Operation Code Using the Dump Operation CodeObtaining a Dump Obtaining an ILE RPG Formatted DumpDoes not Occur Formatted Dump¹ If a Dump operation is bypassed By a Goto operation, Dump Qspl Example of a Formatted DumpDump AgementPart 1 of 2. Data section of Formatted Dump 125 Part Data section of Formatted Dump Order Which they are defined Gaps Beginning of user variables, listed in alphabetical order,259 Working with Files and DevicesILE RPG for AS/400 Programmers Guide Associating Files with Input/Output Devices Defining FilesAssociating Files with Input/Output Devices 261Operation Device Dependent Device dependency Is that Compilation Time CertainOperation Code is Valid Only WriteTypes of File Descriptions Naming FilesTypes of File Descriptions Program-Described Using Files withFiles Example of Some Typical Relationships betweenOPTION*EXPDDS Defining Externally Described FilesDefining Externally Described Ignoring Record Formats Renaming Record-Format NamesRenaming Field Names Nbrofcharreplaced. FigureModify an Using Input SpecificationsDescription ExternalIndicator Record You Then Fixed Name Specification Will Get ErrorFiles Used Program This Example FieldUsing Output Specifications For Character Fields zero Level CheckingIs written ALLData Management Operations and ILE RPG I/O Operations Defining Program-Described FilesRPG I/O Operations SEQ SpecialDelete Data Management Operations and ILE RPG I/O OperationsOverriding and Redirecting File Input and Output File ConsiderationsOverriding 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 LockingPath See UsingSharing an Open Data Control For More InformationSpooling SpoolingProgram Details System Open Options Allowed for Each Can SpecifyProgram Versus Output SpoolingSRTSEQ/ALTSEQ Database Files AccessingPhysical Files and Logical Files Data Files and SourceRecord Format Specifications Using Externally Described Disk FilesAccess Path Using Externally Described Disk FilesUnique Contained Physical file CUSMSTP, which is IdentifiedUnique Basdat Edtcdey Dstref Distribution Application Field ReferenceCust Checkmf Addr ReffldnameDisk Valid Keys for a Record FileCity EdtcdejReferring to ArgumentsPartial Key Used, Record Blocking and UnblockingUsing Program-Described Disk Files Using Program-Described Disk FilesIndexed File ValidLogical file ORDDTLL. For the two fields Keyword specifies position 15 as the starting poRecord Address File Sequential File10AIDISK Move Order KEY ChainLimits Records Methods for Processing Disk FilesRelative Record Numbers Methods for Processing Disk FilesADD Consecutive ProcessingSubsequent Text Describes Each Method Processing Examples of Sequential-by-Key Processing Sequential-by-Key ProcessingDatabase Programming Database Programming manualWeekly hours worked Example, the employee master recordFprint YTDRPT1 Related Files EMPL1FEMPL1 Disk Iemprec IrcweekSetoff Read EMPL1 Goto Eofend Move Enum Empno YTDRPT2 Related Files EMPL1Seton Endif Eofend TAG SetonRecords Are Processed as Matching records With For Processing Disk FilesADD Ehwrk Tothrs ADD Tothrs Totovt SetoffSUB Enhrs Ovthrs ADD Ovthrs Totovt Seton Endif OprintExample of Random-by-Key Processing Random-by-Key ProcessingEmstupd Descriptions NnhrsFchange Sequential-within-Limits ProcessingChange Disk Files Examples of Sequential-within-Limits ProcessingLimits ESWLIM1 Related Files EmpmstFlimits Disk 3PIDISK KEYLOC1 FprintFempmst Disk Fprint Relative-Record-Number ProcessingESWLIM2 Related Files Empmst Valid File Operations Valid File OperationsZ/F Recno Starting and Ending Commitment Using Commitment ControlUsing Commitment Control Abridged for See theBackup and Recovery manualCommitment Control Locks Files For UsingSpecifying Concepts,Journal Example of Using Commitment ControlReceiver Update Mastrec Tranrec This command calls the program ReviseControl Disk Commit FtransDDM Files CycleDDM Files ReferDistributedto the Data Pre-V3R1 DDMDDM Files Types of Device Files Chapter AccessingAttached 315Accessing Printer Devices Accessing Printer DevicesSpecifying Printer Files Handling Page OverflowOverflow On an and notline,anoverflowthe linelineis Example of Printing a Field on Every Example of Printing Headings on EveryOANL2 AccountOverf Using the Fetch-OverflowRoutine in Program-Described Files Overflow Printing Setting of the Overflow Indicator Example of Specifying Fetch Overflow Fetch OverflowOPM Prtctl data structure Changing Forms ControlFile Forms Values Contained First four subfieldsDat Accessing Tape Devices Accessing Tape DevicesPrint File Name Associated Data Structure isUsing Sequential Files Accessing Display DevicesUsing Sequential Files OvrdbfUsing Special Files Using Special FilesFile Program nameDescription ErrorStatus Special Pgmnameuserio Example of Using a Special FileFLD Spcl Plist Parm FLD1 Movel Hello Write Excptn Outbuf SetonUserio Are Added To the end of the RPG-created Parameter listProgram User-written routine Function Using Workstn FilesUsing Externally Described Workstn Files On page 333 shows an example of the DDS for a display-devic ¹ OutputPrompt RefdstrefOverlay DescrpDevice Specifying Function Key Indicators on Display Device FilesSpecifying Command Keys Display Processing an Externally Described Workstn File Using SubfilesSfile FieldYou press Specified Function key During Read Use of SubfilesName Search SFL TEXTSubfile RecordSubfil Using Program-Described Workstn FilesUsing Program-Described Workstn Files With Using a Program-DescribedCalculation Specifications Input SpecificationsName FormatInput File Valid Workstn File OperationsOutput File Combined FileRead Operation Exfmt OperationWrite Operation Multiple-Device FilesKeyword. This field Initialized Is updatedDevid Multiple-Device Files Database Physical File Example of an Interactive ApplicationDatabase Physical File 345DDS for a InquiryDisplay Device Main Menu InquiryCusmain RPG Source Main menu will appear as in on Using Crtrpgmod Create Program By enteringFirst option specifies that the first module in the list File Maintenance File MaintenanceCUSMSTL1 DDS for a LogicalDevice DisplayEdtcdez Mode70DATE Edtcdey Cusmnt RPG Source Record Format contains Constant Customer File MaintenanceElse Move OFF Subroutine Addsub PurposeAddsub Begsr Cstkey Chain CMLREC1 Not *IN50 Move Move Update Mode When Move ADD Mode WhenMove Delete Mode When Move Display Mode Endsl MODE1 EndsrCustomer File Maintenance Display ModeCstinq 223021223106 On page 357 a new customer is added to the Customer Mast30/94 Customer 00007 223143Bathurst Avenue ADD ModeDelete Mode Search by ZipSearch by Zip Code CodeRelated Files CUSMSTL2 SzipmenuFile SZIPMENU. IT has REFCUSMSTL2 Printqsysprt IndaraIndicates when to display Subfile When Indicator 55 is Schzip RPG Source ADD Zero Recnum Endsr Write Subctl Move OFFMove OFF Zip File indicator 71 on thRoutine 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 FieldsSnammenu DDS for a Display Device FileFOOT2 SubfileSchnam RPG Source Records Using SubfilesThis Program Prompts the User for the Customer File by the Setll OPERATION. then IT DisplaysExample of an Interactive 367Application File Record Count File Indicator On the Read operationRecnum IncJudah Gould 233948 30/94 Customer 00012 Name Inquiry by NameGould Yorktown371 AppendixesILE RPG for AS/400 Programmers Guide For AS/400 RPG/400 ILEAppendix DifferencesDebugging and Exception RunningRPG III RPG/400 Will Issue Will issue the RNQ1222 inquiry MessageWill issue the RNQ1022 inquiry Message Will IssueDbcs Data in Character Fields Compiler Such Programs Will Get Compilation errorsDifferences Between OPM RPG/400 Conversion Overview Appendix B. Using379 HurryFile Record Length File ConsiderationsUSE Log FileConversion Aid Tool Requirements Converting Your Source Wont DoConverting Your Source AidCvtrpgsrc Command Libl FromfileCurlib FrommbrQrpglesrc TofileNone TombrYES ExpcpyCvtrpt Seclvl YES InsrtplSource DefaultsConverting a Member Using Performing a Trial Conversion Converting All Members in a FileConverting Some Members Cvtrpgsrc FROMFILEOLDRPG/QRPGSRC Frommbrpayroll TOFILE*NONEConverting Auto Report Obtaining Conversion ReportsSource Members CVTRPT*NOData Inserting Specification TemplatesExample of Source Conversion Example of Source ConversionConverted source is shown in on Example Source ConversionTo convert this source, enter ARR2 Analyzing Your Conversion III specifications for ARR2. The Conversion AidAnalyzing Your Conversion DS1Shows Command summary for a sample Conversion Using the ConversionReport Conversion Aid generates a conversion report if you specifyCall PROG1 YourUsing the Log File Lgdate Colhdgcvt Date Qrncvtfm Lgcent Colhdgcvt CentYmmdd Lgtime Colhdgcvt TimeCompilation Errors in Existing RPG III Code Resolving Conversion ProblemsUnsupported RPG III Features Use of the /COPYTEST1 Records Using Context-Sensitive ProblemsMembers in the converted RPG IV source member CompUse of Externally Command Or manually Correct Code After ConversionStructures CharMerging an Array with an Externally Described DS Subfield When convertedInitializing ExtrecBehavior With Run-time DifferencesXYZ Dsone Extnameextrec CharResolving Conversion Problems Using CL Commands Appendix C. The Create CommandsHow to Interpret Syntax Diagrams Reading Syntax DiagramsCrtbndrpg Command Crtbndrpg CommandValues KEYWORDREQUIRED-VALUEAppendix C. The Create Commands407 PGM Description of the Crtbndrpg CommandProgram-name SrcfileGenlvl SrcmbrText SrcmbrtxtNoxref OptionGEN NogenElseif NoextDbgview EventfStmt ListOutput ALLPrint OptimizeDatetime CvtoptGraphic VarcharReplace LangidUsrprf UserChange IssuedUSE ExcludeZoned FixnbrTgtrls PRVInputonly AlwnullBnddir Binding-directory-nameActgrp UsrliblQile NEWCrtrpgmod Command Crtrpgmod CommandPrfdta NocolAppendix C. The Create Commands421 Usrprf Description of the Crtrpgmod commandPF4 PF1423 Appendix D. Compiler ListingsCompiler Listings Compiler Listing Which was Compiled UsingReading a CrtbSource member Module or ProgramCompiler options Indentation MarkEject SectionEndif Sequence Numbers Root ListingsPart 1 of 3. Sample Source Part of the Listing Part 2 of 3. Sample Source Part of the Listing Line Number 1a/ *NOSRCSTMT Source HeadingRuler Line Do NumberAdditional DiagnosticCopy Member Table Output Buffer PositionsTotal Number of Characters Altered Compile-Time DataCharacter to be Altered Alternate SequenceCross-Reference Table Key Field InformationDuedate External References ListFinal Summary Message SummaryN a L M M a R Y Code Generation and Binding ErrorsCompiler Listings 439 BibliographyIddu ILE RPG ILE RPG for AS/400 Programmers Guide Characters Special443 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