Lightly Seared On The Reality Grill

Random expat geekery from The Low Countries

Browsing Posts in IBM i

I like Sean Chandler’s column on the System i Network. He’s been around a bit and tends to take a slightly jaundiced view of the next big thing, discarding the hype and looking for the parts that might be useful. This month its the turn of “The Cloud” and the claim that they can solve all of your Big Data Problems.

Big Data refers to the expanding volume of unstructured data (email, Word documents, PDFs, and so on) that businesses accumulate and – increasingly – are obliged to retain. The problem is twofold; firstly you have to find somewhere to put all of this stuff and, secondly, you need to be able to retrieve it reasonably quickly. For this, “The Cloud” is often touted as a one-size-fits-all solution, often by people who understand marketing better than they understand IT.

Chandler hits exactly the right note when he says:

The key word there is “supplement.” Cloud-based storage doesn’t replace tape storage. It doesn’t replace near-line disk storage. It’s simply another tool in the toolkit. You may want to, for example, move archived data to both cloud storage and tape storage selectively. For instance, full system backups are better suited to tape, but targeted file backups may reasonably go to both tape and cloud storage.

Technologies come, technologies go, technologies are reinvented. When new technologies are announced, or older technologies are reinvented, they are often surrounded by a great deal of hype and an endless array of breathless commentators telling us how this new shiny thing will change the way we work, play, communicate, eat, sleep, or whatever. Nothing ever lives up to this hype, however, and it’s often when the technology goes – or disappears from the headlines – that it begins to become useful. This is the point when the marketing pressure starts to ease off and people can begin to look at how the new or changed technology can be realistically used.

Cloud storage is here to stay. But it won’t begin to become a useful tool until the press stops talking about it.

flattr this!

I have, over the past few months, noticed a bit of an oddity in my IT-related behaviour (I already knew about the rest of my behaviour). I work as an IBM i developer and, over the years, I have jumped on an started using pretty much every graphical tool I can find. Then I go home, boot up my Linux powered laptop, and spend half my evening in the terminal.

So why the disconnect?

I think it comes down to the fact that modernisation has become a hot topic within the IBM i community over the past few years, and it’s a bandwagon that many people jump into without pausing to define what they mean by ‘modern’. The result is that a great deal of emphasis is placed on the application front end with nowhere near enough thought being given to what overheads these tools incur.

Obviously, graphical tools have many advantages. A well designed GUI is intuitive, easy to use and can put a great deal of information onto a screen in an easily digestible form. There is, however, a performance overhead to be taken into account – both in terms of network traffic and the load on the local user’s CPU. For many applications, especially applications aimed at the business end-user, this performance cost is well worth paying.

For the technical user, though, it’s not quite so clear cut.

Once you know your way around an operating system, and the text-based tools that come with it, it is often the case that the command line is a quicker and more effective method of completing a task. In these cases, the GUI approach gets in the way of achieving stuff and becomes a source of noisy frustration (as the unfortunates who share an office with me can attest).

GUI based applications do have their uses, of course, and there are plenty of tasks for which a graphical approach is the most appropriate. But sometimes it isn’t.

The challenge, therefore, when faced with a shiny new tool is to ask yourself this: How will this tool make my life easier?

flattr this!

Dawn May makes a good point:

Finally, in closing, I just want to make a simple observation – if i were to suddenly disappear tomorrow, the world as we know it would change significantly. So much of the world’s business runs on i, hidden away where it silently toils, day after day. Think about it…

The IBM i doesn’t receive as much attention as it deserves within the mainstream tech press. And among the more general press, it’s practically unheard of. In many ways this is unfortunate, but it is also a reflection of the sheer reliability of this system.

It doesn’t tend to be used for all of the flashy customer-facing stuff that attracts all of the column inches but what it does do – and do well – is handle all of the dull but essential process upon which the flashy parts depend. When you walk into a shop there is a good chance that an IBM i somewhere in the supply chain ensuring it’s fully stocked. Similarly, when you visit a web site to order a product online, there is also a good chance that the allocation, picking and shipping of your order is being handled by an IBM i.

In short, there are a huge number of IT processes on which we all depend and the dependability of the IBM i makes it a natural choice to manage these processes.

It’s not flashy and we often take these things for granted. But we would all miss it if it wasn’t there.

flattr this!

Happy 20i2

No comments

And a word of appreciation to Angus the IT Chap for the sterling work he continues to do in helping to promote what is still the most powerful, stable and reliable business system in existence.

flattr this!

The IBM i CL command Reorganize Physical File Mbr (RGZPFM) removes deleted records from a specified member of a physical file and, optionally, reorganizes that member. It’s a handy command to know about but reorganising physical files member by member can become a very painful process if you have a lot of files to reorganise (after manually purging a large volume of test data, for example).

I did, at a previous employer, have access to a RGZLIB command. This reorganised all of the physical files in a library and made for a much more convenient purge. Unfortunately, this is ont a system supplied CL command and my current emplyer doesn’t have it.

So I wrote my own version.

RGZLIB is a simple command that will reorganise all of the physical file members in a selected library. Depending on the size of the library to be reorganised (and the size of the files in that library) this process can take a while to run, so I strongly suggest that you submit the command to batch.

My original plan was to write this in RPG and include some additional file clean-up options. However, it turns out that there is no API to retrieve a list of files in a library so the program, as it stands, is a very simple CL affair. If I do code up the additional functionality, I will put it into a seperate command to avoid over-complicating things.

As ever, the source is available on GitHub and you are free to browse or download it from there.

flattr this!

I’m not going to criticise anyone for trying to move away from native I/O on the IBM i and into SQL, but I have seen a few eye-watering attempts. So in the spirit of sharing knowledge and making life a bit easier for all of us, here is an example of reading and updating a table using SQL.

Let’s start with the table we’re updating. It’s a very simple table and simply maps the SoldTo/ShipTo combination in the distibution system to a Store number in the retail system. You can build a simplified version of this using the following:

create table
testlib.sqltest
(index integer not null
 GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1),
 Soldto char (5) not null,
 shipto char (4) not null,
 store numeric (5, 0) not null)

The requirement is that, based on various business rules, some SoldTo numbers in this table need to be changed. In order to keep things simple, the below program applies a simple rule of: If the store number is less than ten, change the SoldTo to 99999. (I know, I said I was keeping things simple).

The program, as it stands, is pretty much as simple as it gets, but there are couple of points that are worth noting explicitly.

Firstly, when we declare the cursor, we need to include a For Update clause to identify which field (or fields) can be updated.

Secondly, in the Update statement, the Where Current of C1 clause applies the update to all records returned by the cursor. That means that flexible mass updates with a minimum of logical mess are now at your fingertips.

     H
     D SqlRecord       DS
     D  SoldTo                        5A
     D  ShipTo                        4A
     D  Store                         5S 0
     D
     D NewSoldTo       S              5A
      /Free

         Exec Sql
            Declare C1 cursor for
               Select SoldTo, ShipTo, Store
               From SqlTest
               For Update of SoldTo;

         Exec Sql
            Open C1;

         Dou SQLSTATE>='02000';
            Exec Sql
               Fetch C1 into :SqlRecord;

            If SQLSTATE<'02000';
               If Store<=10;
                  NewSoldTo='99999';
                  Exec Sql
                     Update SqlTest
                     Set SoldTo = :NewSoldTo
                     Where current of C1;
               Endif;
            Endif;
         Enddo;

         Exec Sql
            Close C1;

         *INLR=*ON;

      /End-Free

flattr this!

When debugging – and when developing quick and dirty utilities – I often resort to the DSPLY opcode. It isn’t pretty, but it puts information onto the screen without having to bother with DDS. There is a better way.

Display Long Text (QUILNGTX) API displays a pop-up window containing the string of text passed to it. You can even add a title to the window by passing a Message ID and (optionally) a qualified message file name.

This API has been around for a while, but it’s new to me and, after playing around with it a bit, I have now updated the DSPOSRLS utility to take advantage of it.

Pretty, isn’t it?

For the sake of completeness, I should probably add a message to a message file for this so that I can display a window title. For the sake of laziness, that’s something for the future.

flattr this!

Via IBM i for everyone!

flattr this!

David Shirey’s article, Managing RPG Program Complexity is, as the title suggests, aimed primarily at IBM i developers. The general principles, however, are true for anyone doing any sort of development and is worth a read. I particularly liked the last couple of paragraphs:

Limiting program complexity is a way of thinking, not a series of tips, and it starts with thinking through your design before you begin putting code on the screen. What are you trying to accomplish? What individual logical ideas make up your overall goal? How do you want to structure those ideas using programs and subprocedures?

… Most important, simplicity doesn’t just happen. Complexity just happens—you have to work at simplicity. But in today’s world, I can’t think of a more worthy endeavor.

If you didn’t manage to read that far, the TL;DR version is that any application consists of several descrete logical steps. Each of these discrete steps should be coded seperately and should be small enough that anyone (with the relavant language skills, obiously) should be able to glance at it and know exactly what it is doing. How you break out the various functional pieces is less important than that you do break them out.

Or, to rephrase it slightly, people who write massively monolithic programs deserve to have their fingers broken.

flattr this!

Splash I use SQL a lot. Not only embedded within my RPG programs but also interactively to check and maintain data. The IBM i does provide a green-screen interactive SQL session but as soon as you start writing anything more than simple select and update statements, this becomes very cumbersome. The System i Navigator also provides an SQL tool which, while an improvement on the green screen session is still pretty basic.

It is possible, of course, to write your SQL in a source code editor like Notepad++ and then paste it into the System i Navigator SQL tool. Obviously, though, this is not ideal so I was rather pleased to discover that there is a better approach.

I heard about SQuirreL SQL earlier this week and, having finally gotten around to installing it, I have to say that I am very impressed. SQuirreL SQL is open-source SQL client that uses JDBC to connect to pretty much any database you can think of. It’s fast and feature-packed and really is a boon to developers.

In order to get it up and running, you need to first download JTOpen, the open-source version of the IBM Toolbox for Java, and then download and install the SQuirreL Client itself. MC Press Online has a useful walk-through of the steps you need to take to get this all working.

Once you’re in, though, it really is a lovely tool. I am not going to attempt to write a review on the basis of three hours of tinkering, but one thing that has struck me is that the keyboard shortcuts are well worth learning.

Beyond that, I have yet to encounter a task that I can’t complete faster with SQuirreL than with my previous approach.

flattr this!