AS/400e
ILE RPG for AS/400 Programmers Guide
Version
Page
AS/400e
ILE RPG for AS/400 Programmers Guide
Version
comments
Third
Edition
1999
RPG Introduction
Contents
with
Chapter
a Service Program
Creating
Debugging
vi ILE
Handling
Chapter 14. Defining Files
Working with Files and Devices
Files
Files
RPG for
Appendixes
Appendix B. Using the RPG III to RPG
Chapter 19. Example of an
COPY
Index
are inconsistent
Notices
country
such provisions
Programming Interface Information
Trademarks and Service
Notices
xiv ILE RPG for AS/400 Programmers Guide
Guide
About This Guide
Who Should Use This
Prerequisite and Related Information
How to Send Your Comments
s New This
What
Release?
EVALR
NODEBUGIO
EVAL
Numbers
About This Guidexix
Element
Element
xx ILE RPG for AS/400 Programmers Guide
Changes
to this Guide
xxii ILE RPG for AS/400 Programmers Guide
ILE RPG Introduction
2 ILE RPG for AS/400 Programmers Guide
section
RPG IV Specifications
Chapter 1. Overview
RPG IV Overview
RPG IV Overview
Cycle Programming
Figure 1. RPG Program Logic Cycle
The first
Subprocedure logic
Indicators
RPG IV Overview
Example of an ILE RPG Program
Operation Codes
Program
Example of an ILE RPG
Control Specifications
Program
File Description Specifications
RATE
Output Specifications
Example of an ILE RPG Program
NAME
Chapter 1. Overview of the RPG IV Programming9 Language
A Subprocedure
Example of an ILE RPG Program
REGISTER
for the week
Example of an ILE RPG Program
The Entire Source Program
This program creates a printed output of employees pay
Figure 4 Part 2 of 3. A Sample Payroll Calculation Program
Example of an ILE RPG Program
Chapter 1. Overview of the RPG IV Programming11Language
Using
Using
Interacting with the System
OS/400 System
for AS/400
Tools
Application Development
AS/400 Tools
AS/400 Tools
IBM VisualAge RPG and Cooperative Development Environment for AS/400
¹ Program verification- performs, at the workstation, the full range o
AS/400 Tools
16 ILE RPG for AS/400 Programmers Guide
AS/400 Tools
Program Creation
Chapter 2. RPG Programming in ILE
RPG Programming in ILE
or CRTSRVPGM
RPG Programming in ILE
Figure 5. Program Creation in ILE
Program Call
Program Management
in ILE
shown
Source Debugging
Bindable APIs
RPG Programming in ILE
THREAD*SEREALIZE
Multithreaded Applications
RPG Programming in ILE
suppo
22 ILE RPG for AS/400 Programmers Guide
RPG Programming in ILE
OPM-Compatible Application
Chapter 3. Program Creation Strategies
Strategy 1 OPM-Compatible Application
Method
Effect of ILE
Example of OPM-Compatible Program
OPM-Compatible Application
CRTBNDRPG
Using
ILE Program Using CRTBNDRPG
Related Information
Figure 7. ILE Program Using CRTBNDRPG
Example of ILE Program
Using
ILE Program Using CRTBNDRPG
Related Information
ILE Application Using CRTRPGMOD
CRTRPGMOD
Strategy 3 ILE Application
Single-Language ILE Application
Scenario
ILE Application Using CRTRPGMOD
Method
ILE Application Using CRTRPGMOD
Mixed-Language ILE Application Scenario
Figure 8. Single-Language Application Using CRTRPGMOD and CRTPGM
ILE Application Using CRTRPGMOD
Advanced Application Scenario
Mixed-Language Application
Related Information
A Strategy to Avoid
A Strategy to Avoid
Service
split
the default activation group and any named activation
A Strategy to Avoid
When
Multiple Procedures Module
Chapter 4. Creating an Application Using Multiple Procedures
Multiple Procedures Module
Prototyped Calls
MODULE
13. Prototype for FmtCust Procedure
Multiple Procedures Module
Prototype for procedure FmtCust Note the PR on definition
specification. It has two output parameters
Multiple
Example of Module with
Example of Module with Multiple Procedures
NumToC
Procedures
in Fmt
module
Example of Module with Multiple Procedures
Figure 22 Part
The Entire ARRSRPT Program
Example of Module with Multiple Procedures
ARRSRPT *PGM ARRSRPT *MODULE Main Procedure InArrears FmtCust
42 ILE RPG for AS/400 Programmers Guide
Example of Module with Multiple Procedures
Figure 22 Part
ILE RPG Complete Source for ARRSRPT Module
DaysLate*D
Example of Module with Multiple Procedures
Chapter 4. Creating an Application Using Multiple43 Procedures
SUBDUR
ARRSRPT
Output for ARRSRPT
General Considerations
Coding Considerations
Coding Considerations
Coding Considerations
Main Procedure Considerations
Subprocedure Considerations
Program Creation
Subprocedures
Main Procedures
For Further Information
For Further Information
Prototyped Call
Creating
Application
50 ILE RPG for AS/400 Programmers Guide
Source
Statements
File
Chapter 5. Entering
Using SEU
Using the Source Entry Utility
Using SEU
28. Source for EMPRPT member
Using SEU
Procedure EMPTYPE returns a string representing the employee
type indicated by the parameter CODE
Using SQL Statements
Using SQL Statements
Refer toADTS thefor AS/400 Source Entry
Using SQL Statements
for AS/400 SQL Programming manual and theDB2 UDB for AS/400 SQL
Reference for more
CRTBNDRPG
Command
Using the CRTBNDRPG Command
Using the CRTBNDRPG
Creation
Using the CRTBNDRPG Command
Listing
Options
Using the CRTBNDRPG Command
Creating a Program for Source Debugging
Considerations
Creating a Program with Static
Binding
Using the CRTBNDRPG Command
Creating an OPM-Compatible
Command
Using
¹ WRKOUTQ queue-name
Figure 32 Part 2 of 2. A Sample Payroll Calculation Program
Using the CRTBNDRPG Command
Part
A Sample Payroll Calculation Program
Obtaining a Compiler
Using a Compiler Listing
Using a Compiler Listing
Listing
Using
Customizing a Compiler Listing
Customizing a Page Heading
a Compiler Listing
The /SPACE
Customizing the Spacing
Indenting Structured Operations
Using a Compiler Listing
Using
Errors
Listing
Compilation
Using a
Using In-Line Diagnostic Messages
Compiler Listing
Using a Compiler Listing
Correcting Run-time Errors
Using Additional-Diagnostic Messages
Browsing a Compiler Listing Using SEU
Using a Compiler Listing
Using a Compiler Listing for
Maintenance
Coordinating Listing Options with Debug View Options
Data
Area
Chapter 6. Creating a Program with the CRTBNDRPG Command71
Accessing the RETURNCODE Data Area
72 ILE RPG for AS/400 Programmers Guide
Accessing the RETURNCODE Data Area
Chapter
Commands
7. Creating
a Module Object
Using the CRTRPGMOD
Command
Creating a Module Object
Creating a Module Object
Creating a NOMAIN Module
COPY TRANSP
Creating a Module Object
Figure 36 Part 1 of 3. Source for TRANSSVC member
Part
Creating a Module Object
Part
Source for TRANSSVC member
Creating a Module Object
Creating a Module for
Debugging
Source for TRANSRPT module
Creating a Module Object
OFLIND*INOF
Behavior of Bound ILE
Related CL Commands
Additional Examples
Modules
Program
Binding Modules into a
Binding Modules into a Program
into a
Using
CRTPGM
Group
Binding Modules into a Program
Value
CRTRPGMOD MODULEMYLIB/TRANSSVC
Binding Modules into a Program
Concepts for
CRTRPGMOD MODULEMYLIB/TRANSRPT
Additional Examples
Using a Binder Listing
Using a Binder Listing
Related CL Commands
FULL
Changing a Module or Program
Changing a Module or
BASIC
Changing a Module or Program
Using the UPDPGM Command
Level
Changing the Optimization
Changing a Module or Program
Removing Observability
Size
Reducing an Objects
Changing a
90 ILE RPG for AS/400 Programmers Guide
Changing a Module or Program
Service Program Overview
Chapter 8. Creating a Service Program
Service Program Overview
Creating a Service Program Using CRTSRVPGM
Strategies for Creating Service Programs
Creating a Service Program
Related CL commands
Changing A Service Program
a Service Program Using CRTSRVPGM
Sample Service Program
Sample Service Program
Figure 42 Part 1 of 2. Source for Service Program CvtToHex
Sample Service Program
Chapter 8. Creating a Service Program95
96 ILE RPG for AS/400 Programmers Guide
Sample Service Program
Source for Service Program CvtToHex
42 Part
Figure 44. Source for Binder Language for CvtToHex
Creating the Service Program
Sample Service Program
43. Source for /COPY Member with Prototype for CvtToHex
98 ILE RPG for AS/400 Programmers Guide
Binding to a Program
Sample Service Program
MODUL
Program to test Service Program CVTTOHEX
Sample Service Program
to an
Updating the Service
Sample Binder Listing
add a
Chapter 8. Creating a Service Program101
Sample Service Program
Basic Binder listing for CVTHEXPGM
102 ILE RPG for AS/400 Programmers Guide
Sample Service Program
Chapter 9. Running a Program
Running a Program Using the CL CALL Command
CALL
Passing Parameters using the
Running a Program Using the CL CALL Command
Part
Running a Program Using the CL CALL Command
Part
ILE RPG Program that Requires Parameters at Run Time
Running a Program From a Menu-Driven Application
Application
Running a Program From a
Figure 51. Source for Menu Program
Figure 50. Data Description Specification of an Application Menu
Running a Program From a Menu-Driven Application
A* CMDPROMPT
Replying to Run-Time Inquiry Messages
Command
Replying to Run-Time Inquiry
Groups
Ending an ILE Program
Managing Activation
Specifying an Activation
Managing Activation Groups
Group
Compatibility
Default
Running in the OPM
Managing Activation Groups
Reclaim Resources Command
Deleting an Activation
Group
Managing Dynamically-Allocated
Managing the Default Heap Using RPG Operations
Storage
Name?
Managing Dynamically-Allocated Storage
ENDDO
Chapter 9. Running a Program115
Managing Dynamically-Allocated Storage
next@
116 ILE RPG for AS/400 Programmers Guide
Managing Dynamically-Allocated Storage
name@
Chapter 9. Running a Program117
Managing Dynamically-Allocated Storage
52 Part
4 of 5. Memory Management - Build a Linked List of Names
Managing Dynamically-Allocated Storage
Heap Storage Problems
of 5. Memory Management - Build a Linked List of Names
Managing Dynamically-Allocated Storage
Managing Your Own Heap
Bindable APIs
SeeAPI theReference
Managing Dynamically-Allocated Storage
54. /COPY file DYNARRI containing prototypes for DYNARRAY module
Chapter 9. Running a Program121
Managing Dynamically-Allocated Storage
Part
of 2. Global variables and local prototypes for DYNARRAY
2 of
Figure 56 on page 123 shows the subprocedures in DYNARRAY
Managing Dynamically-Allocated Storage
Figure 55 Part
Part
DYNARRAY Subprocedures
DYNARRAY Subprocedures
Managing Dynamically-Allocated Storage
124 ILE RPG for AS/400 Programmers Guide
DYNARRAY Subprocedures
Managing Dynamically-Allocated Storage
Part 3 of
Part
DYNARRAY Subprocedures
DYNARRAY Subprocedures
Managing Dynamically-Allocated Storage
Managing Dynamically-Allocated Storage
The logic of the subprocedures is as follows
Program/Procedure Call Overview
Chapter 10. Calling Programs and Procedures
Program/Procedure Call Overview
calls
Calling Procedures
Calling Programs
Program/Procedure Call Overview
stack
The Call Stack
Program/Procedure Call Overview
The call stack
Program/Procedure Call Overview
Recursive Calls
59. Three Modules, each with subprocedures
Program/Procedure Call Overview
Parameter-Passing Considerations
60. Recursive Call Stack To Be Avoided
132 ILE RPG for AS/400 Programmers Guide
Program/Procedure Call Overview
Using a Prototyped
Using the CALLP Operation
Call
Calling within an Expression
Using a Prototyped Call
Passing by Reference
Examples of Free-Form Call
Passing Prototyped Parameters
Parameter Passing Styles
Passing Prototyped Parameters
Passing by Value
2 * MinLengthFirst + LengthLast + 1 %sizeName
Passing
Passing Prototyped Parameters
Passing Prototyped Parameters
Using Operational Descriptors
Prototype for ILE CEE API CEETSTA with CONST Parameter
is a character string passed by read-only reference
Omitting Parameters
Passing Prototyped Parameters
Len returns a 10-digit integer value. The parameter
67. Prototype for System API QCMDEXC with Optional Parameter
Passing *OMIT
Leaving Out Parameters
Passing Prototyped Parameters
Passing Prototyped Parameters
Checking for the Number
Passed
68 Part
Source for procedure FMTADDR
Passing Prototyped Parameters
3. Concatenate the complete address 4. Return
69. Source for /COPY member with Prototype for Procedure FMTADDR
Figure 68 Part 2 of 2. Source for procedure FMTADDR
Passing Prototyped Parameters
DIM2
Source for procedure PRTADDR
Passing Prototyped Parameters
70 Part
Parameters
Passing Less Data Than Required
effect
Order of Evaluation
Interlanguage Calls
Passing Prototyped Parameters
Calling Considerations
Interlanguage
V4R4M0
Call Operations
Using
Using
CALLB only
Using the Fixed-Form Call Operations
PLIST
Passing Parameters Using PARM
Examples of CALL and CALLB
Operations
the Fixed-Form Call Operations
Using the PLIST Operation
Returning from a Called
Returning from a Main Procedure
Procedure
Normal End
Abnormal End
Returning from a Called Program or Procedure
Returning from a Called Program or Procedure
Returning from a Subprocedure
without
Returning using ILE Bindable
Using Bindable APIs
APIs
Calling a Graphics Routine
Examples of Using Bindable APIs
Calling a Graphics Routine
Multithreading Considerations
Calling Special Routines
Multithreading Considerations
Across
How to
Share Data
Multithreading Considerations
to Avoid Deadlock
Modules
Deadlock Example
Considerations
Language Environment source debugger
Debugging and Exception Handling
¹ Debug an Integrated Language Environment application by using the
This section describes how to
162 ILE RPG for AS/400 Programmers Guide
The ILE Source Debugger
Chapter 11. Debugging Programs
The ILE Source Debugger
EQUATE
Debug Commands
The ILE Source Debugger
ATTR
THREAD
3. EnterPF1 Help
The ILE Source Debugger
TBREAK
Preparing a Program for
Preparing a Program for Debugging
for Debugging
Creating a Root Source View
CRTRPGMOD or
Creating
a Listing View
Creating a COPY Source
Preparing a Program for Debugging
Creating
a Statement
View
Program for Debugging
Starting the ILE Source Debugger
Starting the ILE Source
Display Module Source display for program DEBUGEX
Setting Debug Options
STRDBG Example
Starting the ILE Source Debugger
OPM source debug support field, and
Adding/Removing Programs from a Debug Session
Service
Example of Removing ILE Programs from a Debug Session
Example of Adding a
Viewing the Program Source
Viewing the Program Source
Viewing the Program Source
Viewing a Different
Module
Viewing the Program Source
Changing the View of a
Module
79. Source View of ILE C procedure cproc
Setting and Removing Breakpoints
Setting and Removing Breakpoints
Unconditional
Setting and Removing
Breakpoints
Setting and Removing Breakpoints
Breakpoint
Setting an
Setting and Removing Breakpoints
Setting and Removing Unconditional Thread Breakpoints
Figure 81. Setting an Unconditional Job Breakpoint
Breakpoints
Setting and Removing
Setting and Removing Breakpoints
Example of Setting a Conditional Job Breakpoint Using F13
Line
National Language Sort Sequence NLSS
Command
Setting and Removing Breakpoints
184 ILE RPG for AS/400 Programmers Guide
Setting and Removing Breakpoints
Statement
Setting and Removing Job
Setting
Using
Figure 85. Sample Section of the Compiler Listing with OPTION*SRCSTMT
Setting and Removing Breakpoints
Setting a Breakpoint Using Statement View
Figure 84. Sample Section of the Listing with OPTION*NOSRCSTMT
Using the Work with Module Breakpoints Display
Setting and Removing Conditional Thread Breakpoints
Setting and Removing Breakpoints
Conditions
Debug Commands
Setting and Removing Watch Conditions
Removing All Job and
Source
Characteristics of Watches
Setting and Removing Watch Conditions
Display
Example of a Work with Watch Display
Setting Watch Conditions
Command
Setting and Removing Watch Conditions
Figure 89. Example of a Display Watch Window
Setting and Removing Watch Conditions
Chapter 11. Debugging Programs191
Setting and Removing Watch Conditions
Displaying Active Watches
Removing Watch Conditions
Example of Setting a Watch Condition
Example of Setting a Watch Condition
Stepping Through the Program Object
Object
STEP number-of-statements OVER
Stepping Over Call Statements
Stepping Through the Program Object
Stepping Into Call Statements
Stepping Through the Program Object
ENTRY
Stepping Through the Program Object
PLIST
Figure 95. Stepping into Subprocedure Switch
Displaying Data and Expressions
Stepping Through the Program Object
Stepping Through the Program Object
Displaying a Field using the EVAL debug command
ˆ LASTNAME = Jones
Fields
Unexpected Results when Evaluating Variables
Stepping Through the Program Object
Scalar
variablefield-name is
Displaying the Contents of an Array
Displaying the Contents of a Table
Stepping Through the Program Object
Stepping Through the Program Object
Displaying Data Structures
Using EVAL with Data Structures
Displaying Indicators
Stepping Through the Program Object
Displaying
Displaying Fields as Hexadecimal Values
in Character Format
Stepping Through the Program Object
Displaying Null-Capable Fields
Data
Displaying Variable-Length Fields
by Pointers
Stepping Through the Program Object
Figure 102. Examples of %SUBSTR using DBGEX
Chapter 11. Debugging Programs207
Value
Fields
Changing the Value of Fields
Equating a Name with
or Command
Equating a Name with a Field, Expression, or Command
Displaying Attributes of a Field
Sample Source for Debug Examples
ILE RPG
Examples
Figure 105 Part 1 of 4. Source for Module DBGEX
Sample Source for Debug Examples
Date, Time, Timestamp
PARM1 is used when calling RPGPROG program
Sample Source for Debug Examples
Pointers
214 ILE RPG for AS/400 Programmers Guide
Sample Source for Debug Examples
Figure 105 Part
Source for Module DBGEX
program
Sample Source for Debug Examples
105 Part 4 of
Source for Module DBGEX. DBGEX is the main module of the
char *ptr
Figure 107. Source for C Procedure cproc. cproc is called by DBGEX
Sample Source for Debug Examples
char *cprocunsigned int size, char *inzval
Exception Handling Overview
Chapter 12. Handling Exceptions
Exception Handling Overview
218 ILE RPG for AS/400 Programmers Guide
Exception Handling Overview
Each
boundary is controlreached boundary. A
Call Stack and Exception Message Percolation
Exception Handling Overview
Exception Handling Overview
ILE RPG Exception Handling
Main
Handling
Exception Handling
INFSR
Handling
Exception Handling Overview
Nested Exceptions
Using Exception Handlers
Using Exception Handlers
Exception Handler Priority
messages
Using Exception Handlers
For other
types of
Using Exception Handlers
Example of Unhandled Function Check
Note The
Optimization Considerations
Using RPG-Specific Handlers
keyword, ILE
Extender
Specifying Error Indicators or the E
blank
Using an Error Subroutine
BEGSR
Using a File Error INFSR Subroutine
TRNSUPDT This program is a simple inventory update program
number
Access the product master file using the transaction product
If the record is found, update the quantity in the master file
If unexpected error occurs, cause inquiry message to be issued
spec
Using a Program Error Subroutine
‘*DETC’
Example of *PSSR Subroutine in Main Procedure
Chapter 12. Handling Exceptions233
234 ILE RPG for AS/400 Programmers Guide
113. Example of Subprocedure *PSSR Subroutine with GOTO
Avoiding
MOVE
Specifying a Return Point
ILE Condition Handlers
Using a Condition Handler
ILE Condition Handlers
RPGHDLR RPG exception handling procedure
Action codes are
ILE Condition Handlers
SHOWERR
CEEHDLR
Condition
ILE Condition Handlers
Show exception handling using a user-defined
ILE Condition Handlers
Register the handler and generate errors
APIs
Using
Cancel
Handlers
define a local *PSSR subroutine to handle the error
Define the prototype for the cancel handler. This procedure is
a local procedure
Procedure SubProc. Call Enabler. Since this call will fail
3 of
Procedure Enabler. This procedure enables a cancel handler
Enabling and Coding a Cancel Handler for a Subprocedure
Figure 118 Part
119. Output from CANHDLR program
Problems when ILE CL Monitors for Notify and Status Messages
If this is CPF4906, handle the notify msg, otherwise percolate
Handler definitions
120. ILE Condition Handler that Ignores CPF4906
Chapter 12. Handling Exceptions249
121. How to Ignore Status and Notify Messages
250 ILE RPG for AS/400 Programmers Guide
Obtaining an ILE RPG Formatted Dump
Using the DUMP Operation Code
Using the DUMP Operation Code
Chapter 13. Obtaining a Dump
Program Status Information
a Formatted
Dump
of a
Feedback Areas
Dump
of a
Figure 123. Feedback Areas section of Formatted Dump
Example of a Formatted Dump
of a
Data Information
Dump
Figure 125 Part 1 of 2. Data section of Formatted Dump
Example of a Formatted Dump
256 ILE RPG for AS/400 Programmers Guide
Example of a Formatted Dump
Example of a Formatted Dump
Working with Files and Devices
260 ILE RPG for AS/400 Programmers Guide
Associating Files with Input/Output Devices
Chapter 14. Defining Files
Associating Files with Input/Output Devices
Associating Files with Input/Output Devices
Device
Types of File Descriptions
Naming Files
Types of File Descriptions
Example of Some Typical Relationships between
Using Files with
Program-Described
Files
Defining Externally Described
Defining Externally Described Files
Files
Defining Externally Described Files
Renaming Record-Format Names
Ignoring Record Formats
Renaming Field Names
Defining Externally Described Files
Using Input Specifications
Modify an
Description
Defining Externally Described
Files
Files
Using Output Specifications
editing DDS Referin the
Defining Externally Described Files
Level Checking
OSLSREC
Data
Defining Program-Described Files
Data Management Operations and ILE RPG I/O Operations
RPG I/O Operations
272 ILE RPG for AS/400 Programmers Guide
Data Management Operations and ILE RPG I/O Operations
Operation
Operation
Chapter 15. General
File
Considerations
Overriding and Redirecting File Input and Output
Output
Input
and Output
Input
File Locking
File Locking
Record Locking
Record Locking
Sharing an Open Data
Path
Spooling
Spooling
File
Output Spooling
SRTSEQ/ALTSEQ
SRTSEQ/ALTSEQ in an
280 ILE RPG for AS/400 Programmers Guide
SRTSEQ/ALTSEQ
Physical Files and Logical Files
Chapter 16. Accessing
Files
Database Files
Using Externally Described Disk Files
Using Externally Described Disk Files
Record Format Specifications
Access Path
DDS are for the customer master logical file CUSMSTL. The f
Using Externally Described Disk Files
Example of the Data Description Specifications for a Database File
The sample
140. Example of a field Reference File
Using Externally Described Disk Files
284 ILE RPG for AS/400 Programmers Guide
File
Valid Keys for a Record
Disk
Using Externally Described Disk Files
Arguments
a Partial
Referring to
¹ A
Record Blocking and Unblocking
Using Externally Described Disk Files
Arguments
Using Program-Described Disk Files
Using Program-Described Disk Files
Indexed File
Files
Chapter 16. Accessing Database 289Files
Handling
D K1
Sequential File
Record Address File
Using Program-Described Disk Files
Methods for Processing Disk Files
Methods for Processing Disk Files
Limits Records
Relative Record Numbers
text
Consecutive Processing
Methods for Processing Disk Files
subsequent
Disk
DATA DESCRIPTION SPECIFICATIONS DDSFigure 144 on page 294 and
Sequential-by-Key Processing
Examples of Sequential-by-Key Processing
146. DDS for database file EMPL1 logical file
Methods for Processing Disk Files
Figure 144. DDS for database file EMPMST physical file
145. DDS for database file TRWEEK physical file
Methods for Processing Disk Files
Chapter 16. Accessing Database 295Files
Sequential-by-Key Processing, Example
Methods for Processing Disk Files
Sequential-by-Key Using READ
296 ILE RPG for AS/400 Programmers Guide
ENUM
for Processing Disk Files
298 ILE RPG for AS/400 Programmers Guide
Methods for Processing Disk Files
Example of Random-by-Key Processing
Random-by-Key Processing
Methods for Processing Disk Files
Methods for Processing Disk Files
Sequential-within-Limits Processing
Disk Files
Examples of Sequential-within-Limits Processing
Methods for Processing Disk Files
2 Sequential-within-Limits Processing
DDS for record address file LIMITS physical file
Methods for Processing Disk Files
Relative-Record-Number Processing
Valid File Operations
Valid File Operations
Valid File Operations
Chapter 16. Accessing Database 305Files
an A,P,G,D,T,Z
A record-address
Valid File Operations
Using Commitment Control
Using Commitment Control
Abridged for
Commitment Control Locks
Using Commitment Control
see theBackup and Recovery manual
Specifying
Using the
Files
3.STRJRNPF FILEMASTER TRANS JRNJOURNAL
Example of Using Commitment Control
1.CRTJRNRCV JRNRCV RECEIVER
2.CRTJRN JRNJOURNAL JRNRCVRECEIVER
3ENDCMTCTL
Control
LCKLVL*ALL
2CALL. REVISE
Commitment Control in
Cycle
DDM Files
DDM Files
Pre-V3R1 DDM
Using
314 ILE RPG for AS/400 Programmers Guide
DDM Files
Types
Accessing
Externally
Devices
Handling Page Overflow
Accessing Printer Devices
Accessing Printer Devices
Specifying PRINTER Files
Overflow
Accessing Printer Devices
Accessing Printer Devices
Chapter 17. Accessing Externally Attached319Devices
Example of Printing Headings on Every Page
Example of Printing a Field on Every Page
Accessing Printer Devices
Accessing Printer Devices
Using the Fetch-Overflow
Printing a Field on Every Page
Figure 159. Overflow Printing Setting of the Overflow Indicator
Accessing Printer Devices
Use of Fetch Overflow
Fetch Overflow
Example of Specifying Fetch Overflow
Accessing Printer Devices
File
Changing Forms Control
Information in
Forms
Accessing Printer Devices
Layout of OPM PRTCTL Data Structure
Accessing Tape Devices
Accessing Tape Devices
File
Accessing Display Devices
Using Sequential Files
Using Sequential Files
Using SPECIAL Files
Using SPECIAL Files
File
Description
Using SPECIAL Files
Error
Status
Specifications
Example of Using a Special File
SPECIAL Files
Using
User-written program USERIO
Using SPECIAL Files
PLISTSPCL
Function
Chapter 18. Using WORKSTN Files
Using Externally Described WORKSTN Files
Using Externally Described WORKSTN Files
¹ Output
Using Externally Described WORKSTN Files
Chapter 18. Using WORKSTN Files333
Using Externally Described WORKSTN Files
R RESPONSE
Device
Specifying Function Key Indicators on Display Device Files
Using Externally Described WORKSTN Files
Chapter 18. Using WORKSTN Files335
Using Subfiles
Processing an Externally Described WORKSTN File
Using Externally Described WORKSTN Files
field
Using Externally Described WORKSTN Files
Subfile Display
Using Externally Described WORKSTN Files
Use of Subfiles
Data Description Specifications for a Subfile Record Format
Using Program-Described WORKSTN Files
Using Program-Described WORKSTN Files
Output Specifications
with
Using Program-Described WORKSTN Files
Using a Program-Described
without
Input Specifications
Calculation Specifications
Name
Combined File
Valid WORKSTN File Operations
Input File
Output File
Multiple-Device Files
EXFMT Operation
READ Operation
WRITE Operation
Multiple-Device Files
344 ILE RPG for AS/400 Programmers Guide
Multiple-Device Files
Database Physical File
Chapter 19. Example of an Interactive Application
Database Physical File
Main Menu Inquiry
Inquiry
DDS for a
Display Device
to describing the constants, fields, line numbers, and ho
CUSMAIN RPG Source
Main Menu Inquiry
In addition
Source for module CUSMAIN
Main Menu Inquiry
348 ILE RPG for AS/400 Programmers Guide
Logical
File Maintenance
File Maintenance
CUSMSTL1 DDS for a
Device
Display
File Maintenance
File
Figure 174 Part 2 of 2. DDS for display device file MNTMENU
File Maintenance
Chapter 19. Example of an Interactive 351Application
File Maintenance
CUSMNT RPG Source
DSPATRPR
Chapter 19. Example of an Interactive 353Application
File Maintenance
ADD NEW CUSTOMER TO FILE
SET MAINTENANCE MODE
File Maintenance
354 ILE RPG for AS/400 Programmers Guide
F3 End Job
File Maintenance
F6 Update
Customer File Maintenance Display Mode prompt screen
356 ILE RPG for AS/400 Programmers Guide
File Maintenance
Customer File Maintenance Display Mode screen
Customer File Maintenance Add Mode prompt screen
YORKTOWN
File Maintenance
Chapter 19. Example of an Interactive 357Application
Search by Zip Code
Search by
File
Device
SZIPMENU DDS
Display
File
14DSPATRHI
Search by Zip Code
PROMPT
Search by Zip Code
SCHZIP RPG Source
Chapter 19. Example of an Interactive 361Application
362 ILE RPG for AS/400 Programmers Guide
Search by Zip Code
is written to the screen as shown in Figure 186 on page
The subfile
CUSMSTL3 DDS
Search and Inquiry by Name
Search and Inquiry by Name
File
SNAMMENU DDS for a Display
Device
File
Search and Inquiry by Name
Search and Inquiry by Name
SCHNAM RPG Source
Chapter 19. Example of an Interactive 367Application
Search and Inquiry by Name
Search and Inquiry by Name
¹ To
SUBROUTINE
information by
The user
requests
more
192. Customer Search and Inquiry by Name detailed information screen
Search and Inquiry by Name
370 ILE RPG for AS/400 Programmers Guide
Copyright IBM Corp. 1994
Appendixes
372 ILE RPG for AS/400 Programmers Guide
Appendix
RPG/400
and ILE
AS/400
Differences Between OPM RPG/400 and ILE RPG
Running
Debugging and Exception
RPG/400
Differences Between OPM RPG/400
ILE RPG
ILE RPG
DBCS Data in Character Fields
DBCS
378 ILE RPG for AS/400 Programmers Guide
ILE RPG
Differences Between OPM RPG/400
Conversion Overview
Appendix B. Using
Conversion Overview
Conversion
File Record Length
File Considerations
Conversion Overview
Overview
The Log File
Conversion Aid Tool Requirements
File
What the Conversion
Wont Do
Converting Your Source
Converting Your Source
names
The CVTRPGSRC Command
Converting Your Source
member
LIBL
Converting Your Source
FROMFILE
source-file-name
NONE
Converting Your Source
TOFILE
QRPGLESRC
Converting Your Source
Converting a Member Using
Defaults
Source
Converting Your Source
Converting All Members in a File
a File
Performing a Trial Conversion
Converting Your Source
Obtaining Conversion Reports
Converting Auto Report
Source Members
Example of Source Conversion
Inserting Specification Templates
a Data
Example of Source Conversion
The converted source is shown in Figure 195 on page
Example
of Source Conversion
To convert this source, enter
Figure 195. Converted RPG IV Source for TEST1
Example of Source Conversion
ARR1
Analyzing Your Conversion
Analyzing Your Conversion
Report
Using the Conversion
Analyzing Your Conversion
Sample Source Section of Conversion Report
Your
Sample Message Summary of Conversion Report
Analyzing Your Conversion
Using the Log File
CPYF FROMFILEQRPGLE/QARNCVTLG TOFILEMYLIB/QRNCVTLG CRTFILE*YES
Analyzing Your Conversion
Appendix B. Using the RPG III to RPG IV397 Conversion Aid
200. DDS for model log file QARNCVTLG in library QRPGLE
Resolving Conversion Problems
Resolving Conversion Problems
Compilation Errors in Existing RPG III Code
Unsupported RPG III Features
RPG III Source for TEST2
Conversion
RPG III Source for COPYDS1
Resolving Conversion Problems
Context-Sensitive Problems
Structures
Use of Externally
Resolving Conversion Problems
207. RPG III source using external data structure with array
Merging an Array with an Externally Described DS Subfield
Initializing
Resolving Conversion Problems
RPG IV source with two definitions for renamed subfield
Run-time Differences
Resolving Conversion Problems
210. RPG III source with renamed and initialized external subfield
404 ILE RPG for AS/400 Programmers Guide
Resolving Conversion Problems
Reading Syntax Diagrams
Appendix C. The Create Commands
Using CL Commands
How to Interpret Syntax Diagrams
CRTBNDRPG Command
CRTBNDRPG Command
3description32
CRTBNDRPG Command
Appendix C. The Create Commands407
3library-name/32
CRTBNDRPG Command
Description of the CRTBNDRPG Command
OPTION Details
SRCMBR
CRTBNDRPG Command
LIBL
CURLIB
410 ILE RPG for AS/400 Programmers Guide
CRTBNDRPG Command
DEBUGIO
StatementNumber = sourceID * 1000000 + sourceSEUsequencenumber
STMT
Command
EVENTF
DBGVIEW
character-value
CRTBNDRPG Command
EXPDDS, and
LANGIDSHR
CRTBNDRPG Command
sort-table-name
LANGIDUNQ
REPLACE
CRTBNDRPG Command
416 ILE RPG for AS/400 Programmers Guide
CRTBNDRPG Command
LIBCRTAUT
V2R3M5
target-release
binding-directory-name
Command
USRCTL
ENTRYEXIT
CRTBNDRPG Command
CRTRPGMOD Command
CRTRPGMOD Command
Appendix C. The Create Commands421
CRTRPGMOD Command
422 ILE RPG for AS/400 Programmers Guide
Description of the CRTRPGMOD command
CRTRPGMOD Command
of CRTRPGMOD
Compiler Listings
Appendix D. Compiler Listings
Compiler Listings
Compiler Listing
Prologue
Reading a
4/ Source
Compiler Listings
2/ Module or Program
3/ Source member
Compiler Listings
Section
Sample Section of the Listing with OPTION*NOSRCSTMT
Appendix D. Compiler Listings427
Listings
Figure 217 Part 1 of 3. Sample Source Part of the Listing
Compiler Listings
428 ILE RPG for AS/400 Programmers Guide
Figure 217 Part 2 of 3. Sample Source Part of the Listing
Compiler Listings
Appendix D. Compiler Listings429
Ruler Line
Compiler Listings
1a/ *NOSRCSTMT Source Heading
Line Number
Listings
Diagnostic
Additional
Specifications
Sample Additional Diagnostic Messages with OPTION*SRCSTMT
Output Buffer Positions
COPY Member Table
Sample Additional Diagnostic Messages with OPTION*NOSRCSTMT
2/ Character to be Altered
Compile-Time Data
Compiler Listings
1/ Total Number of Characters Altered
Figure 223. Sample Key Field Information
Key Field Information
Cross-Reference Table
Compiler Listings
Compiler Listings
External References List
Figure 224. Sample Cross-Reference Table with OPTION*NOSRCSTMT
Figure 225. Sample External References
Message Summary
Final Summary
Compiler Listings
Compiler Listings
Code Generation and Binding Errors
Figure 227. Sample Final Summary
438 ILE RPG for AS/400 Programmers Guide
Compiler Listings
Development
Bibliography
ADTS/400
Programming
FORTRAN/400
GDDM
AS/400
Bibliography
442 ILE RPG for AS/400 Programmers Guide
continued
Special
See Add
Page
CALL
CL commands
control-record format, subfile
DBCS continued
debugging continued
NLSS
NOOPT
364access
summary
Page
Page
alsoDISK
See long
alsoPARM
creationcontinued
methodscontinued
callcontinued
alsoILE
debuggingcontinued
programcontinued
WORKSTN
Page
WORKSTN file definition 331 examples 345 externally described
Part Number 99H3778 Program Number 5769-RG1 Printed in U.S.A
ÉÂÔÙ
99H3778 SC09-2507-02