Wednesday, June 19, 2024

Running JasperReports from IBM i

For any of you looking to do reporting from IBM i. I created a wrapper around Pete Helgrens RPG Report Generator Java code that can execute Jasper Reports from IBM i. 

I have done work with Jasper Reports since 2007. JasperReports has a bit of a learning curve but well worth it if you learn to build reports and documents with it. 

This wrapper is IBM i specific, but Jasper can be used anywhere to generate reports. Have fun.

Tuesday, May 21, 2024

Configure NGINX with specific user without user needing *ALLOBJ Authority

User was seeing the following error in their NGINX log file when trying to start or restart the NGINX server via:

Errors showed up in the log file in file: /QOpenSys/var/log/nginx/error.log

Accessing error.log from 5250 command line:
WRKLNK '/QOpenSys/var/log/nginx/error.log'

2024/05/21 13:00:46 [notice] 3215038#1: signal process started                 
2024/05/21 13:00:46 [alert] 3214934#1: recvmsg() failed (13: Permission denied)
2024/05/21 13:00:46 [alert] 3215039#1: recvmsg() failed (13: Permission denied)
2024/05/21 13:00:46 [alert] 3215041#1: recvmsg() failed (13: Permission denied)
2024/05/21 13:00:46 [alert] 3215042#1: recvmsg() failed (13: Permission denied)

This seems to be related to setting up an appropriate user profile to run the NGINX server and threads under.

By default the main thread user will be the user who started the NGINX server. And worker thread jobs run under user profile: QTMHHTTP by default.

What we want is for the main thread and worker threads to run under the same user profile. See the following GitHub article for a resolution:

Saturday, February 03, 2024

Update IBM i System Time with Python

I just completed a nice example of integrating IBM i system commands with Python when you have a need to update your system time. The IBM i has a built in time sync, but in my case some of the firewalling services I used get in the way so I needed a way to update on demand via an NTP time server. And Python didn't disappoint. 

Check out this link for the Python code example:

Friday, November 24, 2023

Resolving ODBC and SSL Issues with IBM i

 If you are an IBM i / AS400 developer and use ODBC, you've possibly had a need to connect to the IBM i using ODBC with SSL. 

Well this last week I tried using SSL for the first time on Linux, Windows and MacOS.  Each of them had their unique connectivity challenges. 

Check out the following links for info on how to possibly resolve your SSL issues: 

How to set up IBM i Access ODBC Driver for MacOS to use an SSL Certificate

How to set up IBM i Access ODBC Driver for Windows to use an SSL Certificate

How to set up IBM i Access ODBC Driver for Linux to use an SSL Certificate

Saturday, January 22, 2022

Use SQL to Query any IBM i File to an Output File

If you're an AS/400 - IBM i developer you no doubt remember the days of OPNQRYF, GSORT or writing temporary files with a custom RPG program to create a summary file or some other temporary work table. 

I think you'll appreciate the simplicity of this CL command utility for taking any SQL based query and creating an output file from the results. 

The CL command is called QSHQRYTMP and it's part of the QShell on i utilities  - QSHONI ( I created for interacting with QShell and PASE apps from RPG, COBOL and CL. As a helper command the command does not require QShell or PASE, but it seemed like QSHONI was a good place for the command to live.

Here's a sample of how easy it is to create a new file from an SQL query with QSHQRYTMP:

QSHONI/QSHQRYTMP SQL('select * from qiws.qcustcdt where LSTNAM  = ''Henning''') OUTFILE(QTEMP/SQLTMP0001) EMPTYERROR(*YES) PROMPT(*NO)                        

Temp file QTEMP/SQLTMP0001 was created from query. 0000000001 records.

Notice that you need the extra single quotes on character values because CL commands require you to double things up when passing single quote delimited values like a character based query string.

There are also 3 data areas that get automatically created in the jobs current QTEMP library. These data areas return the temporary table name and record count info in case your process needs to know these values. 

QTEMP/SQLQRYCNT - Query Result Record Count
QTEMP/SQLQRYFIL - Query Result File Name
QTEMP/SQLQRYLIB - Query Result Lib Name

QSHQRYTMP consists of a single CL command and CL command processing program that takes advantage of the power of the RUNSQL CL command to do most of it's work. 

I hope you enjoy using this command for creating SQL result files on-the-fly.  I have found it very useful.

Saturday, December 12, 2020

Install and configure Cron Scheduling on IBM i

IBM just released a cron scheduler for IBM i. They released cron, via the 'cronie' RPM package with Anacron, too. If you're not familiar with cron, it's a scheduling mechanism for open source platforms such as Linux and now it's available for IBM i.

This package can be a good way to schedule your open source jobs or even your IBM i CL commands and jobs that need to run on a regular basis.

Check out my quick start tutorial on using cron with IBM i. Using Cron Scheduling with IBM i

Getting Started with MariaDB on IBM i

IBM recently released a current version of the MariaDB database to run natively in PASE on IBM i. The software installs in minutes on IBM i via the Yum-based Open Source Package Management process which is part of Access Client Solutions (ACS). This means that MySQL is once again being fully embraced as a valid IBM i database for storing data for PHP applications such as WordPress. No need to look elsewhere to host your PHP applications and MariaDB data.

If you're interested in using MariaDB on IBM i, check out the following tutorial I created on Github that can be used to quickly install and get started with MariaDB on IBM i. Install MariaDB on IBM i

Thursday, November 26, 2020

Document Your Business and Technical Processes with MkDocs

If you thought documenting your business processes and application code was too hard or tools were too expensive, you should check out the FREE Python based MKDocs offering.

What a great way to start documenting all your company's common business knowledge in one place.

MkDocs is an open source Python static site generator for creating documentation using simple Markdown based text documents. Simply edit your MarkDown content files and they are available to anyone in the company who has access to the site.

No database required.

This is a quick way to establish one or more departmental knowledgebases with shareable business and system process documentation.

An MkDocs project directory structure could also be turned into a git project if desired so the entire site would be versioned in a git repository.

I created a quick getting started guide for IBM i, but MkDocs works on any platform.

Monday, September 02, 2019

Windows 10, SSH and VS Code - Nice !!

As I start to use SSH more and more to access remote IBM i and Linux systems and also use VS Code and other editors with IBM i and Linux I am always looking for ways to make life easier when accessing a remote system and running commands. Ideally I like to work from one user interface if possible.

Unfortunately VS Code doesn't have a built-in SSH client or terminal. In my case I typically use putty or MobaXterm as my go to SSH client in Windows 10. 

As I started experimenting more with VS Code I found out that Code can work with add-ins like SSH FS to access remote file systems and edit directly. This is invaluable for editing files from a remote system. 

However to run bash commands or IBM i system commands on a remote system still required putty or MobaXterm, until I found out that I can use open ssh from the command line terminal in VS Code. And I also found that Windows 10 now has a built-in SSH client and server which means I can initiate a remote SSH session from the Command Prompt or from the VS Code terminal Window. 

This means when I am working remotely with an IBM i or Linux system I can now connect to an SSH file system with SSH FS and I can also issue commands in a terminal session as well. Too bad there's not a 5250 interface for VS Code.

Have fun with this and check out the following article link on using ssh in Windows

Also check out this article on setting up to use VS Code with IBM i.

And remember that it's now easier than ever to use SSH with Windows 10.