As I'm sure you know, the SEU F15 key (Browse/Copy options) lets you open another member, select a line or block of lines, and insert them either before or after a specific line number. IBM Rational Developer for Power Systems Software (RD Power) has no direct equivalent to this, but the following three features come awfully close to matching the capabilities of the F15 key. Deciding which of the three features comes closer has caused a bit of discussion during my sessions; therefore, I'll let you decide. First, Figure 1 shows the SEU F15 operation in action.
Copy and Paste—the Old, Familiar Way
Clearly, copy/paste is one technique that we use often. It's especially helpful when we use a split screen, similar to the same that SEU presents the source member to copy from. To open a second member during an edit session, just press Shift+Ctrl+A. Doing so instructs RD Power to pop up a window where you can type in a specific member name to edit or browse (Figure 2).
Once the member opens, drag it to the bottom of the editing area, which provides a split-screen effect. Next, highlight the lines you want to copy, and select Copy, or press Ctrl+C (Figure 3).
Finally, position the mouse where you want to insert those lines, and select Paste, or press Ctrl+V.
Get File—the Old New Way
The Get File feature lets you insert code from another member directly into the member you're currently working on. One benefit of this feature is that it's not restricted to the same connection that's currently active. In fact, Get File isn't even limited to the same server. When the editing area you want to insert the member's contents into has focus, click File|Get File. The Get window will appear, prompting you to select a member. The window in Figure 4 shows that only one connection is defined in this workspace, but all connections appear.
In addition, you can create a new connection on the fly and immediately select a source member. Choosing Work with libraries will prompt you to type in a library name.
Figure 5 displays the library prompt where I typed in DEVLIB.
Once I open DEVLIB, all of the files appear. Next, I scroll down to QRPGLESRC and click the member that contains the contents I want to insert (Figure 6).
Afterward, the contents are immediately inserted, as Figure 7 shows.
If you have a particular block of code that you must insert into multiple members, you can store that block in your workspace for easy retrieval. In addition, you can insert variable text into the block before it's inserted into your code.
Select Window|Show View|Other|General|Snippets. When the snippets view opens, right-click and select Customize to display the Customer Palette, where you can create a new category or new item. Think of a category as a folder and an item as a file within the folder.
Here, I create a category named Customer Care. Next, I click New|New Item, which creates a template that I rename Fax Document. In Figure 8, notice the three variables: phone, Spool_File_ID, and Message_queue.
To create these substitution variables, simply click the New button to the right. At the bottom of the Template section, notice that the send_fax call also contains two parameters, each prefixed with a dollar sign ($). These parameters are the variable placeholders, which you insert by positioning the mouse at the desired insertion point and clicking Insert Variable Placeholder.
In Figure 9, I add a new line of code to populate the field msgq, and then click Insert Variable Placeholder.
After I select Message_queue, it appears in the code snippet as a placeholder (Figure 10).
Once the snippet is saved, I can insert it whenever and wherever I need it. Again, display the Snippet view and right-click the template you want to insert, as Figure 11 shows.
In the Insert Template view (Figure 12), you can now change the placeholder values before they are inserted into the code.
To use the default values, simply press ENTER.
For example, when I change the value of the phone number field (Figure 13), it's automatically changed in the snippet source code.
This is obviously just a demonstration snippet, but you can see the usefulness of this approach. A snippet can contain any type of text; it doesn't have to be program code. One shop I visited stores a program header as a snippet. In this shop, all programs must have a consistent comment section that describes the program and the author.
Which Method Is the Winner?
The technique you choose depends on your coding style and requirements. I've discovered, though, that generally once developers find a "solution," they tend to stick with it, even if they have to perform several gyrations to make it work in every case. Experiment with the last two methods I've described—you may find yourself with a new solution to your "missing" F15 function.