Guru Classic: Looking For Stuff With iSphere
February 5, 2020 Susan Gantner
In my last Guru Classic tip I introduced you to the iSphere RDi plug-in. In this tip I’ll cover a few other features in iSphere that I find very useful. This time I’ll focus on a couple of options there that can help you search for things and subsequently edit them. The two things we’ll be searching are source members and message files.
This tip contains a few updates to the original version of this article due to some iSphere enhancements made in the last few years. I’ve also included a few changes based on my experiences using these great tools to help me find stuff in my applications.
Looking For Stuff In Source Files
Let’s start out with the iSphere Source File Search. This is a feature similar to PDM’s option 25 — Find String Using PDM (FNDSTRPDM). It lets you search for a string of characters (a field or file name, for example) in the members of one or more source files. “But wait, there is already a multi-file search facility built into RDi . . .” I imagine is what some of you are thinking. True, but read on, because I think you may like this one better.
The iSphere search is much more flexible in a number of ways. First, it allows you to specify multiple strings to search for and you may decide whether the relationship between the two (or more) search strings should be “and” or “or”. You may also search for members that contain the string or those that do not contain the string.
Take a look at Figure 1 to see the dialog for the source file search. Don’t worry about all the source members listed in the “Area” box. iSphere creates that list for you based on the source file(s) that you right clicked when you selected the iSphere search option. Note that you can also specify whether the search is case-sensitive and whether it should be restricted to specific columns.
Look at Figure 2 to see what the search results look like. Note that in the left-hand pane is a list of all the source members where the text was found. Clicking on one of those members populates the right-hand panel with a list of every line of code where it found the item(s) searched for. Double clicking on one of the statements in the right-hand pane opens the source member in the RDi editor (if it’s not already open) and positions to that specific statement.
Now take another look at Figure 2. You may have already noticed that the search in Figure 1 doesn’t match the results in Figure 2. That’s because I did two more searches after the original one. Note the three tabs in the iSphere Source File Search tab. Those are previous searches that I had done. It retains the results from previous searches until you choose to delete them. While the “native RDi” search facility retains results as well, it’s not as obvious and easy to manage multiple search result sets. There are even options here to export the search results to either a member filter or to Excel.
But the biggest reason I use iSphere over the built-in source search is the speed of it. The search itself is dramatically faster by comparison. On the first search of a very large source file, you may notice a delay as iSphere builds the list of members, but, in my experience, second and subsequent source searches are amazingly fast especially compared to the built-in source file search option. The built-in option performance has improved in recent releases but I find that the iSphere source file search remains noticeably faster.
Looking For Stuff In Message Files — Two Ways
iSphere first came to my attention when I was struggling to do some maintenance on an application that made extensive use of message files. This application not only used messages in the traditional sense of supplying messages for green-screen applications or SNDPGMMSG, it also used them for a great deal of text on screens and reports. It even used messages for storing some of the rules that were the core of the application’s logic. Not only that, but with those messages, most of the significant data was in the second level text. So I found myself struggling to find my way through the hundreds of messages in multiple message files to get this job done.
I quickly learned that the CL commands related to message files were of little help in searching through the message text. And once I found the message, the commands weren’t terribly user-friendly for editing them. RDi support for editing a message was marginally better but didn’t help for searching for the message I needed to edit. I searched for and found some published green-screen code that made searching and editing of message file content a bit easier, but it still required a lot of effort to maintain the messages as I made my changes. I also kept bumping into limitations of the code, such as the size of second level message text it supported.
Then I heard that iSphere had a message file search tool and a message file editor that plugged into RDi. As a dyed-in-the-wool RDi user, it almost seemed too good to be true after the hours I had spent using other options daily to get this job done. It was not only true, but also provided many other features that I now use every day.
The message file support in iSphere consists of two tools: a message file search and a message editor. I needed to find which message(s) contained key words in the first and/or second level text and then read and potentially edit each message identified. Often the text editing involved doing a copy and paste from the documents the application designer had provided. These two tools worked well together to make all of this quicker and easier to accomplish.
For occasions when I need to search across multiple message files for some specific text or if I have a somewhat complex search criteria, then the iSphere Message File Search was the way to go. I can select as many message files as I need from the Remote Systems View, then right click and select iSphere Message File Search. This works much like the source file search we looked at earlier, and, as you can see in Figure 3, the message search dialog looks very similar and offers the same flexibility of items to search for.
I am particularly grateful for the ability to search on either first and/or second level text as well as the message ID. As it turns out, when I first installed iSphere, it only searched first level message text so I thought it wasn’t going to help me with my task. But an email to iSphere developer Thomas Raddatz resulted in a quick enhancement to the plug-in that added second level text searching. If you have questions or enhancement ideas for iSphere, you can find their contact information on the Contributors page of the iSphere Preferences (Window → Preferences, then expand iSphere to find Contributors). However, I have subsequently found that an even better approach is to utilize the WDSCi-L mailing list on Midrange.com. There are many iSphere users there as well as the contributors — you may find support for your idea from fellow iSphere users.
The search works very quickly, and in Figure 4 you can see an example of the results. In the example, my search only found two messages in one message file that met the criteria. Just as we saw earlier with source files, selecting the message file on the left populates the list of messages from that file that met the search criteria in the right-hand pane. To look at or edit any message that was found, I simply double click on the message on the right side of the dialog and the iSphere Message File Editor dialog pops up. More on using the editor in a moment. Similar options are available here for exporting to Excel or to an object filter.
As nice as the message file search is, for many of my more basic message file searches, I have found it even simpler to go directly to the iSphere Message File Editor. If you only need to work with a single message file and search for only a single string, you can accomplish a search and edit together with that tool. Access the message file editor by right-clicking on the message file and choosing iSphere Message File Editor, which results in the editor view being filled with a list of all the messages in the file. (Note: There is also an iSphere Compare Message File Editor – choose carefully!) From the message list, you may be able to simply locate it in the list, double click, and get the iSphere Message Description dialog as shown in Figure 5. Note that you can also right click in the message list for other options, such as adding a new message or copying an existing message.
Notice that there are also Message-id and Text filter boxes at the top of the message list that can be applied to either first and/or second level text and/or to the ID. Key in the text and/or partial ID you’re looking for and the message list will be filtered to only the ones containing that information. For simple single file searches, this proves to be a bit faster and easier for my work than using the separate search tool.
So far we’ve seen that the iSphere RDi plug-in allows us to see object and member text and to search for strings in both source files and message files. There are many more features that I use from it as well that I’ll cover in future tips. In the meantime, if you have become sold on the idea of downloading and installing this free plug-in, instructions for doing that were covered in my earlier tip.
Susan Gantner, an IBM Champion and co-author of the popular Redbook, Who Knew You Could Do That with RPG IV, is one of the top speakers/writers/trainers on IBM i development topics. She is a partner at Partner400 and System i Developer, and she hosts the RPG & DB2 Summit twice per year with partners Jon Paris and Paul Tuohy.
RELATED STORIES
Guru Classic: iSphere Plug-in Expands RSE/RDi Toolset
Guru Classic: My Favorite Keyboard Shortcuts for RSE/RDi
Guru Classic: Giving RDi a Split Personality
Guru: Ready or Not! RDi V9.6 (Series of 5 tips)
Guru: RDi V9.6, Part 6 – The New Object Table Gets Even Better