AS/400e
ILE RPG for AS/400 Programmers Guide
Version
Page
AS/400e
ILE RPG for AS/400 Programmers Guide
Version
Edition
Third
1999
comments
RPG Introduction
Contents
with
Chapter
a Service Program
Creating
Debugging
vi ILE
Handling
Chapter 14. Defining Files
Working with Files and Devices
Files
Files
Appendix B. Using the RPG III to RPG
Appendixes
Chapter 19. Example of an
RPG for
COPY
Index
country
Notices
such provisions
are inconsistent
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?
EVAL
NODEBUGIO
Numbers
EVALR
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
Chapter 1. Overview
RPG IV Specifications
RPG IV Overview
section
RPG IV Overview
Cycle Programming
Figure 1. RPG Program Logic Cycle
Indicators
Subprocedure logic
RPG IV Overview
The first
Program
Operation Codes
Example of an ILE RPG
Example of an ILE RPG Program
Control Specifications
Program
File Description Specifications
Example of an ILE RPG Program
Output Specifications
NAME
RATE
Example of an ILE RPG Program
A Subprocedure
REGISTER
Chapter 1. Overview of the RPG IV Programming9 Language
The Entire Source Program
Example of an ILE RPG Program
This program creates a printed output of employees pay
for the week
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
Interacting with the System
Using
OS/400 System
Using
Application Development
Tools
AS/400 Tools
for AS/400
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
Bindable APIs
Source Debugging
RPG Programming in ILE
shown
RPG Programming in ILE
Multithreaded Applications
suppo
THREAD*SEREALIZE
22 ILE RPG for AS/400 Programmers Guide
RPG Programming in ILE
Strategy 1 OPM-Compatible Application
Chapter 3. Program Creation Strategies
Method
OPM-Compatible Application
Effect of ILE
Example of OPM-Compatible Program
OPM-Compatible Application
ILE Program Using CRTBNDRPG
Using
Related Information
CRTBNDRPG
Using
Example of ILE Program
ILE Program Using CRTBNDRPG
Figure 7. ILE Program Using CRTBNDRPG
CRTRPGMOD
ILE Application Using CRTRPGMOD
Strategy 3 ILE Application
Related Information
ILE Application Using CRTRPGMOD
Scenario
Method
Single-Language ILE Application
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
A Strategy to Avoid
A Strategy to Avoid
Service
Related Information
A Strategy to Avoid
the default activation group and any named activation
When
split
Multiple Procedures Module
Chapter 4. Creating an Application Using Multiple Procedures
Multiple Procedures Module
Prototyped Calls
MODULE
Prototype for procedure FmtCust Note the PR on definition
Multiple Procedures Module
specification. It has two output parameters
13. Prototype for FmtCust Procedure
Multiple
Example of Module with
Example of Module with Multiple Procedures
NumToC
Procedures
in Fmt
module
Example of Module with Multiple Procedures
Example of Module with Multiple Procedures
The Entire ARRSRPT Program
ARRSRPT *PGM ARRSRPT *MODULE Main Procedure InArrears FmtCust
Figure 22 Part
Figure 22 Part
Example of Module with Multiple Procedures
ILE RPG Complete Source for ARRSRPT Module
42 ILE RPG for AS/400 Programmers Guide
Chapter 4. Creating an Application Using Multiple43 Procedures
Example of Module with Multiple Procedures
SUBDUR
DaysLate*D
ARRSRPT
Output for ARRSRPT
General Considerations
Coding Considerations
Coding Considerations
Subprocedure Considerations
Main Procedure Considerations
Program Creation
Coding Considerations
Subprocedures
Main Procedures
For Further Information
For Further Information
Prototyped Call
Creating
Application
50 ILE RPG for AS/400 Programmers Guide
File
Statements
Chapter 5. Entering
Source
Using SEU
Using the Source Entry Utility
Using SEU
Procedure EMPTYPE returns a string representing the employee
Using SEU
type indicated by the parameter CODE
28. Source for EMPRPT member
Using SQL Statements
Using SQL Statements
for AS/400 SQL Programming manual and theDB2 UDB for AS/400 SQL
Using SQL Statements
Reference for more
Refer toADTS thefor AS/400 Source Entry
Using the CRTBNDRPG Command
Command
Using the CRTBNDRPG
CRTBNDRPG
Listing
Using the CRTBNDRPG Command
Options
Creation
Using the CRTBNDRPG Command
Creating a Program for Source Debugging
Considerations
Creating a Program with Static
Binding
Using the CRTBNDRPG Command
Using
Command
¹ WRKOUTQ queue-name
Creating an OPM-Compatible
Part
Using the CRTBNDRPG Command
A Sample Payroll Calculation Program
Figure 32 Part 2 of 2. A Sample Payroll Calculation Program
Using a Compiler Listing
Using a Compiler Listing
Listing
Obtaining a Compiler
Customizing a Page Heading
Customizing a Compiler Listing
a Compiler Listing
Using
Indenting Structured Operations
Customizing the Spacing
Using a Compiler Listing
The /SPACE
Listing
Errors
Compilation
Using
Using a
Using In-Line Diagnostic Messages
Compiler Listing
Using Additional-Diagnostic Messages
Correcting Run-time Errors
Browsing a Compiler Listing Using SEU
Using a Compiler Listing
Maintenance
Using a Compiler Listing for
Coordinating Listing Options with Debug View Options
Using a Compiler Listing
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
7. Creating
Commands
a Module Object
Chapter
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
Source for TRANSSVC member
Part
Creating a Module Object
Creating a Module for
Debugging
Source for TRANSRPT module
Creating a Module Object
OFLIND*INOF
Additional Examples
Related CL Commands
Modules
Behavior of Bound ILE
Program
Binding Modules into a
Binding Modules into a Program
into a
Using
CRTPGM
Group
Binding Modules into a Program
Value
Concepts for
Binding Modules into a Program
CRTRPGMOD MODULEMYLIB/TRANSRPT
CRTRPGMOD MODULEMYLIB/TRANSSVC
Using a Binder Listing
Using a Binder Listing
Related CL Commands
Additional Examples
Changing a Module or
Changing a Module or Program
BASIC
FULL
Level
Using the UPDPGM Command
Changing the Optimization
Changing a Module or Program
Size
Removing Observability
Reducing an Objects
Changing a Module or Program
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
Source for Service Program CvtToHex
Sample Service Program
42 Part
96 ILE RPG for AS/400 Programmers Guide
Sample Service Program
Creating the Service Program
43. Source for /COPY Member with Prototype for CvtToHex
Figure 44. Source for Binder Language for CvtToHex
Sample Service Program
Binding to a Program
MODUL
98 ILE RPG for AS/400 Programmers Guide
Program to test Service Program CVTTOHEX
Sample Service Program
Sample Binder Listing
Updating the Service
add a
to an
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
ILE RPG Program that Requires Parameters at Run Time
Part
Running a Program From a Menu-Driven Application
Application
Running a Program From a
Running a Program From a Menu-Driven Application
Figure 50. Data Description Specification of an Application Menu
A* CMDPROMPT
Figure 51. Source for Menu Program
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
Deleting an Activation
Reclaim Resources Command
Group
Managing Activation Groups
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@
52 Part
Managing Dynamically-Allocated Storage
4 of 5. Memory Management - Build a Linked List of Names
Chapter 9. Running a Program117
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
Part
Managing Dynamically-Allocated Storage
of 2. Global variables and local prototypes for DYNARRAY
Chapter 9. Running a Program121
Managing Dynamically-Allocated Storage
Figure 56 on page 123 shows the subprocedures in DYNARRAY
Figure 55 Part
2 of
DYNARRAY Subprocedures
DYNARRAY Subprocedures
Managing Dynamically-Allocated Storage
Part
Managing Dynamically-Allocated Storage
DYNARRAY Subprocedures
Part 3 of
124 ILE RPG for AS/400 Programmers Guide
DYNARRAY Subprocedures
DYNARRAY Subprocedures
Managing Dynamically-Allocated Storage
Part
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
Calling Programs
Calling Procedures
Program/Procedure Call Overview
calls
Program/Procedure Call Overview
The Call Stack
The call stack
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 Prototyped Parameters
Examples of Free-Form Call
Parameter Passing Styles
Passing by Reference
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
Passing Prototyped Parameters
Omitting Parameters
Len returns a 10-digit integer value. The parameter
is a character string passed by read-only reference
Leaving Out Parameters
Passing *OMIT
Passing Prototyped Parameters
67. Prototype for System API QCMDEXC with Optional Parameter
Passing Prototyped Parameters
Checking for the Number
Passed
Passing Prototyped Parameters
Source for procedure FMTADDR
3. Concatenate the complete address 4. Return
68 Part
69. Source for /COPY member with Prototype for Procedure FMTADDR
Figure 68 Part 2 of 2. Source for procedure FMTADDR
Passing Prototyped Parameters
Passing Prototyped Parameters
Source for procedure PRTADDR
70 Part
DIM2
Parameters
Passing Less Data Than Required
Interlanguage Calls
Order of Evaluation
Passing Prototyped Parameters
effect
Calling Considerations
Interlanguage
Using
Call Operations
Using
V4R4M0
CALLB only
Using the Fixed-Form Call Operations
Examples of CALL and CALLB
Passing Parameters Using PARM
Operations
PLIST
the Fixed-Form Call Operations
Using the PLIST Operation
Procedure
Returning from a Main Procedure
Normal End
Returning from a Called
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
¹ Debug an Integrated Language Environment application by using the
Debugging and Exception Handling
This section describes how to
Language Environment source debugger
162 ILE RPG for AS/400 Programmers Guide
The ILE Source Debugger
Chapter 11. Debugging Programs
The ILE Source Debugger
The ILE Source Debugger
Debug Commands
ATTR
EQUATE
The ILE Source Debugger
3. EnterPF1 Help
TBREAK
THREAD
Preparing a Program for
Preparing a Program for Debugging
for Debugging
Creating a Root Source View
CRTRPGMOD or
Creating a COPY Source
a Listing View
Preparing a Program for Debugging
Creating
View
a Statement
Program for Debugging
Creating
Starting the ILE Source Debugger
Starting the ILE Source
STRDBG Example
Setting Debug Options
Starting the ILE Source Debugger
Display Module Source display for program DEBUGEX
OPM source debug support field, and
Example of Removing ILE Programs from a Debug Session
Service
Example of Adding a
Adding/Removing Programs from a Debug Session
Viewing the Program Source
Viewing the Program Source
Viewing the Program Source
Viewing a Different
Module
Module
Changing the View of a
79. Source View of ILE C procedure cproc
Viewing the Program Source
Setting and Removing Breakpoints
Setting and Removing Breakpoints
Breakpoints
Setting and Removing
Setting and Removing Breakpoints
Unconditional
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
Setting
Setting and Removing Job
Using
Statement
Setting a Breakpoint Using Statement View
Setting and Removing Breakpoints
Figure 84. Sample Section of the Listing with OPTION*NOSRCSTMT
Figure 85. Sample Section of the Compiler Listing with OPTION*SRCSTMT
Using the Work with Module Breakpoints Display
Setting and Removing Conditional Thread Breakpoints
Setting and Removing Breakpoints
Setting and Removing Watch Conditions
Debug Commands
Removing All Job and
Conditions
Setting and Removing Watch Conditions
Characteristics of Watches
Display
Source
Command
Setting Watch Conditions
Setting and Removing Watch Conditions
Example of a Work with Watch Display
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
Stepping Through the Program Object
Unexpected Results when Evaluating Variables
Scalar
Fields
Displaying the Contents of a Table
Displaying the Contents of an Array
Stepping Through the Program Object
variablefield-name is
Stepping Through the Program Object
Displaying Data Structures
Using EVAL with Data Structures
Displaying Indicators
Stepping Through the Program Object
in Character Format
Displaying Fields as Hexadecimal Values
Stepping Through the Program Object
Displaying
Displaying Variable-Length Fields
Data
by Pointers
Displaying Null-Capable Fields
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 a Field, Expression, or Command
or Command
Displaying Attributes of a Field
Equating a Name with
Sample Source for Debug Examples
ILE RPG
Examples
Figure 105 Part 1 of 4. Source for Module DBGEX
Sample Source for Debug Examples
Sample Source for Debug Examples
PARM1 is used when calling RPGPROG program
Pointers
Date, Time, Timestamp
Figure 105 Part
Sample Source for Debug Examples
Source for Module DBGEX
214 ILE RPG for AS/400 Programmers Guide
105 Part 4 of
Sample Source for Debug Examples
Source for Module DBGEX. DBGEX is the main module of the
program
Sample Source for Debug Examples
Figure 107. Source for C Procedure cproc. cproc is called by DBGEX
char *cprocunsigned int size, char *inzval
char *ptr
Exception Handling Overview
Chapter 12. Handling Exceptions
Exception Handling Overview
Each
Exception Handling Overview
boundary is controlreached boundary. A
218 ILE RPG for AS/400 Programmers Guide
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
Using Exception Handlers
Using Exception Handlers
Exception Handler Priority
Nested Exceptions
For other
Using Exception Handlers
types of
messages
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
If the record is found, update the quantity in the master file
Access the product master file using the transaction product
If unexpected error occurs, cause inquiry message to be issued
number
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
Cancel
Using
Handlers
APIs
a local procedure
Define the prototype for the cancel handler. This procedure is
Procedure SubProc. Call Enabler. Since this call will fail
define a local *PSSR subroutine to handle the error
Enabling and Coding a Cancel Handler for a Subprocedure
Procedure Enabler. This procedure enables a cancel handler
Figure 118 Part
3 of
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
Using the DUMP Operation Code
Using the DUMP Operation Code
Chapter 13. Obtaining a Dump
Obtaining an ILE RPG Formatted Dump
Dump
a Formatted
of a
Program Status Information
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
Program-Described
Using Files with
Files
Example of Some Typical Relationships between
Defining Externally Described
Defining Externally Described Files
Files
Ignoring Record Formats
Renaming Record-Format Names
Renaming Field Names
Defining Externally Described Files
Modify an
Using Input Specifications
Description
Defining Externally Described Files
Defining Externally Described
Files
Files
Using Output Specifications
editing DDS Referin the
Defining Externally Described Files
Level Checking
OSLSREC
Data Management Operations and ILE RPG I/O Operations
Defining Program-Described Files
RPG I/O Operations
Data
Operation
Data Management Operations and ILE RPG I/O Operations
Operation
272 ILE RPG for AS/400 Programmers Guide
Considerations
File
Overriding and Redirecting File Input and Output
Chapter 15. General
and Output
Input
Input
Output
File Locking
File Locking
Record Locking
Record Locking
Sharing an Open Data
Path
Spooling
Spooling
SRTSEQ/ALTSEQ
Output Spooling
SRTSEQ/ALTSEQ in an
File
280 ILE RPG for AS/400 Programmers Guide
SRTSEQ/ALTSEQ
Files
Chapter 16. Accessing
Database Files
Physical Files and Logical Files
Record Format Specifications
Using Externally Described Disk Files
Access Path
Using Externally Described Disk Files
Example of the Data Description Specifications for a Database File
Using Externally Described Disk Files
The sample
DDS are for the customer master logical file CUSMSTL. The f
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
a Partial
Arguments
Referring to
Using Externally Described Disk Files
¹ A
Record Blocking and Unblocking
Using Externally Described Disk Files
Using Program-Described Disk Files
Using Program-Described Disk Files
Indexed File
Arguments
Files
Chapter 16. Accessing Database 289Files
Handling
Record Address File
Sequential File
Using Program-Described Disk Files
D K1
Limits Records
Methods for Processing Disk Files
Relative Record Numbers
Methods for Processing Disk Files
Methods for Processing Disk Files
Consecutive Processing
subsequent
text
Sequential-by-Key Processing
DATA DESCRIPTION SPECIFICATIONS DDSFigure 144 on page 294 and
Examples of Sequential-by-Key Processing
Disk
Figure 144. DDS for database file EMPMST physical file
Methods for Processing Disk Files
145. DDS for database file TRWEEK physical file
146. DDS for database file EMPL1 logical 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
Using Commitment Control
Commitment Control Locks
see theBackup and Recovery manual
Abridged for
Specifying
Using the
Files
1.CRTJRNRCV JRNRCV RECEIVER
Example of Using Commitment Control
2.CRTJRN JRNJOURNAL JRNRCVRECEIVER
3.STRJRNPF FILEMASTER TRANS JRNJOURNAL
LCKLVL*ALL
Control
2CALL. REVISE
3ENDCMTCTL
DDM Files
Cycle
DDM Files
Commitment Control in
Pre-V3R1 DDM
Using
314 ILE RPG for AS/400 Programmers Guide
DDM Files
Externally
Accessing
Devices
Types
Accessing Printer Devices
Accessing Printer Devices
Specifying PRINTER Files
Handling Page Overflow
Overflow
Accessing Printer Devices
Accessing Printer Devices
Example of Printing a Field on Every Page
Example of Printing Headings on Every Page
Accessing Printer Devices
Chapter 17. Accessing Externally Attached319Devices
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
Example of Specifying Fetch Overflow
Fetch Overflow
Accessing Printer Devices
Use of Fetch Overflow
File
Changing Forms Control
Information in
Forms
Accessing Printer Devices
Layout of OPM PRTCTL Data Structure
Accessing Tape Devices
Accessing Tape Devices
Using Sequential Files
Accessing Display Devices
Using Sequential Files
File
Using SPECIAL Files
Using SPECIAL Files
File
Error
Using SPECIAL Files
Status
Description
SPECIAL Files
Example of Using a Special File
Using
Specifications
User-written program USERIO
Using SPECIAL Files
PLISTSPCL
Using Externally Described WORKSTN Files
Chapter 18. Using WORKSTN Files
Using Externally Described WORKSTN Files
Function
¹ 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
Processing an Externally Described WORKSTN File
Using Subfiles
Using Externally Described WORKSTN Files
Chapter 18. Using WORKSTN Files335
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
Using Program-Described WORKSTN Files
with
Using a Program-Described
Output Specifications
Calculation Specifications
Input Specifications
Name
without
Input File
Valid WORKSTN File Operations
Output File
Combined File
READ Operation
EXFMT Operation
WRITE Operation
Multiple-Device Files
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
DDS for a
Inquiry
Display Device
Main Menu Inquiry
Main Menu Inquiry
CUSMAIN RPG Source
In addition
to describing the constants, fields, line numbers, and ho
Source for module CUSMAIN
Main Menu Inquiry
348 ILE RPG for AS/400 Programmers Guide
File Maintenance
File Maintenance
CUSMSTL1 DDS for a
Logical
File Maintenance
Display
File
Device
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
F6 Update
File Maintenance
Customer File Maintenance Display Mode prompt screen
F3 End Job
Customer File Maintenance Display Mode screen
File Maintenance
Customer File Maintenance Add Mode prompt screen
356 ILE RPG for AS/400 Programmers Guide
YORKTOWN
File Maintenance
Chapter 19. Example of an Interactive 357Application
Search by Zip Code
Search by
File
Display
SZIPMENU DDS
File
Device
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
Search and Inquiry by Name
Search and Inquiry by Name
File
CUSMSTL3 DDS
File
Device
Search and Inquiry by Name
SNAMMENU DDS for a Display
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
requests
The user
more
information by
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
and ILE
RPG/400
AS/400
Appendix
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
Conversion Overview
File Record Length
File Considerations
Conversion Overview
Conversion Aid Tool Requirements
The Log File
File
Overview
Converting Your Source
Wont Do
Converting Your Source
What the Conversion
Converting Your Source
The CVTRPGSRC Command
member
names
FROMFILE
Converting Your Source
source-file-name
LIBL
TOFILE
Converting Your Source
QRPGLESRC
NONE
Converting Your Source
Converting a Member Using
Defaults
Source
a File
Converting All Members in a File
Performing a Trial Conversion
Converting Your Source
Converting Auto Report
Obtaining Conversion Reports
Source Members
Converting Your Source
a Data
Inserting Specification Templates
Example of Source Conversion
Example of Source Conversion
of Source Conversion
Example
To convert this source, enter
The converted source is shown in Figure 195 on page
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
Compilation Errors in Existing RPG III Code
Resolving Conversion Problems
Unsupported RPG III Features
Resolving Conversion Problems
RPG III Source for TEST2
Conversion
RPG III Source for COPYDS1
Resolving Conversion Problems
Context-Sensitive Problems
Structures
Use of Externally
Resolving Conversion Problems
Initializing
Merging an Array with an Externally Described DS Subfield
Resolving Conversion Problems
207. RPG III source using external data structure with array
Resolving Conversion Problems
Run-time Differences
210. RPG III source with renamed and initialized external subfield
RPG IV source with two definitions for renamed subfield
404 ILE RPG for AS/400 Programmers Guide
Resolving Conversion Problems
Using CL Commands
Appendix C. The Create Commands
How to Interpret Syntax Diagrams
Reading Syntax Diagrams
CRTBNDRPG Command
CRTBNDRPG Command
Appendix C. The Create Commands407
CRTBNDRPG Command
3library-name/32
3description32
CRTBNDRPG Command
Description of the CRTBNDRPG Command
OPTION Details
LIBL
CRTBNDRPG Command
CURLIB
SRCMBR
410 ILE RPG for AS/400 Programmers Guide
CRTBNDRPG Command
DEBUGIO
StatementNumber = sourceID * 1000000 + sourceSEUsequencenumber
EVENTF
Command
DBGVIEW
STMT
character-value
CRTBNDRPG Command
EXPDDS, and
sort-table-name
CRTBNDRPG Command
LANGIDUNQ
LANGIDSHR
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
CRTRPGMOD Command
Description of the CRTRPGMOD command
of CRTRPGMOD
422 ILE RPG for AS/400 Programmers Guide
Compiler Listings
Appendix D. Compiler Listings
Prologue
Compiler Listing
Reading a
Compiler Listings
2/ Module or Program
Compiler Listings
3/ Source member
4/ Source
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
1a/ *NOSRCSTMT Source Heading
Compiler Listings
Line Number
Ruler Line
Additional
Diagnostic
Specifications
Listings
COPY Member Table
Output Buffer Positions
Sample Additional Diagnostic Messages with OPTION*NOSRCSTMT
Sample Additional Diagnostic Messages with OPTION*SRCSTMT
Compiler Listings
Compile-Time Data
1/ Total Number of Characters Altered
2/ Character to be Altered
Cross-Reference Table
Key Field Information
Compiler Listings
Figure 223. Sample Key Field Information
Compiler Listings
External References List
Figure 224. Sample Cross-Reference Table with OPTION*NOSRCSTMT
Final Summary
Message Summary
Compiler Listings
Figure 225. Sample External References
Compiler Listings
Code Generation and Binding Errors
Figure 227. Sample Final Summary
438 ILE RPG for AS/400 Programmers Guide
Compiler Listings
ADTS/400
Bibliography
Programming
Development
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