Contact | Privacy Policy
    HOME  |  CONFERENCES  |  eLEARNING  |  ABOUT US  |  SERVICES  |  COMMUNITY  |  DOWNLOAD
 
October 12-14, 2010 in Minneapolis               
Special Offers & Sponsors
News Headlines
August 18, 2010
SiD's EDiT program offers 6 grants to unemployed developers
June 30, 2010
SiD launches eLearning program for RPG/DB2 professionals
June 2, 2010
i can, can you? New sessions set for next RPG & DB2 Summit
March 25, 2010
New Podcast: CGIDEV2 vs. PHP
February 25, 2010
Skip Marchesani and Mike Cain on What's New in DB2 on i
February 11, 2010
How to Document ILE RPG Apps using a free tool by Paul Tuohy
January 28, 2010
Susan and Paul discuss MySQL: Blessing or Heresy?

RSE Tips

The following tips refer to Version 7 of RSE for System i, whether you're using it as part of WDSC or the new RDi. On earlier versions, all of these things are available but some are done slightly differently. Email us if you need assistance - or, better yet, upgrade to Version 7! It's much better and it installs much faster and easier than Version 6.

You can also download RSE Keyboard Shortcuts or check out the RSE Frequently Asked Questions.

Simply click on the to check out the details for a tip.

Customize Your RPG Editor

RSE is great "right out of the box," but there are many preferences we like to set to tweak it to work even better. Since we spend a lot of time editing RPG code, we thought we'd discuss some of own favorite preference options specifically geared toward editing RPG IV source. Like our keyboard shortcuts, this tip is equally applicable to the RSE editor in RDi or WDSC.

Here's our favorite way to get to the preference page we need. Take the Preferences... option from the Windows pull down menu in RSE. In the entry box at the top left of the resulting dialog page, key in "rpg" to find the relevant preferences. Select from the resulting list under Parsers (i5/OS in RDi or iSeries in WDSC) ILE RPG. This is illustrated in the screen shot, which shows the default preferences for editing RPG code.

Our favorite preferences here are related to Enter key behavior and User defined tabs. When maintaining existing code, especially, the "Automatic closure of control block" feature seems to get in the way, so we typically like to turn that off. We often also turn off "Repeat previous specification type" as well. Now pressing Enter in RPG will simply insert a blank line and position the cursor there.

The ability to set your own tab stops in the RPG editor is a great time saver. Simply check the "User defined tabs" box and then select "C: Calculation" to get an idea of what we mean. To customize the tab positions, simply change the positions of and/or remove the tab markers ("^" characters).

For the standard C spec, for example, we remove the tab stops for the level break and conditioning indicators as well as for Factor 1.We rarely use Factor 1, so it saves many keystrokes to eliminate all those. We also always remove the Len and Hi, Lo and Eq tab stops because they are just so RPG/400!

Question: What tab stops do we customize for our D specs?

Answer: Navigate your way to the ILE RPG preferences under parsers (see earlier tip on customizing your RPG editor for details.) Select the "User Defined Tabs" check box. Then select the Definition spec. As with the C spec, each tab position is marked by a ^ symbol (aka a "hat" or "caret" to most of us). Now you can set up your own custom tabs by positioning the ^s in the right spots.

The image below shows what we like to do with our D spec tabs. We'll explain the reasons why we like these settings.

  1. The first tab stop after the "D" is at the second character in the name area. Just because the RPG IV language doesn't require that we leave a blank between the D and the field name is no reason why we should code it that way. If we do, then the variable names look really horrible because they all start with D! (For example DcustNum, DdiscountCode, Daddress, etc.) So we always start the name in the second position.
  2. You may want to keep the tab position in the "Ds" position for coding your DS, S, PR or PI lines. We find that we spend more time defining fields within Data Structures or parameters within prototypes, so our next tab stop is at field length. Since most field lengths will be either 1 or 2 digits, the tab stop is at the second to last position to minimize spacing. In this case, when defining a Stand-alone variable or a DS or PR, we simply use the mouse to position the cursor.
  3. Our next stop is at the second position of the decimal places area (when was the last time you defined a field with more than 9 decimals?)
  4. The keywords area is next, followed by Comments - although we rarely use that area, preferring to use line comments instead.
Once the changes have been made all that remains is to push the "Apply" button and you are done. When you return to your edit window the new tabs will be immediately in force.

Question: Are there tab stops for /Free C spec?

Answer: Since the only specific column requirement for /Free specs is that your code be between positions 8 and 80, the primary tab stops that are needed here are to get to column 8 (or whatever column you prefer to use as your leftmost column) and thereafter at every n number of columns, based on how far you want to indent your nested logic.

To do this, navigate your way to the ILE RPG preferences under parsers (see earlier tip on customizing your RPG editor for details.) Select the "User Defined Tabs" check box. Then select the Calculation, Free-form spec from the pull down menu.

For some reason, the default settings seem to be at column 6 (which doesn't seem logical, since nothing can go in this column in /Free format) and at column 8 (the first valid column for /Free format logic) and then every 2 columns after that (note the "And every" box below the columnar tab stops. We prefer to indent our logic a little more than 2 columns, so we like to change this to 3. You would, of course, choose the number that you prefer to use for your logic indentation.

Press "Apply" and go back to the editor to use your new tab stops.

Question: How does automatic indent work for /Free logic?

Answer: The tip above talked about how to set tabs when you want to do your indentation using the tab key. However, there is also a setting in the preferences for Automatic indent. By default, this is turned on. You should note that if you chose to de-select "Repeat previous spec type" then the option to use automatic indentation in /Free logic is disabled, along with many other options. See the tip below about "why don't I have the option for automatic indentation available?" for more details on this idiosyncrasy.

Automatic indentation impacts /Free form logic that is coded within a code block - that is, logic between If and EndIf or DoW and EndDo, for example. If automatic indentation is turned on, then after coding the beginning of a block (e.g., an If statement) the cursor will be positioned on the next line at a location indented the appropriate number of characters to the right of the If. The "appropriate number" is 2 by default, but you can change that by using the Blanks box to the right side of this preference.

Question: I like the automatic closure of control block, but want to customize how it works. Can I do that?

Answer: Automatic closure of control block means that when you code a statement that requires an End operation (think If, Do, For, etc.) the editor will automatically insert a blank line followed by another line with the appropriate type of End operation (e.g., EndIf, EndDo, etc.). It then positions the cursor at the appropriate spot in the blank line for you to code the logic for the block.

When writing new code, we also find the automatic closure of control block useful, but we find when maintaining code, it tends to get in the way. You can make up your mind whether you like this preference turned on or off. If you decide to keep it on, then you should also choose which flavor of Endxx operation you want. The options have to do with how much, if any, of the Endxx operation should be capitalized. The default is to put it in all caps. But you may choose from the pull down menu which Style of end operation you prefer. Note that the horrible old-RPG/400-style of simply "END" with no xx on the end is not available. Hurray!

Note that you should pay attention to where you want your cursor positioned on that blank line when using this feature. If you're coding in /Free form, then you probably want to make sure that Automatic indent is also selected (which it is by default.) If you are not coding /Free form logic, you may want to also turn on "Set C specification cursor position" and position it to the OpCode column (not the default). Otherwise, the cursor is positioned in column 7 - a place you almost certainly don't want!

Question: Why don't I have the option for automatic indentation available?

Answer: If you choose to de-select "Repeat previous spec type" then the option to use many other features is disabled. Disabling the next 4 options makes sense, but it doesn't seem logical to us that choosing to not repeat the previous spec type should turn off automatic indentation in /Free form or automatic closure of control block, but it does. So if you code in both /Free form and in fixed form, you'll have to put up with repeating the previous spec type in your fixed form logic (a feature we prefer to turn off normally) if you want the other 2 features active. If you code only in /Free form, then the Repeat previous spec type option doesn't really have any impact in the logic part of the program.

The Outline View - SiD's Favorite RSE Feature

We would like to introduce you to our favorite RSE feature ... The Outline view!

The Outline view gives you a complete overview of your program. It provides details of every field, file, record format, prototype, subroutine and subprocedure in your program. All fields are listed, including their definitions as shown in the screen shot below.

The numbers beneath the field name identify the lines where the item in question is referenced. References marked with an (M) identify the lines in the logic where the field is modified. Even better is the fact that if you click on an item in the list (as we have done in the example) the editor is instantly positioned on the relevant code.

For more detail on this fantastic feature, check out the answers to the questions below by clicking on the :

Question: My Outline view is empty. How do I populate it?

Answer: If you are editing an RPGLE source member, the text in your Outline view probably says "Press Refresh to update view". Of course, that begs the question "What's Refresh?" The Refresh button looks like 2 small yellow arrows chasing each other in a circle.
In the Outline view it appears near the upper right hand corner of the view. Pressing this button will populate your Outline view. You'll want to remember this button because you'll also need to use it after you have made changes to the source member to refresh the information in the Outline view.

If you are editing a DDS source member, the Outline view is populated automatically. You need only to expand the + sign to see the record(s) and fields. If you are editing a CLP member or an RPG member (not RPGLE) then you will only see labels (in CL) and subroutines (in RPG). For COBOL source members, the Outline view contains some (not all levels) of your data definitions and your paragraph names. Clearly, Outline view is most useful for the RPGLE language.

Question: Why doesn't my Outline view appear in my workbench?

Answer: If you're working with the default version of the RSE perspective, the most common reason for this is that you have closed it, perhaps by mistake. It's easy to do - we still manage to accidentally close it from time to time - usually by pressing the X in the tab at the top of the view. We often make this mistake when we have been looking at the Outline view in full screen mode (i.e. after double clicking on the tab to make the view go into full screen mode).

Now you're probably wondering how to get it back. There are 2 ways. One requires a bit more work but tends to be more disruptive. Let's look at both.
  1. The easiest way is to use the Reset Perspective option from the Window pull-down menu in the workbench. However, this will reset all the views in the perspective to their original or last saved state, so if you have made some views Fast Views (see below for what that means) or if you have changed the sizes or positions of the views in your workbench, you'll lose all that kind of customization.
  2. The less disruptive way, although it requires a little more work, is to use the Show View option from the Window pull down menu. This leads to another menu where you should take the Other option. Then key Outline into the text box at the top of the Show View dialog window. This should highlight the Outline view in the list. Press OK and your Outline view will reappear. Alternatively, rather than use the text box you can simply expand the General category in the dialog window to locate the Outline view.

Question: How can I see my Outline view while editing a source member in full-screen Editor mode?

Answer: There are multiple ways, but probably the simplest way is to make the Outline view a Fast View. If you have not used Fast Views before, you are in for a treat. Almost any view in the workbench can be made a Fast View, but we find it particularly useful for the Outline view. To do this right click anywhere on the bar at the top of the view (i.e. click on or just to the right of the tab at the top of the view) and select Fast View.
By default, that will "park" the view in the bottom left margin of the perspective - which is probably not where you want it since every time it pops-up it will overlay the left-hand side of the edit window, covering most of your code. For most people, the best place to park it is on the right hand side of the perspective where it will only overlay the (mostly empty) right-hand side of your source window. To do this, hover your cursor over the small gray dots just in front of the Fast View icons in the lower margin until the cursor turns into a 4-headed arrow, as shown here:
At this point, you can right click and from the pop-up menu select Dock on -> Right or you can simply drag the Fast View icons to the top right margin. All Fast Views must be docked in the same location - i.e., you can't have Outline docked on the right and your Error List Fast View docked on the bottom. However, you can choose the orientation (horizontal or vertical) for each. Read on for more details.

To use the Outline view, click its Fast View icon, and it will pop out. You only need to click somewhere in the edit window to make it pop back in again. Don't click the X on the tab in the Outline view or you will close the view completely. Not to worry if you do that by accident, though - just see the answer to the earlier question above to get it back.

As we said earlier, almost any view can be made a Fast View. Some of the others that we find particularly useful as Fast Views include the iSeries Error List, iSeries Indent and, for those who still find the need for prompting while in the editor, the iSeries Source Prompter. (We have happily replaced prompting 99% of the time by using the tab key plus the cursor-oriented format line in the editor.) All of those views work better in a horizontal orientation. To change the orientation of a Fast View, simply right click on its Fast View icon and use the Orientation option.

Once you get a nice set of Fast Views that work well for your style of development, you may want to create your own perspective. To do this use the Window pull-down menu and choose Save Perspective As . . . supplying your own perspective name. Once you have done this you can now make use of the Reset Perspective option discussed above to bring back any views that you may have closed accidentally.
Home | Conferences | About Us | System i Community | Privacy Policy | Legal Notices | Email Webmaster | Contact
System i Developer,LLC © 2010