Java for RPG Programmers: 3rd edition

As the roles of Java in business and e-business applications continue to grow, all iSeries and AS/400 IT professionals have a choice to make—learn Java or get left behind. Programmers, development managers, and architects who want to stay on the cutting edge of their careers must learn how to use and understand Java. IBM is not abandoning RPG, but more and more Java is finding a role in leading-edge applications. For an RPG programmer, learning Java can be daunting, but with the right help, it's a skill that can be mastered. This completely revised and updated edition offers that help by gently yet comprehensively teaching the Java language and core Java-supplied functionality.

1122602374
Java for RPG Programmers: 3rd edition

As the roles of Java in business and e-business applications continue to grow, all iSeries and AS/400 IT professionals have a choice to make—learn Java or get left behind. Programmers, development managers, and architects who want to stay on the cutting edge of their careers must learn how to use and understand Java. IBM is not abandoning RPG, but more and more Java is finding a role in leading-edge applications. For an RPG programmer, learning Java can be daunting, but with the right help, it's a skill that can be mastered. This completely revised and updated edition offers that help by gently yet comprehensively teaching the Java language and core Java-supplied functionality.

79.99 In Stock
Java for RPG Programmers: 3rd edition

Java for RPG Programmers: 3rd edition

by Phil Coulthard, George Farr
Java for RPG Programmers: 3rd edition

Java for RPG Programmers: 3rd edition

by Phil Coulthard, George Farr

eBookThird Edition, Third edition (Third Edition, Third edition)

$79.99 

Available on Compatible NOOK devices, the free NOOK App and in My Digital Library.
WANT A NOOK?  Explore Now

Related collections and offers

LEND ME® See Details

Overview

As the roles of Java in business and e-business applications continue to grow, all iSeries and AS/400 IT professionals have a choice to make—learn Java or get left behind. Programmers, development managers, and architects who want to stay on the cutting edge of their careers must learn how to use and understand Java. IBM is not abandoning RPG, but more and more Java is finding a role in leading-edge applications. For an RPG programmer, learning Java can be daunting, but with the right help, it's a skill that can be mastered. This completely revised and updated edition offers that help by gently yet comprehensively teaching the Java language and core Java-supplied functionality.


Product Details

ISBN-13: 9781931182362
Publisher: Mc Press
Publication date: 05/01/2012
Sold by: Barnes & Noble
Format: eBook
Pages: 800
File size: 16 MB
Note: This product may take a few minutes to download.

About the Author

Phil Coulthard is the lead architect for AS/400 application development projects at the IBM Toronto laboratory. He has worked as a developer, team leader, manager, and general advocate of AS/400 application developments since 1986. He lives in Toronto, Ontario. George Farr is a tester, developer, team leader, technical planner, and development manager for AS/400 compiler. He is the coauthor AS/400 COBOL Programmers and Java for S/390. He lives in Toronto, Ontario.

Read an Excerpt

Java for RPG Programmers


By Phil Coulthard, George Farr

IBM Press and MC Press

Copyright © 2006 International Business Machines Corporation
All rights reserved.
ISBN: 978-1-931182-36-2



CHAPTER 1

THE WORLD OF JAVA


Since the very first edition of this book in July 1998, the world of Java has continued to gain significant ground. By now, everyone is aware of the industry's commitment to Java, of IBM's commitment to Java, and especially of the System i's commitment to Java. Way back in 1998, the options for System i Java programmers were exactly two: write Java applications that run on the System i or on a client connected to an System i, or write Java applets that run in a Web browser connected to an System i. Now, in addition to the expanded capabilities of both of these options, there are servlets, JavaServer Pages, JavaServer Faces, and Enterprise JavaBeans (EJBs). Java is now also a full-fledged option for writing Domino applications. Further, XML, with its Java affinity, has emerged as the new standard for business-to-business communication and is a favorite way to persist information needed by tools. A rapidly emerging new standard for reusable components, known as Web Services, also have tight affinity with Java.

Most vendors writing tools have switched to Java. Most package vendors have adopted Java or have a plan to phase it in. Java presentations at professional and technical conferences continue to fill rooms. Look at the agenda for the North American COMMON conference (www.common.org), and you'll see that Java and Java-related technologies permeate it.

So, while Java is still maturing and expanding rapidly, it is now an entrenched part of the System i application development scene. At the same time, IBM has proven it is not backing away from RPG or COBOL, and has continued to deliver significant new functionality in each release of both. Further, IBM's application development package, WebSphere Development Studio Client for iSeries (WDSC), offers modern tooling for everything from RPG to Java to Web user interfaces. That tooling includes WebFacing, an exciting option for quickly and cost-effectively converting 5250 applications into Web-enabled applications. WebFacing converts display-file DDS source into JavaServer Page source and JavaBeans (simple beans, not EJBs). The WebFacing runtime intercepts the display file input/output operations from an application and diverts them to the WebFacing runtime servlet, offering a Web refacing with no application code change. This awesome capability is possible due to the power of Java.

WDSC is an Integrated Development Environment (IDE) that includes tools for Web user interfaces authored in HTML and JavaScript, JavaServer Pages, and JavaServer Faces, and includes Java tools for applications, applets, servlets, and beans. Also included are tools for RPG, COBOL, C, C++, CL, and DDS development. Indeed, the tools can target i5/OS (aka OS/400), Linux and AIX partitions. All of this tooling is based on Eclipse, an extremely popular open-source IDE written in Java and targeting Java developers. See it and get it at . Eclipse is a pluggable and extendable IDE. Eclipse was originally authored by IBM and then donated to the open source community. IBM continues to heavily invest in Eclipse, and is a key indication of IBM's commitment to Java.

Evolving the languages and the tools are important enough in their own right, but IBM has also shown it clearly sees a world with both Java and RPG/COBOL by continually enhancing both RPG and COBOL to increase your ability to mix Java and RPG/COBOL code in the same application. V5R1 and later releases of RPG and COBOL bear out this commitment. While Java is clearly the glue of e-Business, IBM will ensure that both RPG and COBOL have roles in this new and exceedingly important picture, for those who prefer to use a business language for their business logic.

With all this in mind, this book will teach you Java so you can include it as another option in your programming toolbox. If you have already read the first or second edition, welcome back. You will find many additional topics and increased coverage of the core topics. If this is your first read, congratulations on taking the first step on the road to Java.


WHAT IS JAVA?

Java is a programming language. So are RPG and CL. You learned them, and you can learn Java. The reason Java seems like more than just a programming language is the vast number of places it can be used. Vertically, it can be used to program the smallest embedded chips and personal devices all the way up to the largest scalable, transaction-based, distributed enterprise applications. Horizontally, it can run on any operating system and almost any device. Java can be the answer for your user interface, and it can be the language of your next batch language. It can do e-Business on the Internet, and it can do back-office payroll.

However, with all of this, you must distinguish between the core Java language, which is stable, mature, and relatively small, and the Java technologies built on top of that language. These technologies are just specialized Java code written by the industry to solve specific tasks, such as programming chips, Internet Web servers, or large-scale mission-critical applications that support distribution and transactions.

The trick to learning Java is to start with the core language, including the syntax and the core Java-supplied functions. With these under your belt, you can move on to additional Java technologies with relative ease, if and when you need them.

From this book, you will learn the core Java language syntax by having it compared every step of the way to RPG. You will also learn the core Java-supplied functions that you will need to succeed with Java, again compared every step of the way to RPG. With the proper analogies, and the proper definition of terms in System i-speak, you'll find that Java is not mysterious and absolutely within your capabilities to learn, use, and master! Indeed, thousands of RPG programmers before you have done exactly that.

This book is not small, but neither are your RPG and DDS manuals. Do not despair, as the size is simply because we have included many examples in both RPG and Java to give you a complete introduction to as much Java as you will need to be productive. This might not be the last book you read on Java, but it should make you immediately productive with Java.


WHAT ABOUT THAT OO THING?

Java is an object-oriented language. It is inconceivable that a new language today would not be object-oriented; the benefits in productivity and quality are too great to ignore. These gains come from the capacity to reuse code and perform better problem domain-modeling. When people complain about Java's learning curve, they always refer to the OO side of things. This is typically from people who haven't learned Java, or want to promote an alternative. Don't be fooled. Yes, thinking "OO" is different than thinking procedurally as you do in RPG. But it comes quickly, and not by reading a book, frankly. That helps, to be sure, but it really starts coming home only by writing code. With a little experience, you can pick up an OO book or course, and it will all fall into place. Once it does fall into place, you will wonder how you lived without it.

Our approach to OO in this book is not to hit you over the head with it. Our primary goal is to teach you the language and the major functionality supplied with the language. As we do that, we'll be showing you many examples. You will slowly get the hang of objects simply by seeing them, and, if you follow along, by coding them. They really are not that hard. So, don't think OO means "uh oh!" It is just a tool that ultimately will make your life better. (Well, your programming life, anyway.)


WHY THE HYPE?

If Java is just a programming language, then why all the fuss? There are a number of reasons:

* The name. Java is a cool name! Programmers like that.

* The Internet. Java has much affinity with the Internet. CEOs like that.

* Portability. Java makes it possible to write completely portable code. CIOs like that.

* Accessibility. Java is free. CFOs like that.

The following sections examine these reasons a little further. We hope you like that.


The Name

Java was originally designed by engineers from Sun Microsystems. Their intent was to create a small-scale, interpreted language for programming small consumer devices. Reportedly known as "Oak" in its early days, it was originally an embedded language that quickly found a new use for Internet-related programming. It had all the attributes a programming language for the Internet could want: it was small, simple, easy to code, platform independent, and provided support for dynamic loading of code on demand.

Thus, it was renamed and made publicly available as a programming language for the Internet in 1995.

Java's big boost, however, came in early 1996, when Netscape Communications stepped up to support it as a programming language that could be processed by its Web browser. Suddenly, thousands of programmers and Web site owners wanted to learn and use Java.

What about the name? Legend has it that it came from the coffee the engineers drank in vast quantities while working so hard on the project. We guess "Donut" was ruled out.


The Internet

The original reason for Java's popularity, then, was the Internet. Specifically, Java could be used to program Web pages displayed by Web browsers such as Netscape's Navigator or Microsoft's Internet Explorer. Web browsers display text and graphics through HTML (Hypertext Markup Language), a tag-based language similar to UIM (User Interface Manager, the System i source language for writing online help).

Java adds the ability to embed Java applets inside HTML pages. Applets are small applications that only run inside Web browsers, using the screen real estate of the browser window. Since they have the full power of a modern programming language behind them, they can provide fully interactive, animated, live-data Web pages, which is beyond what HTML could originally offer. Java can also be used to author servlets, which are server-side programs for serving up Web pages dynamically and on demand.

Java also supports easy Internet communications programming, using either HTTP or TCP/IP communications protocols. Indeed, it is possible to write a Web browser entirely in Java that performs the basic tasks of finding, retrieving, and displaying HTML files. In fact, Sun originally did that with its HotJava Web browser. While this is easy enough, you have no need for communications programming as an System i programmer because IBM supplies the iSeries Toolbox for Java, a rich collection of pre-written code that makes remotely accessing System i programs and data easy.


Portability

Java approaches more closely than any preceding language that elusive goal of "write once, run anywhere." It is possible to write completely portable applications in Java without too much sacrifice or pain. Here is why this is possible:

* Java (like BASIC and Smalltalk) is interpreted rather than compiled.

* Java's interpreter is everywhere, in operating systems, Web browsers, chips, and more.

* The Java platform is rich in functionality, so there is little need for operating system APIs.


Accessibility

Sun Microsystems makes Java available for free over the Internet for Windows and Solaris. IBM and others take that and make it available for their operating systems, Web browsers, computer chips, personal devices, toaster ovens, and so on. In most cases today, Java is actually made part of the operating system, so it is even more accessible.

Visit any Web-search site, do a search for the word Java, and you'll find thousands of free tutorials, newsgroups and other resources at your disposal. Of course, you can pay for onsite education and robust development tools, but one of Java's most alluring features is that you don't have to make that investment. Even your local community college will almost certainly offer a Java programming course. (Finally, the Pascal courses has been retired!)


THE ROLES OF JAVA

Java can play a role in at least three important places in your application:

* The client. This can be a traditional GUI application, a Web browser applet, or a Java servlet-created Web page. The user interface will run on any client operating system.

* The server. This can be a small part of an existing application, an entire traditional business-logic application, or a new Enterprise JavaBean application.

* The glue. Whatever the decisions for the client and the server, Java is a good option for tying them together. With new Web Services coming online, Java is also the glue between any two pieces of business logic running on any two machines in any two companies.


THE HOUSE OF JAVA

Java comes in its purest form as the Java Development Kit, or JDK (also known as J2SE Development Kit). This kit contains a number of fundamentals, including these:

* A Java compiler that compiles Java source code into efficiently interpreted bytecode (as opposed to directly executable machine code). This is the javac command.

* A Java interpreter that interprets or runs Java bytecode. This is the java command.

* A set of Java class libraries (packages), similar to reusable ILE service programs, for often-needed programming tasks.

These basic elements, together with their documentation, define the Java language. The documentation is in HTML and is shipped compressed into a file that is a separate download from the JDK, so be sure to get it too. While packaged separately, the documentation is still considered part of the JDK. The JDK also includes a number of other useful command-line tools, shown in Table 1.1.

You can find Sun's JDK for Windows and Solaris at www.java.sun.com/products. Follow the links for J2SE Technologies, where J2SE is "Java 2 Standard Edition" although as of this writing Sun has announced future releases will drop the "2," as in Java Standard Edition or JSE. Further, Java comes with the operating system on the System i, but is known there as the Java Application Development Kit for Java. However, this book uses the simpler term JDK.

The JDK does not include an editor, an integrated development environment, or a visual design tool, and it provides only the most rudimentary of debuggers. Nonetheless, with a decent editor (such as Eclipse) you have all you need for basic Java development. Figure 1.1 illustrates the pieces of the JDK.

Most programmers, however, will opt for one of the many full-scale Java development tools that are already available, such as the open source Eclipse, Sun's NetBeans, or Borland® JBuilder®. These start with the basic JDK, and then add IDEs (integrated development environments), class hierarchy browsers, debuggers, visual design tools, wizards, and many more items to make the development task easier. Multiple-developer shops will also look for tools that offer built-in team support and versioning control, such as Eclipse offers. Note that all of IBM's Rational application development products including Rational Application Developer are based on Eclipse.

The JDK originates with Sun Microsystems. Based on tremendous programmer feedback via its Java Community Process (jcp.org), the company adds enhancements and features to the language, and regularly releases a new version of the JDK. Other industry partners betting heavily on Java work with Sun to define and even implement many specialized pieces.

In February 1997, Sun released version 1.1 of the JDK. In December 1998, it released 1.2, and in February 2000, it released 1.3. Release 1.4 came out at the end of 2001, and Java 5.0 (new numbering schema) came out in 2004. Each release has numerous updates, such as 1.4.2, which focus primarily on bug fixes. As of version 1.2, the official generic branding became Java 2 Platform, Standard Edition and changed to simply Java Standard Editor for version 6. There is also an Enterprise Edition, which is a superset of the Standard Edition and includes server-side functionality such as servlets, JavaServer Pages, JavaServer Faces and Enterprise JavaBeans. The JDK is maturing and improving very fast, but hopefully its name has stabilized!


(Continues...)

Excerpted from Java for RPG Programmers by Phil Coulthard, George Farr. Copyright © 2006 International Business Machines Corporation. Excerpted by permission of IBM Press and MC Press.
All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.

Table of Contents

Contents

Title Page,
Copyright Page,
Dedication,
ACKNOWLEDGMENTS,
FOREWORD,
1 - THE WORLD OF JAVA,
2 - THE JAVA ONION,
3 - JAVA'S LANGUAGE AND SYNTAX,
4 - STRUCTURED OPERATIONS AND STATEMENTS,
5 - DATA TYPES AND VARIABLES,
6 - ARRAYS AND VECTORS,
7 - STRING MANIPULATION,
8 - DATE AND TIME MANIPULATION,
9 - AN OBJECT ORIENTATION,
10 - EXCEPTIONS,
11 - THREADS,
12 - THE USER INTERFACE,
13 - DATABASE ACCESS,
14 - MORE JAVA,
APPENDIX A - USING JAVA ON,
THE System i,
APPENDIX B - MIXING RPG AND JAVA,
APPENDIX C - OBTAINING THE CODE SAMPLES,

From the B&N Reads Blog

Customer Reviews