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