Exercise 2.6: Reviewing Remote System LPEX Editor features

Before you begin, you must complete Exercise 2.5: Opening a source member for edit.

Before you start, here are some useful tips on using the LPEX editor. Let's look at some of the features of the LPEX editor, so you can later easily find your way around and use them:

Highlighting specification fields

The LPEX editor highlights the Tokens (specification fields) of your RPG program source, providing a separate color for each, improving readability. When you make changes to a line, the token colors get updated only after you move your cursor off the line.

To see how token highlighting works:

  1. Move the cursor to a Calculation statement.
  2. Position the cursor to column 7 (right next to the C).
  3. Type an asterisk (*).
  4. Move the cursor off the line and watch what happens.

    The line where you typed the asterisk (*) becomes a comment line and its color changes accordingly.
    Token Highlighting

  5. Move the cursor back to column 7 and remove the asterisk (*).
  6. Move the cursor off that line of code and the statement is tokenized.

    The token highlighting changes to reflect that this is a non-commented C specification.

Displaying types of lines

Using the LPEX editor, it is possible to have only particular types of source lines displayed at a time.

To display types of lines:

  1. Right-click anywhere in the Editor window.
  2. Click Filter view on the pop-up menu.

    The menu items list the types of line selections that can be made.

  3. Click Comments.

    The Editor window now contains only those RPG statements that are comments.
    Show comments only

  4. Right-click anywhere in the Editor window.
  5. Click Show all on the pop-up menu.
    Show all

    All statements types are displayed. In addition, the choices in the pop-up menu can be used to include only control specifications, user subroutines, and procedures and others. The Filter Selection option under the Selected option in the Edit menu allows the selection of only those lines containing a particular selected character string.

Checking the syntax of a file

Syntax checking is available for RPG code, and by default will be active. The syntax of RPG code is checked automatically when a change is made to a line, and the cursor is moved off the line.

When errors are found, they are displayed following the statement with the error.

Keeping track of columns in a specification line

The format line is at the top of the Editor window, just above the first statement. A format line is used to help keep track of the columns in a particular specification line. The content of the format line can vary to reflect the particular type of specification being keyed such as F specs, C specs, D specs and so on.

To display a format line:

  1. Click a line or use the arrow keys and click the left mouse button to make a line active.

    The format line gets updated as a line gets focus.

    You can move the cursor right or left with the arrow keys to go from character to character, or with the Tab key to go from field to field. An indicator on the format line moves with the cursor to show in which column the cursor is positioned.
    Indicator moves with the cursor

    You can select a format line for any specification you want.

  2. Click Source from the Editor menu.
  3. Click Select Format Line on the pop-up menu.

    The Format Line Selection window opens.
    Format Line Selection window

    Now you can start and create the RPG program.

  4. Click OK.

You have highlighted tokens of your RPG source, shown only comment lines, shown all lines, displayed a format line and now you are ready to begin Exercise 2.7: Editing an RPG source member and creating a *PGM object.