Verwandte Artikel zu Free-Format RPG IV: How to Bring Your RPG Programs...

Free-Format RPG IV: How to Bring Your RPG Programs Into the 21st Century - Softcover

Faust, Mike; Martin, Jim

 
9781583470558: Free-Format RPG IV: How to Bring Your RPG Programs Into the 21st Century

Inhaltsangabe

What could be more important than upgrading your RPG skills? Traditional fixed-format style RPG IV programmers everywhere are embracing the increased productivity, better readability, and easier program maintenance that comes with the free-format style of programming in RPG IV. This book, a "how-to" guide and the first of its kind, will provide you with concise and thorough information on this powerful new way of coding RPG IV.

Though free-format information is available in IBM manuals, it is not separated from everything else, thereby requiring hours of tedious research to track down the information you need. With this book, your search is over. Free-Format RPG IV is the "one-stop" resource that will save you time and frustration. In it, you'll find everything you need to know to write RPG IV in the free-format style.

Author Jim Martin not only teaches rules and syntax, but also explains how this new style of coding has the potential to improve overall programmer productivity—from initial development through maintenance. He methodically covers the "how to" involved in free-format RPG IV, including many style issues, such as named indicators and built-in functions. He also addresses input and output, program flow, data manipulation, and math operations. There is even a chapter on prototyping and APIs.

Free-Format RPG IV is the definitive guide on the topic and just what you need to get started with this exciting, powerful style of programming.

With Free-Format RPG IV you will:

- Learn not only the "how-to," but also the "why" of free-format RPG IV

- Acquire essential, free-format style tips to help you write good, maintainable code

- Find complete-program solutions for specific problems, including associated display and printer files

- Discover how upgrading your RPG skills to free-format can take your programming career to the next level.

Die Inhaltsangabe kann sich auf eine andere Ausgabe dieses Titels beziehen.

Über die Autorinnen und Autoren

Jim Martin has a BS degree in mathematics and an MS in computer science. He was employed by IBM for 26 years, where he wrote RPG applications for customers and also worked in the programming laboratory as a programmer of portions of CPF and OS/400. After leaving IBM, he took post-graduate work in computer science and performed RPG training. He is an IBM-certified RPG IV developer.


Jim Martin was employed by IBM for 26 years writing applications primarily in RPG and as a programmer at the Rochester, Minnesota, programming laboratory working on portions of CPF and OS/400. He is an IBM-certified RPG IV developer and the author of the first edition, Free-Format RPG IV, and Functions in Free-Format RPG IV. He lives in Springfield, Missouri.

Auszug. © Genehmigter Nachdruck. Alle Rechte vorbehalten.

Free-Format RPG IV

By Jim Martin

MC Press

Copyright © 2009 Jim Martin
All rights reserved.
ISBN: 978-1-58347-055-8

Contents

Title Page,
Copyright Page,
Dedication,
Acknowledgments,
1 - Pre–Free-Format RPG IV,
2 - Introducing Free-Format RPG IV,
3 - Input/Output Using Free Format,
4 - Program Flow Using Free Format,
5 - Data-Manipulation Operations Using Free Format,
6 - Math Operations in Free Format,
7 - Call and Return in Free Format,
8 - Solutions for Problem Situations,
9 - The Case for Free-Format RPG,
10 - Sample Programs,
A - Free-Format Operations,
B - Additional Elements Used by the Sample Programs,
C - Free-Format Alternatives for Fixed-Format Operations,


CHAPTER 1

Pre–Free-Format RPG IV

The RPG programming language has certainly come a long way since its introduction as a simple report program generator in the 1960s. From the earliest versions of RPG to the latest release of free-format RPG IV on IBM's eServer iSeries (now i5) platform, the changes have been dramatic.

The centerpiece of today's RPG is its support for a free-format style of calculation coding. Free format puts RPG on the map of modern programming languages and gives programmers important new functionality for constructing programs that are easier to create, understand, and maintain. If you're writing RPG programs today, you owe it to yourself to make the most of this great new function.

In this book, you'll learn the ins and outs of free-format RPG, from I/O and program flow to data manipulation, math operations, and call and return. But before we dive into the delights of free-format RPG, let's take a brief look at its precursor: fixed-format RPG IV.


RPG IV

Even before free format, RPG IV was a powerful, functionally rich programming language. RPG IV — or ILE RPG, as it's officially known — debuted in late 1994 with Version 3 Release 1 (V3R1) of the OS/400 operating system. IBM had introduced the Integrated Language Environment (ILE) in a prior release, but everyone eagerly awaited RPG's entrée into ILE. Three major additions to RPG in V3R1 brought the language a significant level of sophistication that was previously absent: the extended Factor 2, built-in functions, and subprocedures.


Extended Factor 2

The introduction of the extended Factor 2 format, along with operations to exploit it, represented a huge departure from RPG's past. With this enhancement to calculation specifications, RPG programmers could begin to use operations such as Eval (Evaluate expression) and If (If) with long expressions.

The ability to use math symbols (+, -, *, /) within expressions was a major step in modernizing the language. Other symbols, used in comparison expressions, included equal (=), less than (<), greater than (>), less than or equal (<=), greater than or equal (>=), and not equal (<>). The exponentiation symbol (**) became the newest math operator, and support for parentheses let programmers indicate higher precedence in math or comparison expressions. Other programming languages had used these symbols for a while, and IBM chose to bring them into its new version of RPG.

One of the symbols, the plus sign (+), found an additional use in RPG IV: concatenation. Using this new operator, RPG programmers could put character data together into strings much more easily than with previous methods.


Built-in Functions

iSeries programmers were already familiar with built-in functions through their use of such functions in CL, OS/400's control language. The %Sst (substring) and %Bin (binary) functions, for example, are commonly used CL built-in functions.

The whole idea of an RPG IV built-in function was based on the C language's concept of a function. A built-in function performs one task, with or without parameters, and usually returns data of a predetermined data type to the point in the program where the function was specified. For example, RPG IV's %Eof built-in function checks for end-of-file after a Read operation, eliminating the need to code a resulting indicator on the Read. The %Found built-in function lets you check for a record-found condition after a Chain operation without using a resulting indicator.

The number of built-in functions available in RPG has grown from the dozen or so provided in RPG IV's initial release to 76 as of V5R3. Many of these "built-ins" duplicate the function of older operation codes, such as Scan (built-in function %Scan) and Subst (built-in function %Subst). In some cases, the built-in function provides more capabilities than the operation code it replaces. For example, the %Subst built-in function can substring a target as well as a source string, whereas the Subst (Substring) operation code can substring only a source string.


Subprocedures

As if these new capabilities weren't enough, IBM added another powerful feature to RPG IV. Support for subprocedures gives RPG IV programmers the option to break complex programs into smaller parts and to create "homegrown" built-in functions if desired. For the first time in RPG, IBM introduced the concept of a local variable for use in subprocedures. Also for the first time, a routine — in this case, a subprocedure — could use recursion.


Other Changes

In RPG IV, IBM also eliminated many of the old constraints of RPG/400 (RPG IV's predecessor). Eight-character file and record names were lengthened to 10. Field name lengths were increased, too — at first to 10 and then to 4,096! The maximum size of character fields grew from 256 bytes to 32,767. Packed-numeric field size was raised to 30 and then 31 digits; it now stands at 63.

Even fans of binary and hexadecimal programming got something new in RPG IV. Previously, you could convert two-byte binary numbers to four-digit decimal numbers and convert four-byte binary numbers to nine digits. The new RPG IV language provided an integer data type, both signed and unsigned, up to 20 digits. To handle ultra-small and ultra-large numbers, the floating point data type made its debut, in both standard and double precision.

Other data types added to the language include the pointer data type, which contains the address of data or a procedure; the object data type, used to handle references to a Java object; and the date, time, and timestamp data types.

Adding these new data types and enlarging the older ones must have come from some greater motivating factor. Why did IBM provide all these things? In my opinion, the reasons lay in maintaining the iSeries as a modern and viable solution for the midrange server marketplace. Older RPG can easily be called a "dinosaur" in this modern age. The gap in programming capabilities between older RPG and modern languages such as C, C++, Java, and others was huge. With today's RPG IV, there is no gap. RPG IV has "come from behind" to be a major player in the modern world of application development.


Some "Baggage" That Came Along

Like any responsible vendor, IBM doesn't like to offend any of its customers. If you wrote an RPG program in 1969 that used the RPG cycle and 99 indicators, IBM won't tell you today that your approach is obsolete. Instead, IBM continues to provide a compatibility path from the "here and now" back to almost any previous time in RPG's history. The machines may change every six to eight years, but programs and the inherent investment made in developing them are preserved....

„Über diesen Titel“ kann sich auf eine andere Ausgabe dieses Titels beziehen.