07
Thu, Nov
7 New Articles

Shortcut to the Internet

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

We’ve all seen or heard about the hamburger-flipping scenario awaiting RPG programmers who have yet to learn Java. It gets you believing that your AS/400 skill set is valueless with respect to the Web unless you stop today and change direction quickly. Well, you can relax. You are valuable, and there is an alternative much simpler than Java for getting your AS/400 shop up and running on the Internet.

A Little History

Years before client/server first arrived on the scene, there was the green-screen and its corresponding 5250 data stream. The green-screen allowed users to type into fields, press Enter, and have data sent to a corresponding RPG program for processing. After going through a series of validation routines (hopefully), either the same screen would appear with an error message, or the next screen in the process would be presented to users. The beauty of this central host architecture was that screen presentation, logic, and data were all controlled on a single platform.

With the advent of the client/server model, the centralized architecture that had served users so well was soon considered archaic and rudimentary. The distributed architecture model that replaced it allowed data and applications to be separated from the host for local processing. The fact that databases around the world would be out of sync didn’t seem to bother anyone at the time: The new programming paradigm had arrived, and it was the way application development would be done from that point forward.

Back to the Future

While on the road to client/server architecture, a little something called the Internet showed up and quickly changed everything (well, maybe not everything). Have you ever noticed that, when you receive a page via the Web, you type into fields and click Submit and your data is sent to a program for processing? Sound familiar? It should. If you’ve written RPG code on the AS/400, you will immediately recognize the similarities.

The Web has brought us back to a modified version of the central host architecture we are so accustomed to. This architecture is somewhat different in that it attempts to logically separate the three tiers: presentation, logic, and database. However, application


programs and data typically reside, as they should, on the same machine or in close proximity for efficiency. Because the Internet uses this model, you have a tremendous advantage in being an AS/400 RPG programmer: You already understand it. You’ve been working with it for as long as you’ve been working with RPG, and this is only one of the reasons your skill set is still valuable today.

The second and arguably most important reason you are still valuable is that you know how to process data once you receive it in your program. You’ve been writing manufacturing, distribution, inventory, and accounting applications for years; this alone should get your company’s attention as it decides to move to the Web. Now, you may reasonably maintain that the only language you are familiar with is RPG and that you and your company don’t have the time or inclination to learn Java. Therefore, it would be simple to conclude that you don’t know how to process this Web-based data, and, until recently, you would have been correct.

A Diamond in the Rough

Enter ASNA Visual RPG (AVR) and, along with it, the third reason for your value. AVR is a Windows-based programming development environment that allows you to use your existing RPG skill set to create components that act as the interface between the Web and your AS/400. These programs are capable of receiving input directly from Web-based HTML screens, communicating with the AS/400 database and programs directly, and returning data to the browser.

As an RPG programmer, you now have an avenue to use your business know-how and programming experience and redirect it to the Web. This alone will not make you an Internet expert, but you are about to see how coupling your skills with those of an HTML and Active Server Pages (ASP) programmer will have you developing Internet-based applications faster than you can say “Java.”

Here’s How It’s Done

Microsoft has created a standard called Component Object Model/Distributed Component Object Model (COM/DCOM). COM is nothing more than a set of rules that define how programs (objects), including programs that have been written using different languages, communicate with one another. This is similar to having a CL program call an RPG program with parameters. As long as the specific interface is adhered to, the programs can call one another seamlessly.

Now, imagine that the CL program could call a subroutine of the RPG program and pass it parameters directly. Imagine that the RPG program could then share its variables with the calling program simply by defining them as *Public. If you understand this concept, you can begin to appreciate the true power of COM. Using AVR, today’s RPG programmer can write code to create COM-compliant objects. AVR handles this layer of complexity for you automatically by compiling your RPG code into a Dynamic Link Library (DLL). Once it’s in this format, your programs can be recognized by and interfaced with Web-based programming languages such as Microsoft’s ASP. You can now begin to see how AVR, which directly accesses AS/400 programs and files, can act as the bridge between the Internet and your legacy applications.

Let’s Talk Details

There is no question that some effort is required on the part of the programmer to learn how the Internet itself works. Understanding the interaction that takes place between Web browsers and Web servers is perhaps the most important aspect. The browser is a program that has the ability to request a Web page from a Web server. The server has the ability to find the requested page and send it immediately to the browser, which, in turn, displays it to the user. In this example, the Web server is the Windows NT Internet Information Server (IIS).


Figure 1 shows a simple Web-based data entry screen that accepts name and address information. My objective is to have data written to an AS/400 database file when the Submit button is clicked. Notice that the file requested in the URL has extension .asp. This file has significance for the Web server. Rather than downloading the file to the browser immediately, the server processes the file one line at a time. Whenever it finds HTML, it sends it directly to the browser, and whenever it finds ASP code, it allows that code to execute.

Figure 2 shows two ASP subroutines used to get HTML input fields to your RPG program. First, in subroutine GetFormInfo, the ASP request method is implemented to extract the values of the HTML input fields. Once obtained, these values are moved into fields (properties) that ASP and RPG share. This is done in subroutine AddUser. To make the connection to the RPG subroutine, ASP instantiates the AVR object with the Server.CreateObject method. This simple statement is what gives ASP the ability to directly reference all publicly declared subroutines and properties associated with the newly created object. Figure 3 shows how the RPG subroutine AddNew simply uses these fields normally to populate the AS/400 database after ASP calls it.

What I have essentially done in this example is separate the screen presentation (browser) from the business logic (RPG) and the database (DB2 UDB). This is the objective of three-tier, Web-based programming, and it was all accomplished without a single line of Java code.

Use Your Skill Set to Create Alternatives

Your RPG skill set is a valuable commodity when preparing your company to go to the Web and should not be underestimated. With a basic understanding of the Internet and a well-versed ASP programmer at your side, you can be well on your way to producing AS/400-based Web applications for your organization that you will be proud of and that your company will undoubtedly benefit from. Taking the time to understand this mechanism—although, initially, it may be a bit confusing if you are a sheltered RPG programmer—may be your best opportunity to advance to the Web and avoid being relegated to the green-screen with the rest of the pack.

This should also pique the interest of upper management. Given today’s volatile employment environment, any opportunity to retain valued programmers is worth its weight in gold. To accomplish this by simply enhancing a programmer’s abilities rather than rehiring and starting over is invaluable. Whether you are a manager or a coder (or both), do not sell yourself short when considering current skill sets because your future and your company’s future is in the AS/400 Web world.


Shortcut_to_the_Internet04-00.png 401x426

Figure 1: Here is an HTML input screen whose field values will be passed to an RPG program via ASP upon clicking Submit.


Shortcut_to_the_Internet05-00.png 401x554

Figure 2: Getting HTML input fields to your RPG program is a two-step process for ASP.


Shortcut_to_the_Internet06-00.png 395x319

Figure 3: The RPG subroutine AddNew uses the fields to populate the AS/400 database.


BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: