IPL Your Career

Article ID: 63391

You’ve probably heard the expression “If your only tool is a hammer, everything looks like a nail.” This expression is especially true with programming. If you have only one tool in your toolbox, you’ll sometimes see only one possible solution to a problem or design for an application. By limiting your vision in this fashion, you do a disservice to yourself and your customers (internal or external). As a developer, it is vital that you provide customers with not just a solution, but also the best solution for their needs.

Today, relying on a single skill simply isn’t good enough. As companies move toward a user-friendlier GUI interface, RPG green-screen applications are no longer acceptable. As new technologies develop and become prevalent, you should be aware of them. Your choice is simple: adapt or become irrelevant. To stay up-to-date and relevant in the IT market, you have to change your way of thinking; you have to update and grow your skills. Now more than ever, your favorite platform is being thought of as a legacy system—a system that can’t provide the nice GUI interfaces and accommodate the newer technologies in the marketplace. This thinking simply is not true. The Power system running IBM i OS is capable not only of providing these functions, but it excels at them. This platform has evolved and adapted and still remains the best business platform available. To show the relevance of the system and its modern architecture, it’s up to you, as a developer, to learn and use the functionality that is available. It’s easy to “rest on your laurels” and stick with what you know, but what you don’t know can hurt you. The IT landscape constantly changes and as it does, you should be ready to tackle the new challenges it brings.

Continued Learning Benefits You

A major argument for not learning new skills is “My company doesn’t pay for training.” This is true for many of us, but to stay marketable and productive, you must take the time and the initiative to learn for yourself. Ultimately, it’s your career and your responsibility; what you do to manage your career is your choice. Learning new skills takes time and effort, but you don’t necessarily need to incur great expense. Many free resources are available for learning new skills that will not only help you to provide robust applications, but also help you to determine the right tool for the job. For you to be able to determine the best tool for the job, you must first have the tools and know how to use them. Most of the skills you already possess are powerful, useful, and relevant but you have to ensure that you do not become complacent and let your skill set become stagnant.

A major upside to learning and being able to use new skills is that you can use them on platforms other than the IBM i. This not only makes you more marketable in the IT world, but it also increases your value as a developer. While the IBM i OS with RPG is your bread and butter, it never hurts to be able to transition to other platforms when necessary. Even if you never have to work on other platforms, you’ll be better able to understand how they work and how to communicate with them.

Technologies to Learn

As you begin your educational journey you need to be aware of today’s web technologies. For example, you should be thinking about real-time data strategies and external communications. XML is quickly becoming the de facto standard for transmitting data via the Internet. Web services, which use XML for passing data between systems, are quickly becoming the preferred method of trading real-time, on-demand data. You can implement web services in RPG to let external customers access your application interfaces and databases, and you can in turn write WS-consumer RPG applications to automate interaction with business partners and publicly published web services. Java and PHP can be WS providers and consumers as well. Both Java and PHP have extensive WS tool sets that make them a better choice for WS interfaces than RPG; you can still use RPG back-end programs to exploit your existing business logic.

Another skill that you may already have is knowledge of SQL. SQL is a very powerful tool that can help you span multiple platforms. SQL is available and usable for all databases (yes, even Microsoft Access!). SQL performance has improved phenomenally on the IBM i in past years and IBM has committed to continued enhancement of SQL for the IBM i. If you’re not familiar with SQL, or you’re not using it, now is a good time to start. SQL, an integral component for all databases, allows easy access and manipulation of data and gives additional functionality and flexibility to your applications. You can embed SQL into RPG programs and you can use it for reading, writing, and updating data. Files used only in the SQL portion of a program do not require an F spec.

You should become familiar with the Model-View-Controller (MVC) architectural pattern, which is used for developing applications in many different languages. You can use this same method to complement your RPG skills, and ultimately reduce maintenance and leverage new programming languages. Using RPG as the model allows you to maintain the business logic as you always have before and where it should be, running native on the IBM i. However, for the view and controller, RPG is not the only or necessarily the best tool for the job. The view (or user interface) is much better handled by utilizing a different language or method such as web pages (CGI, HTML, PHP, EGL) or client-side application (Java, .NET). The controller would be a program that performs the “hand off” of data between the model and the view. You can modify or maintain the business logic (or model) without the modifying the view or control. This allows for easier maintenance and RPG is better suited for this task. Leveraging your RPG skills to follow this approach should be easy enough; you’ve been doing business logic using those skills for a long time and are well versed in its strengths and weaknesses. RPG excels at business logic and data access on the IBM i, not at user interfaces. Many different languages and methods are available that can produce easy-to-use, better-looking user interfaces.

For web-based applications, you’ll need to be familiar with web servers. Fortunately, IBM includes the Apache web server with the OS. For most web applications the web server acts as the controller in the MVC pattern. Configuring the web server is the first task you’ll have to perform to get your system ready for serving web pages. The Admin HTTP server setup that is installed with the OS will guide you through the basics of setting up the web server. Apache’s website is the best place to go for answers about configuration, but many forums for Apache users also are available.

Tools to Learn and Love

Let’s look at the tools you’ll need to be familiar with to deliver the user-friendly GUIs and web-based applications that are in demand today.

HTML and CSS – One of the first tools you’ll need to implement most web-based applications is HTML. HTML is an easy-to-understand tag language. You’ll find hundreds of sites on the Internet where you can learn about HTML for free. Static HTML is a web page with information that rarely (if ever) changes. In business there’s not really much use for that type of web page. Dynamic HTML is written “on the fly” by a script or program that is executed or called by the web server. Along with HTML, Cascading Style Sheets (CSS) is another valuable tool that can save you time and free you from maintenance headaches when writing web-based applications. You use CSS to format web page parts at the HTML tag level. You can store CSS in a separate file that is used in a fashion similar to an RPG copybook in your web page’s HTML. For CGI and PHP (discussed below), HTML is one tool you can’t live without!

CGI – One method of serving a web-based application is Common Gateway Interface (CGI). CGI is a script (or program call for the IBM i OS) that is executed by the web server via a web browser. You can easily integrate CGI into your applications and you can implement it via RPG programs. CGIDEV2, a library of tools for implementing web pages via native IBM i OS programs, works well and is very versatile. You can download CGIDEV2 for free from www.easy400.net. This library consists of service programs and modules that can be bound into your RPG programs to dynamically generate HTML web pages. CGIDEV2 is a handy tool, but the CGI mechanism itself has inherent weaknesses that require careful web server configuration and file permission settings. CGIDEV2 requires that you code your HTML piecemeal, which can be cumbersome: you store HTML fragments as IFS files that CGIDEV2 assembles and serves as complete HTML documents. Many popular HTML composition editors, such as Dreamweaver, Eclipse, and WDSC, can’t readily produce these HTML fragment files. If you prefer coding using notepad or the EDTF tools instead, you’ll find CGIDEV2 development less complicated! One of the strengths of using CGIDEV2 is that you can stay with RPG and make nice looking user interfaces, and that CGIDEV2 is strictly an HTML tool — you can code CSS if you want but it’s not required.

PHP – PHP Hypertext Preprocessor (PHP) is another great tool to add to your toolbox. PHP, a scripting language that is embedded in web pages, has many advantages over CGI. IBM partnered with Zend Technologies to port the PHP scripting language and its platform to the IBM i OS. Thousands of websites around the world use PHP. With PHP on the IBM i OS, new functions have been specifically designed to leverage the strengths of the system. You can use these functions to read, write and update data; call native programs on the system; and access data in objects such as data areas, data queues, and user spaces. The normal functions used on all other platforms are still there and you can use them for processing and rendering data in a web browser. The standard PHP functions use SQL for data access and manipulation, which makes it very easy to port from one database to another. Because PHP uses SQL for it’s base functions, you can use those functions for data manipulation on the system as well as the IBM i specific functions. PHP has its weaknesses but they can be handled and managed the same as with CGI. Security is a major weakness for this language, but PHP has functions that let you utilize the native IBM i OS security, which will eliminate the main hazard of this tool. Thousands of PHP scripts are available on the web that you can download and execute on the IBM i with very few (and in some cases no) modifications. Zend Technologies has a forum devoted entirely to the IBM i (i5/OS) PHP platform. A PHP IDE (integrated development environment) called Zend Studio for i5/OS is free for IBM i developers. The environment makes programming in PHP a much easier transition for those new to the language.

Java – Java is one of the most prevalent languages for writing user interfaces for business. With its portability and functionality, Java has shown its viability for programming and interfacing with multiple platforms. The IBM Toolbox for Java provides the classes and functions necessary for easy access to data and usability for objects that reside on the IBM i OS. JTOpen, the open source version of the toolbox, provides all the functionality of the licensed product. By using the classes in the class library you can secure the data and processes using the IBM i OS security features; Java provides much better integration than CGI and PHP. Java is not as “lightweight” as CGI and PHP, but it can deliver great user interfaces and servlets for communicating between the client PC and the Power systems server. While Java is great for implementing user interfaces and controlling functionality, it’s not as robust when processing business logic. Can it do business logic? Sure, but it’s a lot more CPU intensive and it requires more resources than having it execute an RPG program to do the bulk of the “grunt” work. Java incurs a much higher learning curve than PHP, CGIDEV2, HTML, and CSS but it’s a worthwhile investment of time and energy.

EGL – Enterprise Generation Language (EGL), a relatively new programming language, was created by IBM. EGL generates Java code, which can be deployed via a web application server. EGL uses the JavaServer Faces (JSF) framework and requires some additional setup (installing run-time libraries) beyond with the typical web server configuration. You can use EGL along with your RPG programs to build quick and fully functional applications without the overhead and complexity of learning Java. With the power of Java and without the steep learning curve, EGL is poised to be a great advancement. Not only can you interface EGL with RPG backend processes, you can also tap into your data via SQL. If you’re using IBM’s WebSphere Development Studio Client (WDSC) or the RDi-SOA package, you can create and implement EGL applications quickly by using the wizards included in the IDE. As are all the methods discussed in this article, EGL is a free product. Find more information about EGL.

XML – Chances are that if you haven’t used XML, you will in the near future. XML is becoming a common method for data transactions. Essentially XML is a tag language used to represent data. The data is represented by elements. It’s fairly easy to relate to the data being represented because it conforms to what you already use, a file or table. Each XML file consists of a root element, which equates to a record or row. The sub-elements represent the fields and columns and the data that resides in them. How the data is processed is much different, however. Because the data is presented in a more linear fashion it requires more thought than traditional physical files. Several different methods and tools are available for parsing the data contained in XML documents. Java has classes, PHP has functions, and RPG (as of V5R4) has built-in operation codes for parsing XML. With RPG, you would have to write a program for each different XML file in order to parse the data. This means that RPG is most likely not the best tool for parsing XML. With Java or PHP, you can use the parsers available to extract the data and pass it into your RPG applications. A good example is the Expat parser written by Scott Klement. You can use this tool, written in the C language, in conjunction with RPG. One process for parsing all XML files is a much better fit, more convenient, and easier to maintain.

Training: It’s Up to You

The tools discussed here are not all of the available tools, but they are the more widely used tools. Becoming familiar with any (or all) of these tools can be a great boon for you and your career. As mentioned, HTML and CSS are the most important pieces of the puzzle for web-enabling applications. Of the languages I’ve presented, the easiest to learn are CGI (via CGIDEV2 and RPG) and PHP. Both are very versatile and have a fairly low learning curve. The concepts are easier to implement for newcomers and I believe that they offer the best starting points. As you become more familiar with the new technologies and concepts, you’ll become more productive and efficient at developing integrated solutions.

It’s all about using the right tool for the job. As I’ve always been told, “play to your strengths.” The same philosophy applies to choosing the best language and technology for a particular task. Each one has its place; being familiar with more tools and knowing their strengths and weaknesses allows you to use them wisely. Not every process or application is a nail and you need more than a hammer to provide the best solution. In the end, what really matters is knowing what is available and what is the best fit for the situation. The more you know about what is out there, the better off you’ll be. Learn new skills and add to your toolbox; you’ll be glad you did.

Tommy Holden began working with IBM midrange systems in 1998, specializing in RPG and CL programming. He believes in the System i platform and continues to promote the platform and the RPG programming language.


Further Reading

For additional information regarding HTML, CSS, XML, PHP and web services, take a look at W3C Schools. They have tutorials that range from beginner to advanced skill levels. They also have tutorials for JavaScript, SQL and many other web-based technologies. Classes on these subjects also are in abundance at COMMON and the RPG & DB2 Summit conferences.

I also recommend Virtual University for some of the more basic level topics on HTML, CSS, and JavaScript. Although Virtual University is not free, the classes are good and at a good price ($18 for up to 3 classes per term). Some valuable webinars are available for PHP at Zend Technologies website.

You’ll find articles about EGL on the System i Network. And you’ll find tutorials on IBM’s website:

You’ll find information about CGIDEV2 at www.easy400.net. The CGIDEV2 library contains examples and demos. Because CGIDEV2 is written in RPG it’s pretty straightforward and easy to learn (we all know RPG, right?).

ProVIP Sponsors

ProVIP Sponsors