Drag and drop save files (SAVF) between your PC and the IBM i. Search PC files with a preview of the found lines. Access your PC like Windows Explorer does.
There are some PC capabilities built into the Rational Developer for i (RDi) IDE that may not be immediately obvious. In this TechTip, I'll introduce you to a few that you may find useful. Note that this article is based on running RDi (or WDSc) on Microsoft Windows. There is nothing here that addresses a Mac- or a Linux-based machine.
Exploring Your PC with RSE
The Remote Systems Explorer (RSE) perspective can access your PC in much the same as Windows Explorer. It shows a hierarchical list of folders from which you can delete, copy, cut, paste, and move objects, and you can launch PC programs. The RSE interface is slightly different from Windows Explorer, so I'll do a brief run-through it.
In the Remote Systems pane, you typically see a "Local" connection that is your PC. If you expand it, you see something like Figure 1 below:
Figure 1: Expand the "Local" connection.
If you expand "Drives," you see all the drives on your PC.
If you expand "My Home," you see the objects in your Windows user directory. "My Home" on my PC looks like Figure 2 below:
Figure 2: My "My Home" expanded looks like this.
Obviously, your list of directories will be different, but it should look like what you see in Windows Explorer if you navigate to your user directory. For example, since I'm user Sam on my PC, RSE is showing me the same directories and files that I see in C:\Users\Sam in Windows Explorer. (You can also add filters to the RSE "Local" connection if you just want to see a subset of your data.)
RSE doesn't show you directories that begin with period (.), but you can make them appear by changing your preferences to show hidden files. On the menu, click Window > Preferences and check "Show hidden files," as in Figure 3 below:
Figure 3: Make hidden files appear in RSE.
You can expand a directory and see the directories and objects in it. Windows Explorer works in two panes, while RSE works in a single pane, with directories first and objects at the bottom. Depending on the combination of Windows and RDi versions you are running, you may find that some directories you see in Windows Explorer are aliases and won't open in RSE. For example, in RSE "My Documents" may show up but won't open and the data is really found under "Documents."
If I expand my "Documents" directory and then expand my "Manuals" directory, I see this:
Figure 4: The directory is expanded to show objects.
You can right-click on an object, for example "Embedded SQL Programming.pdf," and open up a menu where you can rename, delete, copy, and move the object.
There is also an "Open With" submenu, as in Figure 5, below:
Figure 5: Use the Open With submenu option on an object.
If you click "System Editor," the PDF opens up in Adobe Reader, just as it would in Windows Explorer.
If you click "Text Editor," the file is opened with the RSE text editor. (Obvious caution: If you change it and save it, you will probably corrupt the PDF!)
Depending on the suffix of the file, other ways to open it may be on the "Open With" submenu.
RSE will also look inside JAR and ZIP files. As an example, see Figure 6 below, which shows an expanded .jar file and some of the other "Open With" submenu options:
Figure 6: Open an XML file that is inside a JAR file.
Searching Your PC
RSE can search PC directories and files. It is not an indexed search as you can get in Windows Explorer, but it is quite fast, and the way it presents the results is more convenient.
I did a lot of ad hoc SQL in my last job, and I ended up with many scripts that I could reuse with minor tweaks or as the basis for some new need. I got smarter in my naming, and even organized scripts by subdirectories, but there were still occasions when I had to resort to searching for something I knew I had previously run but couldn't lay my hands on.
Here's an example where I knew I had some SQL that worked on data in library SPACELIB but couldn't quickly find it.
I right-click on my SQL directory and then click "Search," as in Figure 7 below:
Figure 7: Start a search of a directory.
This brings up the search dialog. There may be many search tabs, but I use the "Remote Search" tab. I enter "spacelib" in the "search string" box and make sure that "Search subfolders" is checked, as in Figure 8 below. (There are other options in the search dialog that you can explore at your leisure.)
Figure 8: Complete the Remote Search dialog.
When I click the "Search" button, the "Remote Search" tab opens, showing me the two files where the "spacelib" string is found, as in Figure 9 below. Note that if the file name isn't completely shown, you can hover and see it all.
Figure 9: Get your search results.
You could obtain the same results in Windows Explorer, but Remote Search has a couple of extra features that make it better for me. Rather than open each file in an editor, you can expand the results (by clicking on the right-pointing triangle) and preview each occurrence of the search string (hover if needed to show the entire line), as in Figure 10 below:
Figure 10: Search results can be expanded to preview occurrences.
If you have a lot of hits, previewing the lines may help you more quickly isolate the file you want.
Double-click on a file name in the Remote Search tab to open the file at the first line. Double-click on a preview line to open the file positioned to that line, line 17 in Figure 11 below:
Figure 11: The file is opened and the cursor positioned.
You can also right-click on a file to get additional "Open With" options.
This example is working with text files, but you can also search other object types—for example, Word documents—but double-clicking to open the document may not work.
Copying SAVF Files
Some vendors deliver fixes as save files. Some shareware or freeware can be downloaded as a save file. For whatever reason, we sometimes need to upload a SAVF file from our PC. Typically, we'd use FTP. For some of us, the first FTP can be a bear. And often the second one, and probably the third…
Suppose we have downloaded a SAVF file named DEMO.SAVF to our PC and we want it on the IBM i. FTPing it is typically a multistep process, something like this:
First, on the green-screen, you need to create an empty save file to be the target of the FTP:
Then on your PC, start a command session, get your directory right, and then run FTP commands:
Connected to pub1.de.
220-QTCP at 22.214.171.124.
220 Connection will close if idle more than 2 minutes.
User (pub1.de:(none)): lennons
331 Enter password.
230 LENNONS logged on.
ftp> cd /qsys.lib/lennons1.lib
250 "/QSYS.LIB/LENNONS1.LIB" is current library.
ftp> quote site namefmt 0
250 Now using naming format "0".
200 Representation type is binary IMAGE.
ftp> put demo.savf
200 PORT subcommand request successful.
150 Sending file to member SAVF in file DEMO in library LENNONS1.
250 File transfer completed successfully.
ftp: 2745600 bytes sent in 12.37Seconds 221.94Kbytes/sec.
It is so much easier using RSE! For one thing, there is no need to create any empty save file on the IBM i. Just copy and paste! Simply right-click and "Copy" the PC save file (Figure 12):
Figure 12: Copy the SAVF.
Now navigate to the target library on your IBM i and click "Paste" (Figure 13 below).
Figure 13: Paste the SAVF into a library.
RDI will create a SAVF in the library, and a window will open showing the transfer process running (Figure 14 below).
Figure 14: This is the transfer progress window.
On the green-screen, run a DSPSAVF command to prove that the file transferred correctly.
This is so much more convenient than FTP. And you can also transfer save files this way from the IBM i to your PC.
Copying from PC to IFS
You can also move files between your PC and the IFS without having to map drives. In the "Local" connection, right-click and "Copy" the file. Then navigate to a directory in "IFS Files" and click "Paste" (Figure 15 below).
Figure 15: Move files between your PC and the IFS.
And, of course, you can go the other way, from the IFS to PC.
RDi has a number of features that bring your PC and your IBM i closer. The RSE view of your PC is very similar to Windows Explorer, the search functionality has additional features, and you can move files and SAVF objects from your PC to the IBM i with copy and paste. And there is similar functionality in WDSc if you are stuck on the last free version.