Mike Larsen
Mike Larsen is a Director of Information Technology at Auburn Pharmaceutical and an associate of Central Park Data Systems and has been working with IBM i systems for over 20 years. He specializes in RPG, CL, and SQL and recently has been working with PHP and Python. Current projects have given Mike the opportunity to work with generating and parsing XML and JSON from SQL and consuming SOAP and REST web services. Although his main area of expertise is on IBM i, Mike has a passion for learning other languages and how he can integrate other platforms with IBM i.
-
Guru: Passing Parameters To Python
August 5, 2019 Mike Larsen
Python scripts offer great benefits to developers, whether used standalone or in conjunction with RPG programs. As I’ve been exploring Python and recently I had a need to execute a Python script from an RPG program. In addition to executing the script, I also wanted to pass it parameters.
One of the benefits of passing parameters is to give us the ability to soft-code programs or scripts. Soft-coding makes programs more flexible and re-usable, and helps to reduce maintenance.
To illustrate how to do this, I’ve coded a very simple RPG program and an even simpler Python script. I’ll start …
Read more -
Guru: Finding Large Files With Python
July 15, 2019 Mike Larsen
It’s always a good idea to purge files that aren’t needed any longer. Chances are that you already have procedures in place to purge data from Db2 files and tables, but what about files that reside in the IFS? Do you have a good solution for keeping the IFS clean?
Perhaps you have old order files stored in the IFS. If you work for a large company, these types of files can accumulate quickly. I’ve written processes in the past to remove files from the IFS using RPG, but I’d like to offer an alternative. I’m going to show how …
Read more -
Guru: Creating Excel Spreadsheets With Python
April 29, 2019 Mike Larsen
Over the past several years, I’ve seen a growing demand to provide business data in Excel. Some shops are content to receive their data in .csv format and then manually apply formatting to make it presentable. Wouldn’t it be better if we could provide a spreadsheet that is already formatted?
In my opinion, the answer is yes. Most recently, I’ve been using PHP to accomplish this task. PHP works great for me, but I always like to have different options from which to choose. This is important to me because some shops may not have PHP installed. Based on that …
Read more -
Guru: Using SQL With Multi-Membered Files
October 29, 2018 Mike Larsen
Recently I worked on a process that required me to update records in a file based on certain criteria. Sounds like a common request, right? Well, there was a twist. The file had multiple members and the update needed to consider all of them. Suddenly, a “simple” request became a bit more challenging.
I knew of a few ways to work with multi-membered files, but I like to lay out all the options before deciding on a game plan. One method I considered was to perform an override of the file (OVRDBF command). That would certainly work, although I have …
Read more -
Guru: A More Efficient Way To Merge With SQL
October 15, 2018 Mike Larsen
Lately, I’ve been using the merge statement in my programs to insert or update rows in a table. I recently came across a situation where a program using merge was running every few minutes and performing updates to thousands of rows each time it ran. Since this table was journaled, it was obvious some re-design was necessary.
For those unfamiliar with the merge statement, it is sometimes referred to as an “upsert.” That means it will either perform an update or an insert. In RPG terms, I like to compare it to a chain operation. With a chain, you check …
Read more -
Guru: Moving A Web Service To Another Web Server
February 19, 2018 Mike Larsen
IBM Integrated Web Services (IWS) makes it easy to create web services and deploy them to a web server. If you need to deploy the same service to multiple web servers, you could use IWS to manually create it on each server, but it would be time-consuming and error-prone. Simply missing a setting when creating the service can lead to unexpected results.
Or you could automate the process. That would ensure the attributes of the service carry forward from server to server. While I won’t get into the web service creation process, as there are already many articles that address …
Read more -
Guru: Consuming A REST Web Service Using SQL And POST
October 2, 2017 Mike Larsen
In my prior article, I showed how to consume a REST web service using the GET verb. This time, we’re going to continue to build our knowledge of web services by working with the POST verb. In addition to working with a different verb, I’m also going to demonstrate how to pass a header and body to the service.
The goal is to post information to an Amazon Web Service (AWS). I created a simple REST Amazon Web Service that accepts information about a pet which will be inserted into a pet store database. I pass a JSON structure …
Read more -
Guru: Consuming A REST Web Service Using SQL And GET
September 18, 2017 Mike Larsen
The use of web services in the industry continues to grow, and sometimes it can be challenging to find information on how to work with them on IBM i. So, what is a web service? In a nutshell, web services allow systems to communicate via the web using file formats such as JSON and XML.
This article demonstrates how to consume a REST web service using SQL. The example I’m working with uses the ‘GET’ verb to retrieve information from an Amazon Web Service (AWS). I created a simple REST Amazon Web Service that retrieves information about a pet from …
Read more -
Guru: Retrieving Images From An SQL Table
July 10, 2017 Mike Larsen
In the first part of this series, I showed you how to load images from the IFS into a table that has a column defined as a BLOB data type. BLOB stands for Binary Large Object and is a collection of binary data that is stored as a single entity in a database.
Our final goal is to retrieve the images from the table we loaded in part 1 and write them back to the IFS. Once we complete this task, we should end up with the same five images we worked with in part 1. To keep everything …
Read more -
Guru: Storing Images In An SQL Table, Part 1
June 26, 2017 Mike Larsen
In the first part of this series, we’ll look at how we can store images (or other media) in an SQL table on the IBM i. To accomplish this goal, we’ll write an RPG program that reads a table that has the name and location of the images from a folder in the IFS, and writes those images to a table.
The images will be stored in a column that is defined as a BLOB data type. ‘BLOB’ stands for ‘Binary Large Object’, and is a collection of binary data that is stored as a single entity in a database. …
Read more