WEBINAR
Top 5 Things You Didn't Know You Can Do Using Open Source on Your IBM i
Session Time
60 Minutes
Overview
You’ll Learn
Call public web services right from RPG to quickly provide new capabilities
Enhance your RPG applications with freely available Open Source modules
Access your RPG Code, CL Commands and DB2 data directly from web browsers and web services
Manage IBM and Open Source development synchronously with Open Source DevOps tools
Take advantage of True Cloud offerings to significantly enhance and speed up your development and testing processes
Presenters
Dan Magid
Chief Executive Officer &
IBM Champion,
Eradani
Dan has spent over thirty years leading companies that help customers implement new technologies in legacy environments. Previously, Dan led worldwide software development groups that built highly successful modernization and DevOps tools and was the CEO of Aldon, the leading provider of DevOps tools to the IBM i marketplace.
Aaron Magid
Vice President,Open Source Technologies & IBM Champion, Eradani
Aaron has been writing modern applications to leverage open-source technologies on the IBM i for more than 10 years. His applications are part of commercial products that are installed in thousands of IBM i shops. His work combines open-source languages such as PHP, Java, Node.js, and Python with traditional IBM i
technologies to create leading-edge IBM i solutions.
Video Transcript
Hi, everyone, and welcome to our webinar today on five things you didn’t know you could do with open source on your IBM i. My name is Dan Magid, and I am the chief evangelist here at Eradani. And we work with customers to help them take advantage of open source and APIs on their IBM i. And so we’re going to talk about some cool things that you can do to take advantage of the latest technology with your IBM i systems. And I always like to start these presentations with this slide, because this is what I run into when I go out into the marketplace. I see so many people who think about the IBM i as existing on the left side of the screen, what I call the mythical IBM i, that the IBM i is a green screen system that is limited to RPG and COBOL and CL and DB2. And basically, that’s all you can do with it. And the reality is, you can do just about anything on the IBM i that you can do on any other platform. So you can do all the latest in open source. You can do all the latest in mobile and web development. And you can do lots of cool things with APIs, which is what we’re going to really focus on a lot today. So these are the things we’re going to cover in our presentation today. We’re going to talk a little bit about how you can do IBM i in the cloud, just like you can do any other platform in the cloud. We’re going to talk about calling out from your IBM i to open source and how you can do that very, very easily. And then how you can use free open source components as part of your IBM i applications. And some of the things that IBM has done recently in speeding up the connectors make it possible now to actually integrate open source components right into the main line of your RPG programs because they respond so quickly. And then calling into the IBM i from open source, so calling out from the IBM i and then calling into the IBM i. And then we’ll talk a little bit about how to set up a DevOps environment so you can manage all of this stuff together.
Now I’m going to start out with IBM i in the cloud because basically this entire presentation is going to be a presentation of IBM i in the cloud because we’re doing all of this with IBM i systems that are in the cloud. So we’re going to talk about how you can use the IBM i for backup and storage. So you can say, I want to put all my IBM backups into a cloud IBM i, or I want to have an HADR system in the cloud. So this is a screenshot from IBM’s cloud storage solutions for IBM i. It’s a tool that allows you to very, very easily send code from your, or to send files from your IBM i up into the cloud. So you can just select files and click on a file and send it up to the Amazon cloud, to the Azure cloud, to the IBM cloud, right from here just with point and click. And by the way, this interface, the interface you’re seeing here is actually a native Node.js JavaScript application running on the IBM i. But the other things you can do is you can rapidly spin up IBM i systems. So you can create in the cloud, you can create an instance of an IBM i for doing things like testing of your environment or for running production if you want to do that. And some of the things you can do in the cloud that are pretty cool is you can rapidly clone an entire environment. So if you’ve got your IBM i and you’ve got a bunch of maybe Linux web servers or Windows servers around it, or you’ve got Windows clients, you can create that environment and then you can create a copy of it just with a couple of clicks of the mouse. So if you want to do some testing, you can instantiate a new version of your environment and quickly start doing your testing with a clean version of that environment. If you want to do upgrade testing, so you want to say, gee, I want to go from 7.3 to 7.4, but I’d like to do that on a test machine, you can spin up a 7.3 machine, run your upgrade, and then see how that works. If it doesn’t work, you can start all over again, spin up a new one, and try again. You can also rapidly increase how much resource you have and decrease it as you need it. So up in the cloud, you can say, you know what, I need some additional processing power for end of month or for my high season. So you can add capacity and then remove it so you don’t have to carry a lot of extra capacity. You can do checkpoint restart testing. So you can set your environment up with the data the way you want to start your tests, run all of your tests, and then when you’re done, you can simply spin that environment up again and have a brand new fresh copy of the environment with all the data back to where it was when you started. And I as a developer can create a fully populated environment of our IBM i with all the servers connected to it to do unit testing on just my stuff if I want to test things without being interfered with by what other people are doing. So these are some of the things you can do into the cloud. And just to give you a sense of how easy that is to do, this is the cloud dashboard that we use.
So this is our Skytap cloud dashboard that we use for managing our cloud instances. And each one of these things you see is an environment, which includes an IBM i or multiple IBM is and then multiple client machines. If I go down here, here I’ve got this particular machine or this environment, and I can see I’ve got some Unix servers or Linux servers, and I’ve got some Windows servers, and I’ve got my IBM i here. So I’ve got all of that, and if I want to, I can quickly just copy that environment and create a new instance, or I can go into the settings here and say, you know what, I want to change the hardware. I want to add some RAM to this environment, or I want to add some CPUs to this environment, or I want to add some disks to this environment. So I can rapidly scale that machine up and scale it back down again. And this is how we do all of our testing. When we want to do release testing of our applications, we simply spin up a new environment, put all the code on it, and away we go. So you can quickly create new instances of IBM is and get rid of them, and just pay as you go. Pay for the things that you need. And like I said, if any time you wanted to actually go in and create a new one, all I have to do is go to the environment I want, click over here, and I can copy it and create a new one at any time. And I can see how much we’re using. I get all kinds of reports about exactly what I’m using on that IBM i. So that’s just a quick introduction to what you can do with IBM i in the cloud. So basically, anything you can do in the cloud with other environments, you can do with your IBM i. So let’s now take a look at the world of APIs in your IBM i. And that is connecting your IBM i to the rest of the world. And how do you do that? And how do you do that in a secure way and an easy way? So we’re going to talk about both calling into your IBM i. So if I need something from the IBM i and I want to call into it, so I want to execute an RPG program, or a stored procedure, or a CL command, or access the database, how do I do that? Or I want to call out from my IBM i to somebody else. So I want to use a public web service, or I want to connect to one of my business partners. So I want to be able to get some function from outside into my IBM i. How do I do that? So let’s start out with talking a little bit about calling out to public web services. So I want to call out to a web service. And there are lots and lots of use cases that we’ve run across in the field where our customers have talked to us about things they want to do. So for example, we had a trucking company that one of the things that they shipped was food. And they needed to know what was the temperature going to be along the route that they were shipping so they could decide, do they need to send a refrigerated truck or not for that particular shipment? We had another customer that’s a vacation rentals company. And they wanted to be able to provide potential customers with, what is the weather going to be like at the place you’re going at the time of year that you’re going to use it? So they would access those APIs right from their RPG systems. We have another customer that needed to get traffic data so they could determine the routes for their trucks as they were deciding how they would do their delivery schedule. So they wanted to pull in information about traffic or distance information for doing rate quotes. So they wanted to get information from Google Maps and from the Google Maps API. And then we had customers who wanted to do VIN inquiries where they could find out information about a particular vehicle by simply sending out the VIN number. We actually had some banks that were interested in doing that for doing bank loans. So they needed to get that information before they would grant the bank loan on a car. Sales tax inquiries. So how do I get the sales tax information for a particular place, a particular county, state, or street? Demographic information, food, nutritional information. These are all different public web services that are available that provide lots of interesting information that might be useful in your applications that you can get to by using these functions to call out from your IBM i. Now one of the things that our philosophy is that when you’re calling out to web services, you want to use the right tool for the job. So RPG is great for your business application logic and for running your applications. But there are languages like JavaScript that are actually built to do web services and to run web services. So what we find is we want to make it very, very easy for RPG programmers to say, I want to call a web service, but to do the web service work in the languages that are designed to do that. Because if you look at the typical or the traditional way of doing things on the IBM i, this is the chain of things that happens if you’re doing the IWS HTTPS kind of approach to doing web services. There’s a whole bunch of things that you have to do. You have to go out to the database, do your HTTP GET through IWS, you have to spin up the JVM, you have to manage the certificates, you have to use the digital certificate manager for security, you run the web service, you get the data back, it goes into a club, you then use something like the Agile to parse that data and get it back to your RPG program. So there’s a bunch of work that you have to do, not only to create the service, but then to maintain it over time.
At Eradani, what we want to do is remove a whole lot of that stuff and simply send that stuff from the RPG application out to a data queue where it can be run, have the JavaScript actually execute the web service, have the JavaScript handle all of the JSON parsing, and then return parameter data back to the RPG. So as an RPG programmer, all I have to do is say, call this web service with these parameters and then get the data back as parameters. I don’t have to worry about all the things that go on in calling the web service. So basically, the RPG program calls out to another RPG program or CL program, which Eradani provides. We take that data, we put it out onto the data queue. We then process that information, translate it into a web service call, translate the parameters into JSON data, and then we get the response back. We do all of the error handling for you, all of the authentication for you, and when we get the response back, we translate that response back to parameter data so that the RPG program can read it. So as an RPG programmer, all I need to do is call that program and then read the response. The advantages of doing that is it’s very, very high speed. We’re seeing response times in these things in the single digit milliseconds or even microseconds for how fast these things operate, and that’s what allows you to actually integrate these into the main line of an RPG program. It also allows you to do asynchronous operations where you can take advantage of the asynchronous nature of the web where you can send out lots and lots of requests and you don’t have to hold up your processing until you get a response back. So you can send out many, many requests, and as you get the responses, you can then go on to the next step of your process. It just takes a couple of lines of code, and Aaron is going to show you that in just a second. And the JSON parsing is done in JavaScript, and JSON is JavaScript Object Notation. Obviously JavaScript knows how to handle JSON very, very well, and it’s very easy to read that data. And some of these web services do return very, very complex data structures. So it’s nice to be able to do that easily. And the RPG programmers only have to worry about standard IBM i data structures and data types. It uses the latest in authentication, so if you want to use OAuth 2.0 for doing your authentication, it’ll use the latest in authentication. And you can easily integrate open source modules, so you want to go grab a module that does a particular function that you want to do, and we’re actually going to see an example of this when Aaron shows you the demo of printing barcode labels that we’re going to use. It uses an existing module that takes data, transforms it into a barcode, and transforms it into QR codes. You can easily integrate those open source modules, and there are literally hundreds of thousands of them that you can choose from. Basically this is all the code you have to write. So this is a CL example, where all you do have to call this program. This is the Eradani Connect Request Program, and then the Eradani Connect Receive Program. This sends the data, this receives the data, and as the RPG programmer, that’s basically all you need to do. Now on the other side of it, there is the JavaScript that actually calls the service, and sometimes when we talk to RPG programmers, we get a little intimidated about the JavaScript. Well, let me tell you, the JavaScript is very simple to do this, and this is basically the four things that you need to do. And what I’ve done here is I’ve shown you the RPG version of each of these, and then the JavaScript version. And Aaron is actually going to show you a live example of this. But basically, you define the variables, so here’s how you do it in RPG, here’s how you do it in JavaScript. If I want a constant, I do constant, my variable, and give it a value. If I want to import a module in RPG, I do a slash copy, in JavaScript, I do a require. If I want to call a function, here’s my call a function in free format RPG, here’s how I call a function in JavaScript. And then there’s this function called await. Await is what allows you to do asynchronous operations, so that allows you to say, you know what, I want to just send out a request for customer 1, request for customer 2, request for customer 3, and I’ll come get the results later. It’s not something you can do in RPG, RPG is synchronous and procedural, JavaScript is asynchronous. This allows you to do these very, very high volume, very high speed connections. And the security is built in, the latest in Cypher suites is built in, so that you’re going to be able to communicate to these web services that will check for the latest version of the Cypher suite, so you won’t get a refused connection. The problem with IBM i is if you are back version on the operating system, you’re not going to have the latest Cypher suites, and you may be refused in your connection. Or even if you’re back version on PTS, you may not have the latest version of the Cypher suites. Again, you can easily download components, and here’s just an example, and if I want OAuth 2, I can download this right from the NPM repository and add that to my application. So now I’m going to turn it over to Aaron, and Aaron’s going to give you a quick demo of calling out from an RPG program. And we’re going to look at a couple of different things, I think, Aaron, right? We’re going to look at sending out text messages and printing barcodes
Yeah. All right. So let me hop in here, and I’m going to share my screen. So the first thing that we’re going to look at is a text messaging system, and one of the things that I want to point out before we go into these demos is that we’re going to go through a couple of specific examples. They are all built with open source tools, and the important point of that is we do a lot of these presentations where we show an example of sending a text message, and that is just one example, right? So we’ll go to an open source package manager, grab any one of the 1.5 million open source modules there, and what I’m going to show you is just a tiny little slice of what’s possible with these systems. So the first use case that we have is a text messaging use case. In this case, what we want to do is we’ve got system operations happening on our IBM i, and we want to send a message over to the operator via text message so we get it really quickly to get confirmation before we continue with the operation that we’re running. So what I’m going to do here is just real quick make sure that my server is running. Yes, it is. And what I’m going to do is I’m going to say cnfsmsc. This is my command here that is fronting a CL program, and I’m going to give it 120 seconds. Let’s make that 180 seconds, and I’m going to say it’s going to send to 295.9297. That’s my cell number. Actually, hold on. I missed a digit. 1510295297, which I need there. So I’m going to send it to my cell number, and what I’m going to say is system upgrade needs confirmation. All right. So I’m just giving it a message, and I am going to send that call. And what I’m going to do here is actually I’m going to show you real quick. I’m going to stop my screen share for a second and flip over here so that you can see this. Now if you look at my phone here, you’ll see that I have a text message now that says system upgrade needs confirmation. Reply denied to cancel the operation. So I’m going to come in here, and I’m going to say deny. Why not? Let’s just cancel it. So I’m going to send my text message. You can see I sent deny. That’s there. It says confirmation received, canceling operation. Okay. Now, what I’m going to do is I’m going to share my screen again, and if we go back to the 5250, my program here says success, 510295.297, deny, operation canceled. So the system, two things happened here. My CL program that is run by this command sent a message to my phone, and then I sent a reply back to the CL program, and it actually received that message and was able to run actionable steps based on the contents of my message. So I’ve got two-way communication happening here. And the main point that I want to show here is, you know, that’s cool. We sent a text message back and forth from the system. I just gave it the number. That’s actually another thing to point out about this is we’re using an open source module that interprets everything we need for this call, which means that I don’t have to know the carrier. I don’t have to know any kind of information about what the number is that I’m talking to or anything like that. I just give it a phone number and a message to send, and boom, it’s done. And the way that we do this, what I’ve got on my screen now is the source code for my CL program. The way that I do this, what I want to emphasize here is that that entire program was really realistically three important lines of code. And what they are is basically this. We send our request. So in my CL program, I say, call ECC send request. That sends a bunch of data over to the open source program, and I’ll explain why we do that in a second. So we send the data to the open source program. It’s then going to handle sending the text message. When it’s done, we do this. We say, call ECC receive response. That’s going to receive data back from the open source program. And that’s all that I have to do here. And then the third line is when I come down here, I’m actually displaying the data. I’m sending a message with the result. And you can see here, I’m working with variables, and this is an important point here. I’m working with SMS status, from number, message. I’m working with individual variables. And in between here in these lines of code, you can see that I’m not doing any JSON parsing or any encryption or anything like that here. It’s just a really simple, I sent the message to the open source program. I received the response. And the reason that we do that is if I bring up the open source program here, the reason we do that is because this is the code that I need to send a text message from JavaScript. This is it. I just say, create a message, send, here’s the body data, here’s the message, the number I’m sending it from, and the number that I’m sending it to. And that’s it. All right, so that’s why we do this, is it’s really simple to send a text message from the open source. And the reason it’s so simple is because of this right here, which you may remember from Dan’s brief discussion about JavaScript. I’m doing this require Twilio here. What I’m doing is I am importing an open source package. Twilio is a company that provides APIs for sending and receiving text messages. It is just one of the 1 and 1 half million open source modules that we have to choose from for JavaScript. So I just import their module. I say, send the message, and we’re done. That’s it. And then the CL program can receive the result. Similarly, I got another section down here where I’m receiving the message. Same thing. Twilio receives the message. I send some data back to the CL program, and we’re done. That’s it. And these modules are handling the entire process. So just as a quick recap here of that example program, what we did, I ran a command which called my CL program. That CL program had one line of code, really, that was important there to send the message to the open source program. It brought in an open source module to send the text message. And then it received the response message from the open source system and sent the message back to the CL program. So that’s it for that text messaging demo. The next example that we have is talking about printing barcode labels. And I think Dan has here an introduction to that. Yeah.
So in this example, what Aaron’s going to show you is a way to go right from your IBM i programs to something like a Zebra printer and print out your barcode labels, your QR code labels. These actually come up from our customers who have been using advanced function print utilities on the IBM i and are concerned that IBM after 7.2 isn’t supporting that anymore. And so they’re looking for what’s a new alternative. Well, it turns out that there are open source modules available that will create these barcode labels for you. And so you can simply wrap those open source modules into your application, call them from your IBM i, and generate these labels and even generate the ZPL language that the Zebra printers need in order to do that kind of printing or the EPL or the GPL, depending on which one of the printers you’re using. So Aaron is going to go ahead then and show you exactly how that works. All right. So let’s take a look at this one. So like Dan said, we’re going to go through and we’re going to print a label. And again, this is going to work the same way. And this is going to be consistent through every program that I show you today. It’s going to be basically three lines of CL code, and I’m doing this with CL personally, but I could do that with RPG or any other language on the IBM i if I wanted. It’s going to be basically three lines of code on the IBM i side, and then it’s going to be typing to an open source module, and that’ll handle it from there. So what we’re going to do here, first of all, let me just make sure my server is running. All right. It looks like I’ve got my barcode server running. Now what I’m going to do is I’m going to say PRTCDEC, which is my barcode program. And I’m just going to give it some information for the barcode, Eradani, Inc. And I’m going to say Berkeley CA 94707, and then subproduct, whatever. And I’m going to basically just print this label for a whole bunch of our 999 Reese’s Cups, because that’s what I’m feeling like right now. And I’m going to run my program. And that’s going to call out to an open source program, again, same thing. One line of code on the CL side to call out, one line to call back in. And what it got back, if you can see this window right here, what it got back is this file system path. It’s telling me where it saved the barcode to. So this is the key. This is the important part here is 350,000. So I’m going to open up that barcode, which I have here in my file explorer. Now that’s saved as a base 64 encoded image. So I’m going to put that into my browser, and it’ll render it. This is what the barcode looks like. Now this is something that is extremely customizable. One of the key points that I want to bring up here is about how fast we can build things like this. I’ll show you the code in a minute, but this entire system from scratch to fully functional and deploying to the IBM i took me a couple of hours to put together. I did it in an afternoon because these open source tools are so powerful. I have an open source tool for drawing the label. I have an open source tool for making the barcode. Everything that I need is in there. So this is, by the way, also, I just want to point out that this is a real barcode. If any of you happen to have a barcode scanner handy, you could actually scan this. It’s for a UPC code, and you will be able to scan that. Now let’s take a look at the code, just like last time. We’re going to hop over to this example. I’m going to show you the CL first. Now if we look at this program, you’ll see something very similar. Actually, the program is hardly any different from the last one. Basically what I’m going to do is I’m going to say, call ECC send request to the open source program. I’m going to put in a bunch of variables, this customer address, city, state, zip code, product, quantity, and code. When the open source program is done, I’m going to say receive response. That’s it. That’s my CL code.
Now let’s look at the open source code. On the JavaScript side, I received the data. This is the code right here for generating the barcode. This is it. These three lines of code, one of them is formatted, but these are really three lines of executable code. What I am doing is I create the label with the first line, then I generate the barcode. And the thing is, generating the barcode here is extremely simple for me because of JS barcode. If I scroll up to the top of this file, you’ll see up here this required JS barcode because JS barcode is an open source module that generates barcodes. That’s what it does. When I was looking for this, this demo here, this demo took me a little bit over two hours to put together. All I had to do is I went, I searched for open source modules for barcodes, got JS barcode, downloaded it, and I generate the barcodes. That’s it. These lines of code. So just as a quick recap here, just so that we have a moment to pause. So I showed you we generate a barcode. It generates it in a Base64 encoded image. I can show that in my web browser, and I have all of the information from the label. I have the barcode. I have everything in that label, and I could print that if I wanted. And similarly, Dan mentioned Zebra printers earlier. I’m just thinking about this Zebra, the company, provides an open source module for JavaScript that they maintain that converts images to Zebra printer language. So if I wanted to put this on a Zebra printer, what I’d do is I’d go download the Zebra printer module, and then I could print on a Zebra printer. That’s the capability of these systems. I don’t have to build any of this myself. And one of the important points there, I’ve talked a lot about how easy it is to build this in the first place, like how I set this up in a little over two hours for this particular demo. But what a lot of people miss about these modules is that the main benefit is actually maintainability. It’s not actually about how fast you can build something in the first place, though it is pretty cool being able to put up systems in a couple of hours or a couple of minutes. But really what’s powerful here is the maintainability. So to demonstrate that, I’m actually going to use a use case that we got from a real customer who was using barcodes. And one day they decided it would be a lot more effective if we went to more recent two-dimensional barcodes. We went to QR codes. And for those of you who aren’t familiar, I can bring up a QR code. One of these guys, these two-dimensional square barcodes, these are scannable with most recent scanners and applications. They encode a lot more data than a traditional barcode. So this company wanted to transition to using QR codes. So let’s say that I want to transition to using QR codes. Remember, I got three lines of code here where I generate the barcode. Well, my first stop is going to be npmjs.com, which is the node package manager. This is where they have a little under 1.5 million open source modules that are downloaded over 107 billion times a month. So pretty active community. I’m going to search for QR code. My first result here is a package that says QR code 2D barcode generator. And this one, I know I can trust. We’ve talked about this in prior presentations that it’s downloaded 335,000 times a week. That means this is heavily tested and it’s a trustworthy module here. So this is going to generate QR codes for me. What I’m going to do is I’m going to shut down my system here. I’m going to say install QR code. Now my computer is going to go out and get that package. Same name as it was in the registry. Okay. I have QR codes. Now what I’m going to do is I’m going to comment out these lines and deactivate the former barcode lines, come up here, and I’m going to import that QR code module. Remember, require is pulling in an open source package. So I’m pulling in that QR code package. And then what I’m going to do is I’m going to come down here and I’m going to say barcode is to data URL, because I need it as a base 64 encoded image, label data. All right, so I’m going to replace those three lines of code with this one that I just put in here that uses that new QR code module. I’m going to restart my JavaScript application because that’s what you need to do with JavaScript in order to, in order to restart or in order to apply code changes. I’m now going to run exactly the same command. So I’m just F9ing and running that command again, generated another label. This one, this time it’s 360,000 is the key. I’m going to open that up to base 64 encoded image. I’m going to paste that in and now I have a QR code. So now I’ve, now I’ve modernized the QR codes, right? And that’s everything that I had to do. I just pulled in a new open source package. I replaced the old one, changed three lines of code to one line of code, and that was it, right? And that was what? That was like six, seven minutes with me explaining it, right? And this really is the power of these tools. And I actually have a QR code scanner on my phone. So I actually just went through and scanned the QR code. One of the cool things about these QR codes is that they actually can store a lot more data than a traditional barcode. This is why the customer I was talking about wanted to go to QR codes is that they don’t just store one number. This actually, this QR code actually contains all of the data on this label. It includes the company, the address, you know, city, state, zip code, the product, the quantity, and the code, and the UPC code are all included in this, in this QR code. And Aaron, if somebody has a QR code scanner on their phone, right, they could just scan this right now. Yeah, I actually just did. I actually just ran this on my phone. Yeah, this is a, this is a QR code. And again, I don’t have to know how to generate QR codes. You know, QR codes are actually really, are actually pretty complicated, you know, because they have this, all these features around, like if I was to scratch out the middle of that QR code, it would still work because the algorithm is really complicated. I didn’t have to, I don’t have to know that. I don’t have to implement any of that because I just pull in QR code, done, right? That’s it. And the same is true for the other one and a half million open source modules that I have available. So that’s what I’ve got for you on this, on this label demo. Again, just as a quick recap, what happened here, I have a CL program that sent, that sends a request with one line of code, this CL program sends a request to my open source program. And then with another line of code receives the response. My open source program with one line of code generates that QR code and sends it and saves it to a file and then returns the location to my CL program and gets us these pretty labels that we can print onto, onto anything. So I’m going to turn it back over to Dan now to bring us up to the next concept.
Great. Thanks, Aaron. Yeah. Just to clarify, it’s not that it’s one line of code to do all that. It’s one line of code that you have to write. There’s all kinds, thousands of lines of code that the open source developers have given to you for free to do all the hard work of making that happen. Okay. So, so let’s take a look at now at the other side of this. So we’ve looked at some things for calling out. And again, those were just samples of the kinds of things you can do, same techniques to call out to all of those other kinds of use cases, whether you want traffic data or you want to get map data or temperature data or tax data or VIN data, all the same thing to be able to call out to all of these open source modules that are available to get you information for your applications. Now we’re going to turn it around and talk about calling into the IBM i from the outside. And again, customers have told us about lots of use cases that they have for trying to do this. You know, they have, they have supply chain partners who need to call into their system to get information. So they need to be able to execute functions or access data on their systems securely. They have an open source user interface that they’ve built. It’s a mobile user interface or a web user interface, and they want to be able to get data or access functions on their IBM i from a.NET or a PHP or a React or JavaScript application. Or one of the cool things we’re seeing lately are people have internet of things devices that are out there in the marketplace that need to get data from the IBM i. So they’re accessing programs and data on the IBM i and downloading it directly to these sensor devices, web services that are calling to you instead of the other way around, and giving you the ability to add functions to your applications through components, to add components into your applications. So let’s take a look at some of the things around that. So let’s talk about the advanced UI. So this is a customer we actually worked with. This is a green screen interface that they had. They originally went to a kind of a screen scraper approach to say, let’s look and see what would this be like if we screen scraped it. They weren’t happy with that result. They wanted something more sophisticated. So instead now what they’ve done is they’ve built a custom JavaScript application that talks directly to the existing green screen application. So it’s just the front end of it, but they get this very, very modern user interface that’s also responsive. So they can see things actually on a mobile device. They can see it on a desktop. They can see it on a tablet, and it adjusts automatically for them. And again, this is the IBM Cloud Storage Solutions, which is exactly that kind of an application. It’s an application that is written in JavaScript that accesses the IBM i functions that are written in CL, COBOL, RPG. So it’s accessing those underlying functions through this very, very modern user interface. And to give you a sense, again, of some of the productivity advantages that Aaron talked about of using outside modules, we built the green screen user interface for this. It took us about nine months to put the whole green screen application together. The JavaScript piece of it took us about four days. And the reason it was so fast is because we were able to download existing modules and integrate them into the application instead of having to write everything from scratch. So actually, let’s go in and talk a little bit about some of the things we’ve seen customers do with warehouses. So we have customers who have warehouse devices, and they have these handheld devices. People are in the warehouses accessing their IBM i, getting data from the IBM i, and sending data to the IBM i, printing labels directly in the warehouse. And again, that’s something you can make available very, very easily so that people can get that data, get the information, the up-to-date information directly from the IBM i. In fact, we have a customer that goes out to the IBM i and grabs spool files directly off the IBM i and then prints them on locally connected Bluetooth-connected printers that are connected to the mobile device that’s talking to the IBM i. And as part of that, we’re ensuring that the people who are coming in are people you know. So we’re authenticating who they are. And we’re using the latest in encrypted token-based authentication. So we’re giving you the latest in security so that you know exactly who is getting into your system and how they’re getting into your system. So we’re not using things like basic authentication, where you’re sending the IBM i user ID and password up and down the line repeatedly. We’re using these modern authentication structures so that your system will be completely secure. We’re just sending the encrypted tokens up and down the line as we do that communication. So you send the IBM i credentials once. And then from then on, all the communication is through encrypted tokens. And we’re not storing user ID and password stuff in the browser. So basically, we’re ensuring that you have an up-to-date, modern, secure environment. OK. So now what I’m going to do is I’m going to turn it back over to Aaron so that he can go ahead and show you an example of calling in to the IBM i.
All right. Share my screen here. OK. So what we’re going to do here is we’re going to show an example of an API that wraps an RPG program on my IBM i that’s going to be fronted with a web page. So for our use case here, we’ve got our core business logic program. And this program, as you can see, is very simple. It just takes in one parameter, one numeric parameter, multiplies it by 40, and sticks it into an output parameter. That’s all that it does. The reason why I want to use a simple program like this is because you can see that in these five lines of code, there is nothing fancy happening here, right? This is a normal ARP. This is just as simple as it gets. No JSON parsing, no encryption, no authentication, nothing that it has to deal with in this program. The program actually doesn’t even have to be aware that it’s being called in order to be called. There’s no effect on the program. And what we want to do is we have this program. What we want to do is we want to expose this in a way more like this, where we’ve got a web application, and I can type in a number, I can hit the button, and it will run my RPG program through the API and show me the output, 12 times 40, 480. So that is running the program. And the key thing to remember here is this is a web page, and web pages don’t know anything about RPG. So the question is, how do we get these systems talking to each other effectively? Because it’s possible, but the web page itself doesn’t understand it. And the answer is JSON APIs. So what we do is we put an API layer in between the web page and the RPG program. The API layer calls the RPG program, and the web page calls the API, because web pages know how to call APIs, and they’re very good at that. JavaScript is actually one line of code. And what we want to do is we want to keep that as simple as possible. And so I just want to show you what the code for that looks like real quick here. So we have our RPG program. This is the JavaScript for calling that program. This is the API. So what we do is we say, open a connection to the IBM i, execute my program, and I pass in JSON. That’s it. That’s the entire thing. That’s the whole thing right there. And that’s going to handle authenticating against the IBM i, doing all the connection management, parsing out the JSON, running the program, extracting the results from the parameters, turning that back into JSON, sending it back to the web page. It’s going to do the whole thing so that I get to focus on just what’s important to my business logic. And this is really key here, is I get to just focus on what the RPG needs to do, not dealing with all of these things around APIs, and the JavaScript gets to handle what it’s good at, meaning not the business logic, but the API itself. And the other thing that I want to point out here is that these calls can run very performantly This is actually the server log from those requests that I was running. And you can see that these calls, I clicked the button a couple of times, you can see this one was 16 milliseconds, 19 milliseconds, 12, 15. These are the kinds of speeds, and this is actually a really small LPAR, I think it’s a quarter core, but anyway. These kinds of speeds, we need the API to be really, really performant if we’re going to do that, and that is what we’re getting out of this API with these calls. So that one, I know, was a lot quicker than the other ones. But basically, again, as a recap, what we have here is a web page that is going to call to our API, and I actually just saw that there was a question as to the syntax of this RPG program, and the fact that it’s an older RPG, it’s not RPG-free. The answer in there, there’s no requirement in here. We call free RPG programs all the time. We use this one because at a lot of the customer sites that we implement at, we see this kind of RPG a lot. This is really common for the things that we see. So that’s why we use these. But it is important to note here that whatever your RPG standards are, and it doesn’t have to be RPG, whatever your language standards are, whatever kind of program you’re trying to call, if it’s CLRPG, COBOL, whatever it is you want to do, is fine, and the same goes for the parameter structure. We were implementing one of these a couple of months ago that we like to talk about this one a lot because it was 1,147 parameters, data structures, dimension data structures. Everything under the sun was going into that program, and it’s not a problem. We just do this to keep it simple.
Hey, Aaron, as long as you’re answering questions, there was one other question here. Can we verbally answer this question? If JavaScript is asynchronous, how do I handle the data response after we receive it? In RPG, I expect the response and waiting for the process to complete and do it. Do I need to redesign the way the RPG programs work? So OK, that is a great question. The answer is no. You do not need to redesign the way the RPG programs work. So let me just wrap this one up real quick and just say we’re done with this call in demo. And I’m going to flip back because this is a question really about the call out. And I’m just going to flip back to that real quick and show you the program. So if you want to run your RPG asynchronously, you actually can do that. I don’t know that I know any RPG developers who are actually doing that, but you can actually do that here. But we typically don’t. And the way that we do that is through this wait time parameter. So when we say receive response, we can pass in a wait time in seconds that we want the RPG program to wait for, or CL, or whatever other program we’re using, that we want it to wait to receive a response. So a really common solution to that, if you don’t want to set things up to run asynchronously, which again, a lot of people don’t, what you can do is you just pass in a wait time here of a large number, whatever it is that you think is reasonable, and your RPG program, your CL, whatever it is, will pause right here waiting for this program to return. And it’ll wait until it gets the result or until the timeout is reached. So we have people who will go in here, they put in a wait time of a million seconds or something like that. And then it’s effectively a synchronous block on that program call. So no, you do not have to redesign your programs, that really is our philosophy here. We want to make sure that you get to do things however is your standard. We’re trying to have as small of a footprint as possible while providing these capabilities. So there’s one other question, as long as we’re paused here. How are you defining the URL address endpoint that the page is calling that IBM i is listening to? That’s a good question. So similar, so okay, so we’re flipping back now, right, because I think that question was about calling in. Yes. So that is done through open source, just like everything else. So again, the main reason why I mentioned in the last question that we want to keep our footprint as small as possible. And the reason we do that is because the larger our footprint is, the less free you are, right. So we want to make sure that you’re free to do things however you want, and pull in open source tools, pulling your own homegrown stuff, whatever it is you want to do, you should be free to do. So this JavaScript code, this is where the footprint of Eradani is right here, this line of code, that’s it. And so outside of this, we’re defining the API through an open source framework called Express. So Express is a web service framework for Node.js. It’s the most popular framework for building APIs in Node.js, possibly the most popular framework for building APIs in the world. I think we saw somewhere that it’s being downloaded 14 million times a week. Let’s actually check this. Actually, we can look this up. We can go Express, it’s on NPM, just like the QR code, and pull this up, and it is being downloaded 15.6 million times a week, Express is downloaded around the world, right. So this is secure, it is performant, it is totally reliable. I have never encountered, I’ve been using this module for years, I have never encountered any issues with this module, because it’s probably being used by millions of developers around the world. So to show you the code for it, actually, let me just bring up that file. Let’s see, where is it, it’s under routes, API, RPG, let’s open this guy up. And okay, here we go. So this is what the API definition looks like, this is it. So I run, I have this line of code right here, let me actually collapse that so you can see this better. And what I do is I say, router.get, which means when you get a get request, an HTTP get request, so there’s also like, you know, I could do a post, you know, whatever I want to do here, router.get, I say on this URL. So when it gets an API call to this URL, it’s going to run this JavaScript code. And this is where the JavaScript code is, that’s where this is right here. So that’s it, it’s that one line of code. And again, this is Express, this is the most popular web service framework for JavaScript and potentially the world. Which means that also, you know, when you’re trying to learn how to do this stuff, you know, tutorials, et cetera, those things are really easy to find. So I hope that answers the question. And unless there are any others, I’m going to turn it back to Dan to get us on to the next one.
Great. Thank you so much. Yeah, and we’re just going to wrap up actually with something that is underlying the entire demo that we’ve done so far. So actually, this is an example of an application that’s calling out to the IBM i, but let’s go on. So we’re going to talk a little bit about DevOps, because Aaron has been managing everything he does. So all the development he does, he’s using open source tools. So he’s using Git for version control, he’s using make, open source make to do the builds and deploy the stuff to the IBM i. So he’s managing both his open source JavaScript code, his Python code, his.NET code, and his IBM i RPG, CL, DB2, COBOL code, all with those open source tools. So he’s going to show you a little bit about exactly how he’s doing that. All right. Let me share my screen again. We’ll try to go through this one relatively quickly, because I know we’re running low on time. So what I’m going to do here for this example, I’m going to use another API example. I’m just going to run this real quick. This is an example that we actually built for a customer. This goes out and it grabs information about a vehicle based on its VIN number and its model year. So what this is going to do is actually gets the fuel type and the engine type of the vehicle. So now what I’m doing, I’m grabbing for this VIN number right here in this model year. And the API that I’m calling is returning back gasoline. This is a gasoline powered vehicle. Now a really common problem that we see all the time with these systems is the systems are constantly evolving, they’re constantly changing, and things can get out of sync. And when they get out of sync, that can cause pretty big problems. So what I’m going to show you is how we avoid those problems of getting out of sync. And we’re going to do it through modern open source DevOps tools. So we’re getting gasoline back from this right now. But as I’m sure you’re all aware, a CL program or an RPG program needs to know the length of my field. And one of the most common issues that we see people run into is the length of a field changes and one side gets the update, the other side does not. So for this example, we’ve actually already updated the API portion. And again, a really common thing that we see is the JavaScript team will update the API and the CL team doesn’t or the RPG team doesn’t get the update, and then they push it to production, things break, or the RPG pushes to production with a change that the JavaScript doesn’t get, and they break. So what I’m going to do is I am going to pull up my VIN number here. I have stored the VIN number for a Tesla, which as we all know, is an electric car. It is a 2019, I’m going to run that. And what I’m going to get back here is BEV battery L. So this isn’t right. This is getting truncated because I’m hitting the end of the variable. So we have a problem here. We have a pretty serious problem. When we run into these kinds of problems, you’re lucky if it’s a number that gets truncated because then you get decimal data errors, things break. With this, you just get bad data. So we need to make sure that these stay in sync. And so what I’m going to do is I need to put an update out for this. And so what I’m going to do is I’m going to change my interface definition. Now with Eradani Connect, what we do is we generate the code for the interfaces. This is how we get around this problem, is by generating all of the code that is needed to talk across that boundary between the open source and the IBM i tools. And that allows us to keep them in sync. So what I’m going to do is this parameter, this is the offending parameter, this electrification level. I’m going to make it 35 characters so that it can fit that whole value. I’m going to save that. Now what I’m going to do is I’m going to open this up in Git. Git is going to say, hey, you modified a file, which I did. I’m going to say git diff. It says, oh, you changed the length from 15 to 35. Is that what you wanted? Yes, it is. So now I’m going to store this in Git. I’m going to say, give a little message, say I’m updating this to 35 characters. I’m going to push this up to our cloud source code repository, because it’s running on GitHub. Now I’m going to switch back to my IBM i. I’m going to shut this down. I’m going to pull down the code changes with Git. And once that finishes downloading the changes, all right, it did it. And I’m going to rerun my build process. And what that’s going to do is it’s going to go back through. It’s going to regenerate. It detected that this interface was updated, because I changed that 15 to 35. It regenerated all the code. And now it’s recompiling my CL code. Again, this is with all open source tools. So it’s building both the open source and the IBM i code. Yes. It is building both the open source and the IBM i code, setting it all up. For those of you who work with CL, this will be familiar. It’s just piping my compiler output directly to my SSH console. I restart the Node.js application, which is how you apply a code change. And then what I’m going to do is I am going to run this again with the same information. And this time, you see I get battery electric vehicle, BEV, spelled out fully. I get the full parameter there, because I was able to deploy this entire thing in however long that took. That was two or three minutes through the open source tools. So this update has now been deployed to the server. The program has been rebuilt. Everything is running smoothly. And again, everything in this was open source tools all the way through.
Could you show them just the GitHub repository with the RPG code? Yeah, sure. Why not? All right. Let’s open that up. So that’s going to be github.com. Let’s open this up. All right. Now, actually, here’s a good thing. So I just went to this repository. It said, oh, this branch had recent pushes just two minutes ago. So I’m going to switch to that. You can see it has my message set electrification level to 35 characters. I’m going to go to my SRC interfaces. Actually, you know what? You don’t have to do that. Let me just click on this commit. And it’s going to say, look, length 15 was changed to length 35. All right. So this is all up in the cloud in GitHub. So this is all safe. I don’t have to worry about spilling water on my computer or a power failure or whatever, anything going wrong on my systems. This is all stored safely using Git. You want to show the RPG program? Yeah, sure. And we can hop into the program and then go into my SRC interfaces. Now, this was the display vehicle. So that’s this one. Here’s my CL code for this demo. And just like all the other ones, if you look at this, call PGM, ECC send request. Actually, let me zoom in on that. ECC send request right there, just like in all the other ones. And down here, ECC receiver response. And that’s it. Great. Terrific. Well, thanks, Aaron. I appreciate it. Let me get back and we’ll just wrap this up. So basically, what we covered today is we covered the IBM i in the cloud. We covered how you can call out from the IBM i to open source, how you can use open source free components in your IBM i applications, how you can call into the IBM i from open source and then open source DevOps for the IBM i. So I hope you’ve learned a lot about the kinds of things that you can actually do with the IBM i to extend your applications and to use the latest, most modern technology. So you keep your IBM i over here on the right side of the screen instead of the left side of the screen. And if you need any more information, you can visit our website at www.eradani.com or send me an email or send Aaron an email and we’d be happy to reply. Otherwise, thank you so much for attending the webinar today. Thank you all.