Contents

About This Guide
Who Should Use This Guide
Prerequisite and Related Information
How to Send Your Comments
What's New
What's New in this Release
What's New in V6R1
What's New in V5R4?
What's New in V5R3?
What's New in V5R2?
What's New in V5R1?
What's New in V4R4?
What's New in V4R2?
What's New in V3R7?
What's New in V3R6/V3R2?
Using the application development tools in the client product
Getting started in the Remote System Explorer perspective
Remote Systems view
System i Table view
Remote Systems LPEX Editor
ILE RPG Introduction
Overview of the RPG IV Programming Language
RPG IV Specifications
Cycle Programming
Subprocedure logic
Indicators
Operation Codes
Example of an ILE RPG Program
Using IBM i
Interacting with the System
WebSphere Development Studio for System i
WebSphere Development Studio Client for System i
RPG Programming in ILE
Program Creation
Program Management
Program Call
Source Debugging
Bindable APIs
Multithreaded Applications
Program Creation Strategies
Strategy 1: OPM-Compatible Application
Method
Example of OPM-Compatible Program
Related Information
Strategy 2: ILE Program Using CRTBNDRPG
Method
Example of ILE Program Using CRTBNDRPG
Related Information
Strategy 3: ILE Application Using CRTRPGMOD
Method
Single-Language ILE Application Scenario
Mixed-Language ILE Application Scenario
Advanced Application Scenario
Related Information
A Strategy to Avoid
Creating an Application Using Multiple Procedures
A Multiple Procedures Module — Overview
Main Procedures and Subprocedures
Prototyped Calls
Example of Module with Multiple Procedures
The Entire ARRSRPT Program
Coding Considerations
General Considerations
Program Creation
Main Procedure Considerations
Subprocedure Considerations
For Further Information
Main Procedures
Subprocedures
Prototyped Call
Creating and Running an ILE RPG Application
Using Source Files
Using Source Physical Files
Creating a Library and Source Physical File
Using the Source Entry Utility (SEU)
Using SQL Statements
Using IFS Source Files
Include files
Creating a Program with the CRTBNDRPG Command
Using the CRTBNDRPG Command
Creating a Program for Source Debugging
Creating a Program with Static Binding
Creating an OPM-Compatible Program Object
Using a Compiler Listing
Obtaining a Compiler Listing
Customizing a Compiler Listing
Correcting Compilation Errors
Correcting Run-time Errors
Using a Compiler Listing for Maintenance
Accessing the RETURNCODE Data Area
Creating a Program with the CRTRPGMOD and CRTPGM Commands
Creating a Module Object
Using the CRTRPGMOD Command
Creating a Module for Source Debugging
Additional Examples
Behavior of Bound ILE RPG Modules
Related CL Commands
Binding Modules into a Program
Using the CRTPGM Command
Additional Examples
Related CL Commands
Using a Binder Listing
Changing a Module or Program
Using the UPDPGM Command
Changing the Optimization Level
Removing Observability
Reducing an Object's Size
Creating a Service Program
Service Program Overview
Strategies for Creating Service Programs
Creating a Service Program Using CRTSRVPGM
Changing A Service Program
Related CL commands
Sample Service Program
Creating the Service Program
Binding to a Program
Updating the Service Program
Sample Binder Listing
Running a Program
Running a Program Using the CL CALL Command
Passing Parameters using the CL CALL Command
Running a Program From a Menu-Driven Application
Running a Program Using a User-Created Command
Replying to Run-Time Inquiry Messages
Ending an ILE Program
Managing Activation Groups
Specifying an Activation Group
Running in the OPM Default Activation Group
Maintaining OPM RPG/400 and ILE RPG Program Compatibility
Deleting an Activation Group
Reclaim Resources Command
Managing Dynamically-Allocated Storage
Managing the Default Heap Using RPG Operations
Heap Storage Problems
Managing Your Own Heap Using ILE Bindable APIs
Calling Programs and Procedures
Program/Procedure Call Overview
Calling Programs
Calling Procedures
The Call Stack
Recursive Calls
Parameter-Passing Considerations
Using a Prototyped Call
Using the CALLP Operation
Calling within an Expression
Examples of Free-Form Call
Passing Prototyped Parameters
Parameter Passing Styles
Using Operational Descriptors
Omitting Parameters
Checking for the Number of Passed Parameters
Passing Less Data Than Required
Passing File Parameters
Order of Evaluation
Interlanguage Calls
Interlanguage Calling Considerations
Using the Fixed-Form Call Operations
Examples of CALL and CALLB
Passing Parameters Using PARM and PLIST
Returning from a Called Program or Procedure
Returning from a Main Procedure
Returning from a Subprocedure
Returning using ILE Bindable APIs
Using Bindable APIs
Examples of Using Bindable APIs
Calling a Graphics Routine
Calling Special Routines
Storage Model
Considerations for the single-level storage model
Considerations for the teraspace storage model
Considerations for the inherit storage model
Recommendations for the storage model of programs and service programs
Multithreading Considerations
Running Concurrently in Multiple Threads
Running Serialized in Multiple Threads
Activation Group Considerations for the THREAD keyword
Storage that is Shared Among Multiple Threads
How to Avoid Deadlock Between Modules
All-Thread Static Variables
When to use a serialized procedure
When a serialized procedure does not provide sufficient protection
Difficulty of manually synchronizing access to shared resources
Using thread-related APIs
RPG and the eBusiness World
RPG and XML
Processing XML Documents
RPG and MQSeries
RPG and Java
Introduction to Java and RPG
Calling Java Methods from ILE RPG
Calling methods in your own classes
Controlling how the Java Virtual Machine is set up
RPG Native Methods
Coding Errors when calling Java from RPG
Additional RPG Coding for Using Java
Additional Considerations
Advanced JNI Coding
Calling RPG programs from Java using PCML
Debugging and Exception Handling
Debugging Programs
The ILE Source
Debug Commands
Preparing a Program for Debugging
Creating a Root Source View
Creating a COPY Source View
Creating a Listing View
Creating a Statement View
Starting the ILE Source
STRDBG Example
Setting Debug Options
Adding/Removing Programs from a Debug Session
Example of Adding a Service Program to a Debug Session
Example of Removing ILE Programs from a Debug Session
Viewing the Program Source
Viewing a Different Module
Changing the View of a Module
Setting and Removing Breakpoints
Setting and Removing Unconditional Job Breakpoints
Setting and Removing Unconditional Thread Breakpoints
Setting and Removing Conditional Job Breakpoints
National Language Sort Sequence (NLSS)
Setting and Removing Job Breakpoints Using Statement Numbers
Setting and Removing Conditional Thread Breakpoints
Removing All Job and Thread Breakpoints
Setting and Removing Watch Conditions
Characteristics of Watches
Setting Watch Conditions
Displaying Active Watches
Removing Watch Conditions
Example of Setting a Watch Condition
Stepping Through the Program Object
Stepping Over Call Statements
Stepping Into Call Statements
Displaying Data and Expressions
Unexpected Results when Evaluating Variables
Displaying the Contents of an Array
Displaying the Contents of a Table
Displaying Data Structures
Displaying Indicators
Displaying Fields as Hexadecimal Values
Displaying Fields in Character Format
Displaying UCS-2 Data
Displaying Variable-Length Fields
Displaying Data Addressed by Pointers
Evaluating Based Variables
Displaying Null-Capable Fields
Using Debug Built-In Functions
Debugging an XML-SAX Handling Procedure
Changing the Value of Fields
Displaying Attributes of a Field
Equating a Name with a Field, Expression, or Command
Source Debug National Language Support for ILE RPG
Sample Source for Debug Examples
Handling Exceptions
Exception Handling Overview
ILE RPG Exception Handling
Using Exception Handlers
Exception Handler Priority
Nested Exceptions
Unhandled Exceptions
Optimization Considerations
Using RPG-Specific Handlers
Specifying Error Indicators or the 'E' Operation Code Extender
Using a MONITOR Group
Using an Error Subroutine
Specifying a Return Point in the ENDSR Operation
ILE Condition Handlers
Using a Condition Handler
Using Cancel Handlers
Problems when ILE CL Monitors for Notify and Status Messages
Obtaining a Dump
Obtaining an ILE RPG Formatted Dump
Using the DUMP Operation Code
Example of a Formatted Dump
Working with Files and Devices
Defining Files
Associating Files with Input/Output Devices
Naming Files
Types of File Descriptions
Using Files with External-Description as Program-Described
Example of Some Typical Relationships between Programs and Files
Defining Externally Described Files
Renaming Record-Format Names
Renaming Field Names
Ignoring Record Formats
Using Input Specifications to Modify an External Description
Using Output Specifications
Level Checking
Defining Program-Described Files
Data Management Operations and ILE RPG I/O Operations
General File Considerations
Overriding and Redirecting File Input and Output
Example of Redirecting File Input and Output
File Locking
Record Locking
Sharing an Open Data Path
Spooling
Output Spooling
SRTSEQ/ALTSEQ in an RPG Program versus a DDS File
Accessing Database Files
Database Files
Physical Files and Logical Files
Data Files and Source Files
Using Externally Described Disk Files
Record Format Specifications
Access Path
Valid Keys for a Record or File
Record Blocking and Unblocking
Using Program-Described Disk Files
Indexed File
Sequential File
Record Address File
Methods for Processing Disk Files
Consecutive Processing
Sequential-by-Key Processing
Random-by-Key Processing
Sequential-within-Limits Processing
Relative-Record-Number Processing
Valid File Operations
Using Commitment Control
Starting and Ending Commitment Control
Specifying Files for Commitment Control
Using the COMMIT Operation
Specifying Conditional Commitment Control
Commitment Control in the Program Cycle
Unexpected Results Using Keyed Files
DDM Files
Using Pre-V3R1 DDM Files
Accessing Externally Attached Devices
Types of Device Files
Accessing Printer Devices
Specifying PRINTER Files
Handling Page Overflow
Using the Fetch-Overflow Routine in Program-Described Files
Changing Forms Control Information in a Program-Described File
Accessing Tape Devices
Accessing Display Devices
Using Sequential Files
Specifying a Sequential File
Using SPECIAL Files
Example of Using a Special File
Using WORKSTN Files
Intersystem Communications Function
Using Externally Described WORKSTN Files
Specifying Function Key Indicators on Display Device Files
Specifying Command Keys on Display Device Files
Processing an Externally Described WORKSTN File
Using Subfiles
Using Program-Described WORKSTN Files
Using a Program-Described WORKSTN File with a Format Name
Using a Program-Described WORKSTN File without a Format Name
Valid WORKSTN File Operations
EXFMT Operation
READ Operation
WRITE Operation
Multiple-Device Files
Example of an Interactive Application
Database Physical File
Main Menu Inquiry
MAINMENU: DDS for a Display Device File
CUSMAIN: RPG Source
File Maintenance
CUSMSTL1: DDS for a Logical File
MNTMENU: DDS for a Display Device File
CUSMNT: RPG Source
Search by Zip Code
CUSMSTL2: DDS for a Logical File
SZIPMENU: DDS for a Display Device File
SCHZIP: RPG Source
Search and Inquiry by Name
CUSMSTL3: DDS for a Logical File
SNAMMENU: DDS for a Display Device File
SCHNAM: RPG Source
Appendixes
Appendix A. Behavioral Differences Between OPM RPG/400 and ILE RPG for AS/400
Compiling
Running
Debugging and Exception Handling
I/O
DBCS Data in Character Fields
Appendix B. Using the RPG III to RPG IV Conversion Aid
Conversion Overview
File Considerations
The Log File
Conversion Aid Tool Requirements
What the Conversion Aid Won't Do
Converting Your Source
The CVTRPGSRC Command
Converting a Member Using the Defaults
Converting All Members in a File
Converting Some Members in a File
Performing a Trial Conversion
Obtaining Conversion Reports
Converting Auto Report Source Members
Converting Source Members with Embedded SQL
Inserting Specification Templates
Converting Source from a Data File
Example of Source Conversion
Analyzing Your Conversion
Using the Conversion Report
Using the Log File
Resolving Conversion Problems
Compilation Errors in Existing RPG III Code
Unsupported RPG III Features
Use of the /COPY Compiler Directive
Use of Externally Described Data Structures
Run-time Differences
Appendix C. The Create Commands
Using CL Commands
How to Interpret Syntax Diagrams
CRTBNDRPG Command
Description of the CRTBNDRPG Command
CRTRPGMOD Command
Description of the CRTRPGMOD command
Appendix D. Compiler Listings
Reading a Compiler Listing
Prologue
Source Section
Additional Diagnostic Messages
Output Buffer Positions
/COPY Member Table
Compile-Time Data
Key Field Information
Cross-Reference Table
EVAL-CORR Summary
External References List
Message Summary
Final Summary
Code Generation and Binding Errors
Bibliography
Index


[ Top of Page | Previous Page | Next Page | Contents | Index ]