Looking For Stuff With iSphere
July 7, 2015 Susan Gantner
In my last 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 within iSphere that can help you search for things and subsequently edit them. The two things we’ll be searching are source members and message files.
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 . . .” I imagine some of you thinking, “there is already a multi-file search facility built into RDi.” 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.
Now 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 a look at Figure 2 again and 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. This is a feature that I’ve found makes this much more useful than the “native” search facility built into RDi. There are also options 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 option where I often went for coffee while waiting for the results of a search on a large source file!
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. 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 dyed-in-the-wool RDi user, it almost seemed too good to be true after the hours I had spent using other options 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 do all of this quickly and easily.
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 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 the developer at Task Force resulted in a quick enhancement to the plug-in that added second level text searching. If you have questions or enhancement ideas for iSphere, I’d certainly advise contacting them. You can find their contact information on the Contributors page of the iSphere Preferences (Window → Preferences, then expand iSphere to find Contributors).
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 was, for many of my more basic message file searches, I 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, which results in the editor view being filled with a list of all the messages in the file. From here, of course, if you know the message ID of the message you need to work with, you can simply locate it in the list, double click, and get the iSphere Message File editor dialog, as shown in Figure 5.
But notice that there is also a Filter box at the top of the message list that can be applied to either first and/or second level text. Key in the text you’re looking for in that box and the message list will be filtered to only the ones containing that text. 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 is half of Partner400, a consulting company focused on education on modern programming and database techniques and tools on the IBM i platform. She is also a founding partner in System i Developer, a consortium of System i educators and hosts of the RPG & DB2 Summit conferences. Susan was a programmer for corporations in Atlanta, Georgia, before joining IBM. During her IBM career, she worked in both the Rochester and Toronto labs, providing technical support and education for application developers. Susan left IBM in 1999 to devote more time to teaching and consulting. Together with Jon Paris, she now runs Partner400, and appears regularly at many technical conferences, including System i Developer’s RPG & DB2 Summit. Send your questions or comments for Susan to Ted Holt via the IT Jungle Contact page.