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