Whenever a new tool comes out that is supposed to supplant an old tool, there is always some pushback. This is especially true when the new tool doesn't do everything the old tool does or doesn't do it as well. I'm a perfect example; I am constantly pushing back against those who would have you use SQL instead of native I/O even in situations where native I/O is clearly superior.
On the other hand, I'm a big supporter of WDSC, even if it isn't a 100% replacement for PDM, SEU, and especially SDA. That's because I can list many ways in which WDSC makes good programmers more productive. But it's not all sweetness and light; in some areas, WDSC falls short.
But Not This One Anymore
This specific feature is one that has long been a bit of a thorn in the side of WDSC evangelists. For the longest time, you couldn't open a member in one view and then see another view of the same member. SEU has had this basic feature for a long, long time, although with some conditions. The second view (which you enable using F15) is read-only and in fact is a view of the unchanged source file on disk. If you have made changes in the editor but not saved them to disk, they are not reflected in the split view.
The split view in WDSC is slightly different. Not only that, it's available only for RPG, not even for Java! I find that to be a refreshing change of pace: RPG getting a feature before other languages. It works like this:
Figure 1: This is the fully expanded view of the source for my SPLITS program. (Click images to enlarge.)
In Figure 1, you'll see a fully expanded source screen. You get this by double-clicking on the tab for the source member you wish to expand. This is my SPLITS program, but it's also one of my initial passes at an object-based RPG syntax. I create Rectangles "objects" (data structures) using a NewRectangle "method" (which is simply a procedure) and then pass those Rectangle objects to other methods, such as CalcArea. In this variant of the "Object RPG" syntax, I use data structures defined with LIKEDS. This lets me access the individual fields much as I would public variables; if I wanted to really hide everything, I would use pointers instead. But that's a little outside the scope of this tip; for the purposes of this article, it is enough that the source is longer than can fit on the screen. Figure 2 shows the second page.
Figure 2. This is the second half of the SPLITS program. The procedures are defined here.
In Figure 1, you see the prototypes for the NewRectangle and CalcArea procedures, and in Figure 2, you see the code for those procedures. However, there's no good way to compare them to be sure they're in synch (a common problem with the RPG procedure syntax). Split screen to the rescue!
Splitting the Screen
Figure 3. Bring up the split screen using View/Open new view from the right-click context menu.
Select the View submenu and the Open new view option and you'll get a screen like the one in Figure 4. Note: You can also use the simple keyboard shortcut "Ctrl+2" (press the digit 2 on the main keyboard while holding down the Ctrl key).
Figure 4: This is the initial split screen. Each "view" has its own scroll bar.
The editing pane will split into two sections. It's a bit unfortunate that IBM used the name "view" for each of these sections; it's confusing when used in connection with the views and perspectives of Eclipse. But naming notwithstanding, the implementation is fantastic. Each view has its own scroll bar that can be moved independently. You can also further subdivide views, resize them, and even split them horizontally rather than vertically. But in this particular instance, I'm interested in getting two sections of the code on the same page at the same time. The highlighted cursor in Figure 4 will move only the left source view up one page, resulting in Figure 5.
Figure 5: This is what I was after; I can compare the procedure definitions with the prototypes.
Figure 5 shows what happens when I scroll the left side up one page. Now I can see the prototypes on the left and the procedures on the right, and I can easily compare the two to make sure there are no differences. I can also quite easily copy and paste from one side to the other (but only using the GUI copy/paste mechanism; the SEU-like line-oriented commands only work within a single view). One other interesting thing: Note that line 2300 (the comment "// Initialize") is visible in both views. If I were to change the line on the left, the one on the right would also change at the same time. That is, these are both update-capable views, something else you can't get in SEU.
Closing a View
Figure 6: You can close a view using the View/Close view option from the context menu.
There you have it: the split-screen capability of WDSC! It's really very powerful. One caveat: This technique is different from the view capability in SEU; the split screen in the LPEX editor will not show you the unedited version of the source on disk. There really isn't an easy way to do that today. So if you need to view that original member during editing, be sure to copy the original to a save member first.