ILE RPG Programmer's Guide
Total Page:16
File Type:pdf, Size:1020Kb
IBM i Version 7.2 Programming IBM Rational Development Studio for i ILE RPG Programmer's Guide IBM SC09-2507-09 Note Before using this information and the product it supports, read the information in “Notices” on page 485. This edition applies to IBM® Rational® Development Studio for i (product number 5770-WDS) and to all subsequent releases and modifications until otherwise indicated in new editions. This version does not run on all reduced instruction set computer (RISC) models nor does it run on CISC models. This document may contain references to Licensed Internal Code. Licensed Internal Code is Machine Code and is licensed to you under the terms of the IBM License Agreement for Machine Code. © Copyright International Business Machines Corporation 1994, 2013. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Part 1. ILE RPG Programmer's Guide......................................................................1 Chapter 1. About ILE RPG Programmer's Guide.........................................................................................3 Who Should Use This Guide................................................................................................................... 3 Prerequisite and Related Information................................................................................................... 3 How to Send Your Comments................................................................................................................ 3 Chapter 2. What's New................................................................................................................................ 5 What's New since 7.2?........................................................................................................................... 5 What's New in 7.2?................................................................................................................................. 9 What's New in 7.1?...............................................................................................................................17 What's New in 6.1?...............................................................................................................................21 What's New in V5R4?........................................................................................................................... 25 What's New in V5R3?........................................................................................................................... 29 What's New in V5R2?........................................................................................................................... 33 What's New in V5R1?........................................................................................................................... 36 What's New in V4R4?........................................................................................................................... 41 What's New in V4R2?........................................................................................................................... 45 What's New in V3R7?........................................................................................................................... 49 What's New in V3R6/V3R2?.................................................................................................................52 Chapter 3. ILE RPG Introduction...............................................................................................................57 Overview of the RPG IV Programming Language................................................................................ 57 RPG IV Specifications..................................................................................................................... 57 Cycle Programming.........................................................................................................................58 Indicators........................................................................................................................................59 Operation Codes............................................................................................................................. 59 Example of an ILE RPG Program.................................................................................................... 60 Using IBM i...................................................................................................................................... 65 Rational Development Studio for i................................................................................................. 66 RPG Programming in ILE......................................................................................................................66 Program Creation............................................................................................................................67 Program Management.................................................................................................................... 68 Program Call....................................................................................................................................69 Source Debugging...........................................................................................................................69 Bindable APIs................................................................................................................................. 69 Multithreaded Applications............................................................................................................ 70 Program Creation Strategies................................................................................................................71 Strategy 1: OPM-Compatible Application...................................................................................... 71 Strategy 2: ILE Program Using CRTBNDRPG................................................................................. 73 Strategy 3: ILE Application Using CRTRPGMOD............................................................................ 75 A Strategy to Avoid......................................................................................................................... 78 Creating an Application Using Multiple Procedures............................................................................79 A Multiple Procedures Module — Overview................................................................................... 79 Example of Module with Multiple Procedures............................................................................... 82 Coding Considerations....................................................................................................................89 For Further Information..................................................................................................................91 Chapter 4. Creating and Running an ILE RPG Application........................................................................93 Using Source Files................................................................................................................................ 93 Using Source Physical Files............................................................................................................ 93 iii Using IFS Source Files.................................................................................................................... 98 Creating a Program with the CRTBNDRPG Command...................................................................... 101 Using the CRTBNDRPG Command............................................................................................... 102 Using a Compiler Listing............................................................................................................... 107 Accessing the RETURNCODE Data Area...................................................................................... 113 Creating a Program with the CRTRPGMOD and CRTPGM Commands............................................. 115 Creating a Module Object............................................................................................................. 115 Binding Modules into a Program.................................................................................................. 122 Using a Binder Listing................................................................................................................... 127 Changing a Module or Program.................................................................................................... 127 Creating a Service Program................................................................................................................129 Service Program Overview........................................................................................................... 129 Strategies for Creating Service Programs.................................................................................... 130 Creating a Service Program Using CRTSRVPGM..........................................................................131 Sample Service Program.............................................................................................................. 132 Running a Program.............................................................................................................................138 Running