Be Content with Content Assist
February 14, 2007 Paul Tuohy
When you are editing a free-form RPG program or an ILE COBOL source, the RSE LPEX editor has a very nice feature called Content Assist. At first glance, Content Assist seems like a simple helpful feature but there is more to Content Assist than first meets the eye. This tech tip looks at the basic use of Content Assist, using Content Assist with subprocedures, and defining your own Templates for Content Assist. Basic Use Enter an operation code, keyword, or BIF followed by Ctrl+Space and the LPEX editor will display a pop-up window containing a list of valid code completions. Figure 1 shows the Content Assist for an entry of EVAL and for the %Replace BIF. Use your mouse to select the required format from the list and the code is inserted in your source–you just have to fill in the blanks.
Subprocedures But Content Assist goes beyond providing assistance with language elements. Figure 2 shows Content Assist listing all subprocedures that start with “GetHTML” and the definition of the parameters for the selected subprocedure (GetHTMLIFS in this example).
You can use Content Assist to “prompt” your own subprocedures. But, you must refresh the Outline view for this feature to be available; the editor has to get the definition of the prototypes from somewhere. Templates You can define your own templates for Content Assist. This means that you can have Content Assist fill in “standard code” for you.
To define a template select Window –> Preferences from the menu; then expand Remote
Figure 4 below shows the definition of a template containing standard code for the display and input of a screen format. You provide a unique name for the template (EXFMT_NORM), the context in which it is used (ILE RPG Free Form, ILE COBOL or CPP), a description and, of course, the content (the code you want inserted in the source member). This template uses the EXFMT operation to display and input a screen format, clears error indicators and checks for F3, F5 or F12 being pressed. The value of ${CURSOR} (those are curly brackets) indicates where the cursor is to be positioned when the code is inserted in the source member.
Figure 5 below shows the result of using Content Assist with an entered value of EXF (note that a complete name is not required) and selecting the EXFMT_NORM template. As required, the cursor is placed at the start of the screen format name.
That’s It Content Assist is a lot more than just a simplified help system for operation codes, keywords, and BIFs. It can also help you in using subprocedures and provide a means of implementing standard code formats. Paul Tuohy is CEO of ComCon, an iSeries consulting company, and is one of the co-founders of System i Developer, which hosts the RPG & DB2 Summit conferences. He is an award-winning speaker who also speaks regularly at COMMON conferences, and is the author of Re-engineering RPG Legacy Applications, The Programmers Guide to iSeries Navigator, and the self-study course called iSeries Navigator for Programmers. He can be reached at paul@systemideveloper.com.
|