ÉÂÔ
Page
 ÉÂÔ
 Third Edition May 1999
 Contents
 SQL
With
 Service Program
Chapter
 Vi ILE
Exception
 Working with Files and Devices
Vii
 RPG
Files
 Appendixes
ILE
 Copy
Index
 Any
Does
Apply
Law
 Marks
Trademarks and Service
Programming Interface Information
Trademarks Or se Marks Others
Page
 Xiv ILE RPG for AS/400 Programmers Guide
 Who Should Use This
About This Guide
Guide
III
 How to Send Your Comments
Prerequisite and Related Information
 UCS-2
What New This
Release?
Risc
 INZ*EXTDFT
INZ*USER
 Element
 CCSID*GRAPH
 Since
To this Guide
Changes
For AS/400
 Xxii ILE RPG for AS/400 Programmers Guide
 ILE RPG Introduction
Program creation strategies
 ILE RPG for AS/400 Programmers Guide
 Input Specifications
RPG IV Specifications
Control Specifications
RPG IV Overview
 The.When You Let Compiler Provide Logic For Your
Cycle Programming
 First
Subprocedure logic
Indicators
Last
 Example of an ILE RPG
Operation Codes
Program
Example of an ILE RPG Program
 Second file
File Description Specifications
Program
 Chain
Output Specifications
Bonus
Eval
 ILE RPG
Subprocedure
Heading Lines That Contain Constant String Payroll
Not
 Fqsysprt Printer
Entire Source Program
Return
 10U 0 Value
Rate
Bonus PAY
Not *IN99 Eval
 OS/400 System
Commonly Used Control Language Commands
Interacting with the System
System Library
 System Offers Full Set Tools That You May find usef
Application Development Manager
 ILE R
Services
AS/400 Tools
 Overview of the RPG IV Programming15 Language
 AS/400 Tools
 RPG Programming in ILE
RPG Programming in ILE
Program Creation
ILE RPG, ILE C, ILE Cobo
 CRTSRVPGM, and Crtpgm commands. They can also Specified
Language You can Create
 Program Call
Procedure Followed Zero Or more subprocedures
Program Management
ILE
 While the progra
Source Debugging
Bindable APIs
 AS/400 now supports multithreading. ILE
Accesses Are Also Threadsafe
Multithreaded Applications
Does Not Directly
 RPG Programming in ILE
 Method
Program Creation Strategies
Strategy 1 OPM-Compatible Application
OPM-Compatible Application
 Example of OPM-Compatible Program
Effect of ILE
 Strategy 2 ILE Program
ILE Program Using Crtbndrpg
Related Information
 XYZ
ILE Program Using Crtbndrpg Example of ILE Program
Shows Run-time view Application in which an ILE CL pr Calls
Although Actual Storage Not Deleted As it
 Strategy 3 ILE Application
ILE Application Using Crtrpgmod
Using
 Scenario
Single-Language ILE Application
 Single-Language Application Using Crtrpgmod and Crtpgm
Mixed-Language ILE Application Scenario
 Advanced Application Scenario
 Strategy to Avoid
Strategy to Avoid
 Activation Group
 Procedures
Creating an Application Using Multiple Procedures
Multiple Procedures Module
Overview
 Like with Multiple Dures
Prototyped Calls
What a module might
Module
 NumToChar
Using prototyped calls you can call with the same syntax
FmtCust Name 100A Address
Numparm 30P 0 Value
 Made Expression Shows Call
Example of Module with
Order to format Name Address Properly
Multiple
 ISO Move
Example of Module with Multiple Procedures
DDS
Else
 Procedures
 ZIP
That
STATE, ZIP
 Module, by Coding
Module
Meaning that it consists only of subprocedur
Keyword on the control specificati
 Entire Arrsrpt Program
Fcustfile Disk Fcustrpt Printer
 Callp
Copy QRPGLE,CVTPROCP
Icustrec
Endsr
 ISO Move Duedate
Following About
Arrsrpt
Return Else Endif
 DDS
 General Considerations
When Coding Module with multiple procedures You Will Want
Coding Considerations
Coding Considerations
 Contain a program entry procedure and only a
Main Procedure Considerations
Subprocedure Considerations
Cannot Contain Bound Procedure Calls
 For Further Information
Main Procedures
Subprocedures
For
 Prototyped Call
For Further Information
 Application
Running an
 ILE RPG for AS/400 Programmers Guide
 Source
Statements
File
Creating a Library
 Entry Utility
Using the Source Entry Utility
Using SEU
 IPP
IPC
Ipcx
Ippr
 Press F3 Exit To the Exit display. Type Y Yes to save
Saved
 Statements Calculation specification Start Your
Using SQL Statements
Using SQL Statements
DB2 UDB
 Utilitymanual for Information about How SEU handles
Reference for more
Refer toADTS thefor AS/400 Source Entry
Statement Syntax Checking
 With
Command
Using the Crtbndrpg Command
 You can use the Crtbndrpg Command interactively Batch From
Shows Their Default Values
 List
Debugged Using a Source View Program Type
Creating a Program for Source Debugging
Creates View similar Compiler listing
 This example you create Program
Binding
Creating a Program with Static
Display Module Source
 ¹ Wrkjob
Command
Bnddir
¹ Wrkoutq queue-name
 Payroll Register Date
Disk Fqsysprt Printer
Chain Emprec Not *IN99
Empname Emprate
 Listing
Using a Compiler Listing
Using a Compiler Listing
Obtaining a Compiler
 Compiler Listing
Customizing a Compiler Listing
Customizing a Page Heading
Xref
 Indenting Structured Operations
Last Update
Customizing the Spacing
PAGE/LINE
 Either Create
Errors
Listing
This Will Add Sec Level text to the messages listed Message
 FLD1
Using In-Line Diagnostic Messages
FLD2
SEU
 Browsing a Compiler Listing Using SEU
Correcting Run-time Errors
Using Additional-Diagnostic Messages
Source Entry Utility
 Coordinating Listing Options with Debug View Options
Using a Compiler Listing for Maintenance
Expdds these are the defaults
Specified, and in the column labeled as Sta Ment
 Area
Data
 Accessing the Returncode Data Area
 Accessing the Returncode Data Area
 Module Object
Commands
Creating
Chapter
 You Create a Module using the Create
Command
Using the Crtrpgmod
 Creates a compiler listing which
Creating a Nomain Module
Requested
Crtrpgmod MODULEMYLIB/TRANSSVC SRCFILEMYLIB/QRPGLESRC
 Files
¹ Dspjob
Then Select option Display4 spooled
Related Files N/A Related Source Transrpt
 Endsl
Other
Endsl Return
 Prod
Creating a Module for
Prototype for TransInc
Prototype for ProdName
 QTY
Ftrnsdta Disk Fqsysprt Printer
Itrnsrec
 Additional Examples
Related CL Commands
RPG, mainthe procedureis
Modules
 Binder
Binding Modules into a Program
Binding Modules into a Program
 Into a
Using
Command
Crtclmod
 Group
 Modules
Export
Concepts for
Trpt
 Using a Binder Listing
Using a Binder Listing
 Changing a Module or Program
Changing a Module or
 Using the Updpgm Command
Level
 Reducing an Objects
Removing Observability
Size
 Changing a
 Changing a Module or Program
 Service Program Overview
Creating a Service Program
Service Program Overview
Dspsrvpgm Payroll DETAIL*PROCEXP *DATAEXP
 Creating a Service Program
Strategies for Creating Service Programs
Creating a Service Program Using Crtsrvpgm
Using Crtsrvpgm
 Changing a Service Program
Service Program Using Crtsrvpgm
 API
Sample Service Program
Sample Service Program
 OPTIONS*VARSIZE
Opdesc
Const OPTIONS*VARSIZE
Ceedod
 Begsr Eval
Exsr
Enddo
DIV MVR
 Strpgmexp Signaturecvthex Export Symbolcvttohex Endpgmexp
Creating the Service Program
Parameters Crtsrvpgm command
Input String Charactern Output Hex string Character2 * n
 Crtrpgmod MODULEMYLIB/CVTHEXPGM SRCFILEMYLIB/QRPGLESRC
Binding to a Program
Create the program by typing
Call Cvthexpgm
 Except
Copy RPGGUIDE/QRPGLE,CVTHEXPR
Clear Callp
Clear
 Updating the Service
Sample Binder Listing
 Basic Binder listing for Cvthexpgm
 Sample Service Program
 Running a Program
Running a Program Using the CL Call Command
Running a Program Using
103
 Passing Parameters using
 106 shows DDS That is Referenced by the EMPRPT2 Source
 Running a Program From a
Application
Running a Program From a Menu-Driven Application
Selecting Option Design menus
 RPGCHG, or Rpgadd respectively
You Run Menu by Entering
Rpginq
 Replying to Run-Time Inquiry Messages
Command
Running a Program Using User-Created
Replying to Run-Time Inquiry
 Managing Activation
Ending an ILE Program
Groups
Wheresequence-no
 Group
Managing Activation Groups
Specifying an Activation
OFF
 Running in the OPM
Default
Compatibility
Activation
 Group
Reclaim Resources Command
Deleting an Activation
Activation Groups Such
 Managing the Default Heap Using RPG Operations
Referenceto Abridged
 Dsply
Managing Dynamically-Allocated Storage
INZ*NULL
 Elem@ = next@
AddName 40A
Alloc
 = *NULL
Namelen = %len%trimrname
 Null DOW
 Heap Storage Problems
Dealloc
 Bindable APIs
RPG procedure This
Managing Your Own Heap
Call Somepgm
 SeeAPI theReference
Dynarray
 Ceecrhp
Copy Dynarri
Ceegtst
 Initalloc
Subsalloc
 ADD Initalloc
Reset
Dynainit
Enddo Dynainit
 Exsr Realloc Endif Eval
Dynaset Export
Ifgt
Realloc Begsr
 Dynaget Export
Else ADD Subsalloc
Enddo Endsr Dynaset
Ifle
 Get Heap Storage
Crtsrvpgm
 Program/Procedure Call Overview
Calling Programs and Procedures
Program/Procedure Call Overview
127
 Static
Calling Procedures
Calling Programs
 Stack
Call Stack
Call stack
 That Most r Stack Entry is Bottom
Recursive Calls
Recursive calls are only allowed For
 Parameter-Passing Considerations
Recent Caller
 Program/Procedure Call Overview
 RPG Prototyped calls Are also Known
Using the Callp Operation
¹ Subprocedures in the same module
Callp
 31A
Using a Prototyped Call
Calling within an Expression
30P
 Parameter Passing Styles
Examples of Free-Form Call
Passing Prototyped Parameters
Passing by Reference
 Passing by Value
Figures below
 Docalc Export
Passing
Extprocdocalc
Docalc
 Ceetsta Extprocceetsta
Using Operational Descriptors
ILE CEE API
 OPTIONS*OMIT
When Calling Procedure You may sometimes want Leave Out Par
Omitting Parameters
Omit
 OPTIONS*OMIT*NOPASS
Passing *OMIT
Leaving Out Parameters
API Qcmdexc
 Passing Prototyped Parameters Checking for the Number
Psds
 Eval Address = %TRIMRCSTREET# + +
Copy Fmtaddrp
OPTIONS*NOPASS Const
Trimrprovince Return
 Endif Endsr
Begsr Movel
Check
 Ctdata
144
OPTIONS*NOPASS
5P 0 DIM2 Ctdata
 Parameters
To create PRTADDR, using the source in on page 144, typ
Passing Less Data Than Required
To create the program, PRTADDR, type
 Effect
Order of Evaluation
Interlanguage Calls
 To obtain Actual Returned value
Interlanguage
Calling Considerations
DCL &RET2 TYPE*CHAR LEN2 DCL &RET1 TYPE*CHAR LEN1
 Call Operations
Fixed-Form
 Operation Operation extender is Used With
Using the Fixed-Form Call Operations
For Callb only
 Operations
Passing Parameters Using Parm
Examples of Call and Callb
Operation
 Plist
Using the Plist Operation
Fixed-Form Call Operations
 Normal End
Returning from a Main Procedure
Procedure
Returning from a Called
 Entry Parm operation is perfor
Returning from a Called Program or Procedure
Abnormal End
 For the AS/400 Reference
Returning from a Subprocedure
Without
Retu
 Subprocedure ends abnormally
Using Bindable APIs
Returning using ILE Bindable
APIs
 Calling a Graphics Routine
Examples of Using Bindable APIs
Calling a Graphics Routine
Ceeutx
 Multithreading Considerations
Calling Special Routines
Multithreading Considerations
TheGDDM Programming Guide
 Share Data
How to
Across
 How
Example, consider the situation where two procedures Called
Will Wait For MOD1 Unlock. Procedures Not
To Avoid Deadlock
 MOD2
Considerations
PROC1
MOD1
 Debugging and Exception Handling
161
 ILE RPG for AS/400 Programmers Guide
 ILE Source Debugger
Debugging Programs
ILE Source Debugger
163
 Equate
Debug Commands
Attr
Eval
 Watch
Tbreak
Thread
Find
 Preparing a Program for
Order Debug it using
Preparing a Program for Debugging
Source
 Crtbndrpg PGMMYLIB/DEBUGEX SRCFILEMYLIB/QRPGLESRC
Creating a Root Source View
Options On the Dbgview parameter for Either
Crtrpgmod MODULEMYLIB/DBGEX SRCFILEMYLIB/QRPGLESRC
 Dbgview
Listing View
View
Module
 View
Program for Debugging
 OPMSRC*NO
Starting the ILE Source
Starting the ILE Source Debugger
 Start a Debug Session for the sample debug program Debugex
Setting Debug Options
Strdbg Example
Into
 SET
OPM source debug support field,
 Adding/Removing Programs from a Debug Session
Example of Adding a Service
Example of Removing ILE Programs from a Debug Session
Debug Session
 Cobol
Viewing the Program Source
Viewing the Program Source
Lstdbg ILE
 Libl PGM
Viewing a Different
Dbgex
 Several Different views
Changing the View of a
Module
Cproc
 Specified You Not Erate Breakpoints Specify
Setting and Removing Breakpoints
Setting and Removing Breakpoints
OPTION*NODEBUGIO
 Debug Command to set a job breakpoint
Setting and Removing
With the source positioned at the line where the breakpoint
Breakpoints
 Breakpoint
Setting an
Job
 Debug
Setting and Removing Unconditional Thread Breakpoints
Debug Command Sets a Thread breakpo Single Current
Greater Than Equal To one
 Job
Breakpoints
 Conditional Breakpoint
Example of Setting a Conditional Job Breakpoint Using F13
Line
Work with Module Breakpoints
 Break 128 when BigDate=1994-09-30
Command
Setting a Conditional Job Breakpoint Using
National Language Sort Sequence Nlss
 Control Spec Tion Is not available
Sort Sequence
 Main procedure or one of the subprocedures
On the debug command line
One procedure per module,procedurethe -namecan Either
Varia
 Set Breakpoint For Module with
This Example Statement View Is used to Set Breakpoint For
Set a breakpoint for Module With
Listing, type
 Procedurevariables-name and statement-number
Setting and Removing Conditional Thread Breakpoints
Using the Work with Module Breakpoints Display
Main Procedure Exit
 Removing All Job
Debug Commands
Setting and Removing Watch Conditions
Conditions
 Program statemen
Characteristics of Watches
Display
You Debug One Job From Another
 Watch
Setting Watch Conditions
On the debug command line, without any parameters
Salary
 Payroll
¹ To specify a variable or expression to be watched, type
Payroll ABC PGM
 Enddbg
Displaying Active Watches
Removing Watch Conditions
IPL
 BlankDisplay Module Source
Example of Setting a Watch Condition
Example of Setting a Watch Condition
Display as shown below. Instead
 Stepping Through
Object
Stepping Through the Program Object
 Subroutines You Can
Over Into Subprocedures
Stepping Over Call Statements
 TIP
Stepping Into Call Statements
Step Into
 From Program
F22
This example, you use F22 Step Into to step Into the OPM
Debugex
 Step completed at line
This example, you use F22 Step Into to Subpr Which Module
InputParm
 Else
Switch
Displaying Data and Expressions
 On page 201 shows Use
Const
 Based Fields
Unexpected Results when Evaluating Variables
Scalar Fields RPG Definition
Date, Time, Timestamp Fields
 Displaying the Contents of an Array
Displaying the Contents of a Table
 Displaying Data Structures
Eval DS12
 Displaying Indicators
Which is discussed Below
 Displaying Fields as Hexadecimal Values
Character Format
 By Pointers
Data
Displaying Variable-Length Fields
Displaying Null-Capable Fields
 STRING=%SUBSTRBIGDATE 1 4 =
String = 1ABCD6
 Fields
 Changing the Value of Fields
= Abcdef
 Displaying Attributes of a Field
Or Command
Equating a Name with a Field, Expression, or Command
Equating a Name with
 Examples
For
Sample Source for Debug Examples
 To create the program DEBUGEX, type
Program using Source 215, type
Sample Source for Debug Examples
First Module
 Inzabcde
DIM3 Ctdata
DS1
DS2
 Call Rpgpgm
Occur DS2 Move
Plist Parm
 Entry Plist Parm
Dump Seton
Else Eval
Dsply Seton
 Source for C Procedure cproc. cproc is called by Dbgex
 Exception Handling Overview
Handling Exceptions
Exception Handling Overview
217
 Describes Status Work Being done by a program
Indicates That Severe error has been detected
Program Procedure P1 is Contro Boundary
Call st
 Exception Message
Active on
 Exception Handling within
Dure will Only Handle Errors That Subprocedure
ILE RPG Exception Handling
 Operation For
 OPM
PGM C
 Exception Handler Priority
Using Exception Handlers
Using Exception Handlers
Nested Exceptions
 PGM2
For other Types Messages
Escape Message
PRC1
 PGM1
Example of Unhandled Function Check
Operation as well
PGM2, each Containing a procedur
 For More Information Optimization See Changing Level
Using RPG-Specific Handlers
Optimization Considerations
Built-in-functions
 Extender
This Section Provides Some Examples How to Use Each These R
Infsr error Subroutines, on Exsr Operation Code Infds
ILE RPG For AS/400 Reference provides
 Operation. If Either
Using an Error Subroutine
Program Error
Explicitly c
 Using a File Error Infsr Subroutine
 PrdInfds PrdStatus
INFSRPrdInfsr INFDSPrdInfds
Disk Ftrnbacklg O Fprint Printer
Status
 Infds
 After Keyword
Using a Program Error Subroutine
Position Definition Specification Enter
Operation With Factor Entry
 Pssr Begsr
Parms
Proc Body of Code Goes Here
Move Getin
 TAG DIV
If this is a divide-by-zero error, add 1 to the divisor
If control reaches ENDSR, the procedure will fail
Try again Err =
 Which is designed to ge
Exceptions Order Show how to avoid looping Within
Pssr
Subrou
 Else ADD
After the Else
Move Inlr
 Specifying a Return Point
OFL
 ILE Condition Handlers
Using a Condition Handler
ILE Condition Handlers
Handlers
 LIKECondTok
132
Printer Rpghdlr
Action 10I OutCondTok LIKECondTok
 Condition Handler
Shows Source For Procedure
Is registered Procedure Parameters Include Pointer
Communication Area Which Contains Pointer
 ARR1
Ceehdlu
 SDS Noopt
Procptr
Noopt
Proc
 Subst
Begsr Callp
 Ceertx
Cancel Handlers
244
Ceeutx ILE
 Subproc Pssrdsply
Procedure to SubProc will not fail
Pssr has a Return operation, so the call from the main
Return Endsr
 Parm Omit
INZ0 Static
Callb Ceertx Parm
Select When
 Cancel Hdlr Dsply Msg CanHdlr
RPG using
Condition Handlers Enabled Using
Likely Occur With
 Condition Handler that Ignores CPF4906
Endif Return
 Handle information or warning messages, otherwise percolate
MsgSev = Warning
 ILE RPG for AS/400 Programmers Guide
 Obtaining a Dump
Using the Dump Operation Code
Using the Dump Operation Code
Obtaining an ILE RPG Formatted Dump
 Does not Occur
Formatted Dump
¹ If a Dump operation is bypassed By a Goto operation,
 Dump
 Example of a Formatted Dump
Qspl
 Agement
Dump
 Part 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 Gaps
 Working with Files and Devices
259
 ILE RPG for AS/400 Programmers Guide
 Associating Files with Input/Output Devices
Defining Files
Associating Files with Input/Output Devices
261
 Operation Code is Valid Only
Compilation Time Certain
Operation Device Dependent Device dependency Is that
Write
 Types of File Descriptions
Naming Files
Types of File Descriptions
 Files
Using Files with
Program-Described
Example of Some Typical Relationships between
 OPTION*EXPDDS
Defining Externally Described Files
Defining Externally Described
 Renaming Field Names
Renaming Record-Format Names
Ignoring Record Formats
Nbrofcharreplaced. Figure
 Description
Using Input Specifications
Modify an
External
 Files
You Then Fixed Name Specification Will Get Error
Indicator Record
Used Program This Example Field
 Using Output Specifications
 Is written
Level Checking
For Character Fields zero
ALL
 RPG I/O Operations
Defining Program-Described Files
Data Management Operations and ILE RPG I/O Operations
SEQ Special
 Data Management Operations and ILE RPG I/O Operations
Delete
 Overriding and Redirecting File Input and Output
File Considerations
Overriding and Redirecting File Input and Output
273
 Example of Redirecting
Input Output
Input Output
FMT1
 Data Management manual
File Locking
File Locking
Program Can Chang Allocate Object
 Record Locking
Record Locking
 Sharing an Open Data
See Using
Path
Control For More Information
 Program Details System Open Options Allowed for Each
Spooling
Spooling
Can Specify
 Output Spooling
Program Versus
 SRTSEQ/ALTSEQ
 Physical Files and Logical Files
Accessing
Database Files
Data Files and Source
 Access Path
Using Externally Described Disk Files
Record Format Specifications
Using Externally Described Disk Files
 Unique
Contained Physical file CUSMSTP, which is Identified
Unique
 Cust Checkmf
Dstref Distribution Application Field Reference
Basdat Edtcdey
Addr Reffldname
 City
Valid Keys for a Record File
Disk
Edtcdej
 Referring to
Arguments
Partial Key
 Record Blocking and Unblocking
Used,
 Indexed File
Using Program-Described Disk Files
Using Program-Described Disk Files
Valid
 Keyword specifies position 15 as the starting po
Logical file ORDDTLL. For the two fields
 10AIDISK
Sequential File
Record Address File
Move Order KEY Chain
 Relative Record Numbers
Methods for Processing Disk Files
Limits Records
Methods for Processing Disk Files
 ADD
Consecutive Processing
Subsequent Text Describes Each Method Processing
 Database Programming
Sequential-by-Key Processing
Examples of Sequential-by-Key Processing
Database Programming manual
 Example, the employee master record
Weekly hours worked
 FEMPL1 Disk
YTDRPT1 Related Files EMPL1
Fprint
Iemprec Ircweek
 Seton Endif
YTDRPT2 Related Files EMPL1
Setoff Read EMPL1 Goto Eofend Move Enum Empno
Eofend TAG Seton
 For Processing Disk Files
Records Are Processed as Matching records With
 SUB Enhrs Ovthrs
ADD Tothrs Totovt Setoff
ADD Ehwrk Tothrs
ADD Ovthrs Totovt Seton Endif Oprint
 Emstupd Descriptions
Random-by-Key Processing
Example of Random-by-Key Processing
Nnhrs
 Fchange
Sequential-within-Limits Processing
Change
 Examples of Sequential-within-Limits Processing
Disk Files
 Flimits Disk
ESWLIM1 Related Files Empmst
Limits
3PIDISK KEYLOC1 Fprint
 Fempmst Disk Fprint
Relative-Record-Number Processing
ESWLIM2 Related Files Empmst
 Valid File Operations
Valid File Operations
 Z/F
 Recno
 Starting and Ending Commitment
Using Commitment Control
Using Commitment Control
 Abridged for
See theBackup and Recovery manual
Commitment Control Locks
 Specifying
Using
Files For
Concepts,
 Journal
Example of Using Commitment Control
Receiver
 Control
This command calls the program Revise
Update Mastrec Tranrec
Disk Commit Ftrans
 DDM Files
Cycle
DDM Files
 Pre-V3R1 DDM
ReferDistributedto the Data
 DDM Files
 Attached
Accessing
Types of Device Files Chapter
315
 Specifying Printer Files
Accessing Printer Devices
Accessing Printer Devices
Handling Page Overflow
 Overflow
 On an and notline,anoverflowthe linelineis
 OANL2
Example of Printing Headings on Every
Example of Printing a Field on Every
Account
 Overf
Using the Fetch-Overflow
Routine in Program-Described Files
 Overflow Printing Setting of the Overflow Indicator
 Fetch Overflow
Example of Specifying Fetch Overflow
 OPM Prtctl data structure
Changing Forms Control
File
 Forms
Values Contained First four subfields
Dat
 Print
Accessing Tape Devices
Accessing Tape Devices
File Name Associated Data Structure is
 Using Sequential Files
Accessing Display Devices
Using Sequential Files
Ovrdbf
 File
Using Special Files
Using Special Files
Program name
 Description
Error
Status
 FLD
Example of Using a Special File
Special Pgmnameuserio
Spcl Plist Parm FLD1 Movel Hello Write Excptn Outbuf Seton
 Userio
Are Added To the end of the RPG-created Parameter list
Program User-written routine
 Function
Using Workstn Files
Using Externally Described Workstn Files
 ¹ Output
On page 333 shows an example of the DDS for a display-devic
 Overlay
Refdstref
Prompt
Descrp
 Device
Specifying Function Key Indicators on Display Device Files
Specifying Command Keys Display
 Using Subfiles
Processing an Externally Described Workstn File
 Field
Sfile
 Name Search
Use of Subfiles
You press Specified Function key During Read
SFL TEXTSubfile Record
 Subfil
Using Program-Described Workstn Files
Using Program-Described Workstn Files
 Using a Program-Described
With
 Name
Input Specifications
Calculation Specifications
Format
 Output File
Valid Workstn File Operations
Input File
Combined File
 Write Operation
Exfmt Operation
Read Operation
Multiple-Device Files
 Keyword. This field Initialized
Is updated
Devid
 Multiple-Device Files
 Database Physical File
Example of an Interactive Application
Database Physical File
345
 Display Device
Inquiry
DDS for a
Main Menu Inquiry
 Cusmain RPG Source
 Main menu will appear as in on
Using Crtrpgmod Create Program By entering
First option specifies that the first module in the list
 CUSMSTL1 DDS for a
File Maintenance
File Maintenance
Logical
 Display
Device
 Edtcdez
Mode
70DATE Edtcdey
 Record Format contains Constant Customer File Maintenance
Cusmnt RPG Source
 Else Move OFF
Subroutine Addsub Purpose
Addsub Begsr Cstkey Chain CMLREC1 Not *IN50 Move
 Move Delete Mode When
Move ADD Mode When
Move Update Mode When
Move Display Mode Endsl MODE1 Endsr
 Cstinq
Display Mode
Customer File Maintenance
223021
 30/94 Customer 00007
On page 357 a new customer is added to the Customer Mast
223106
223143
 Bathurst Avenue
ADD Mode
Delete Mode
 Search by Zip Code
Zip
Search by
Code
 File SZIPMENU. IT has
Szipmenu
Related Files CUSMSTL2
REFCUSMSTL2 Printqsysprt Indara
 Indicates when to display Subfile When Indicator 55 is
 Schzip RPG Source
 ADD Zero Recnum Endsr
Write Subctl Move OFF
Move OFF
 Routine Fills Subfile Record Read From
File indicator 71 on th
Zip
Subfile Is written to the screen as shown in on
 For Database File Used This Program Defines one reco
Search and Inquiry by Name
Search and Inquiry by Name
Identifies Name field Key Fields
 FOOT2
Device File
Snammenu DDS for a Display
Subfile
 This Program Prompts the User for the Customer
Records Using Subfiles
Schnam RPG Source
File by the Setll OPERATION. then IT Displays
 Example of an Interactive 367Application
 Recnum
File Indicator On the Read operation
File Record Count
Inc
 Judah Gould
 Gould
Inquiry by Name
233948 30/94 Customer 00012 Name
Yorktown
 Appendixes
371
 ILE RPG for AS/400 Programmers Guide
 Appendix
RPG/400 ILE
For AS/400
Differences
 Running
Debugging and Exception
 RPG III
 Will issue the RNQ1022 inquiry Message
Will issue the RNQ1222 inquiry Message
RPG/400 Will Issue
Will Issue
 Compiler Such Programs Will Get Compilation errors
Dbcs Data in Character Fields
 Differences Between OPM RPG/400
 379
Appendix B. Using
Conversion Overview
Hurry
 File Considerations
File Record Length
 USE
Log File
Conversion Aid Tool Requirements
 Converting Your Source
Wont Do
Converting Your Source
Aid
 Cvtrpgsrc Command
 Curlib
Fromfile
Libl
Frommbr
 None
Tofile
Qrpglesrc
Tombr
 Cvtrpt
Expcpy
YES
Seclvl YES Insrtpl
 Source
Defaults
Converting a Member Using
 Converting Some Members
Converting All Members in a File
Performing a Trial Conversion
Cvtrpgsrc FROMFILEOLDRPG/QRPGSRC Frommbrpayroll TOFILE*NONE
 Source Members
Obtaining Conversion Reports
Converting Auto Report
CVTRPT*NO
 Example of Source Conversion
Inserting Specification Templates
Data
Example of Source Conversion
 Converted source is shown in on
Example Source Conversion
To convert this source, enter
 ARR2
 Analyzing Your Conversion
III specifications for ARR2. The Conversion Aid
Analyzing Your Conversion
DS1
 Report
Using the Conversion
Shows Command summary for a sample Conversion
Conversion Aid generates a conversion report if you specify
 Your
Call PROG1
 Using the Log File
 Ymmdd
Qrncvtfm Lgcent Colhdgcvt Cent
Lgdate Colhdgcvt Date
Lgtime Colhdgcvt Time
 Unsupported RPG III Features
Resolving Conversion Problems
Compilation Errors in Existing RPG III Code
Use of the /COPY
 TEST1
 Members in the converted RPG IV source member
Context-Sensitive Problems
Records Using
Comp
 Structures
Command Or manually Correct Code After Conversion
Use of Externally
Char
 Initializing
When converted
Merging an Array with an Externally Described DS Subfield
Extrec
 XYZ
Run-time Differences
Behavior With
Dsone Extnameextrec Char
 Resolving Conversion Problems
 How to Interpret Syntax Diagrams
Appendix C. The Create Commands
Using CL Commands
Reading Syntax Diagrams
 Values
Crtbndrpg Command
Crtbndrpg Command
KEYWORDREQUIRED-VALUE
 Appendix C. The Create Commands407
 Program-name
Description of the Crtbndrpg Command
PGM
Srcfile
 Text
Srcmbr
Genlvl
Srcmbrtxt
 GEN
Option
Noxref
Nogen
 Noext
Elseif
 Stmt
Eventf
Dbgview
List
 Print
ALL
Output
Optimize
 Graphic
Cvtopt
Datetime
Varchar
 Usrprf
Langid
Replace
User
 USE
Issued
Change
Exclude
 Tgtrls
Fixnbr
Zoned
PRV
 Bnddir
Alwnull
Inputonly
Binding-directory-name
 Qile
Usrlibl
Actgrp
NEW
 Prfdta
Crtrpgmod Command
Crtrpgmod Command
Nocol
 Appendix C. The Create Commands421
 PF4
Description of the Crtrpgmod command
Usrprf
PF1
 423
Appendix D. Compiler Listings
Compiler Listings
 Reading a
Which was Compiled Using
Compiler Listing
Crtb
 Compiler options
Module or Program
Source member
Indentation Mark
 Eject
Section
Endif
 Listings
Sequence Numbers Root
 Part 1 of 3. Sample Source Part of the Listing
 Part 2 of 3. Sample Source Part of the Listing
 Ruler Line
1a/ *NOSRCSTMT Source Heading
Line Number
Do Number
 Diagnostic
Additional
 Output Buffer Positions
Copy Member Table
 Character to be Altered
Compile-Time Data
Total Number of Characters Altered
Alternate Sequence
 Key Field Information
Cross-Reference Table
 External References List
Duedate
 Message Summary
Final Summary
 Code Generation and Binding Errors
N a L M M a R Y
 Compiler Listings
 Bibliography
439
 Iddu
 ILE RPG
 ILE RPG for AS/400 Programmers Guide
 Characters
Special
443
 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
 Éâôù