Exercise 3.14: Checking syntax

Before you begin, you must complete Exercise 3.13: Comparing files in the CODE Editor (optional).

One of the powerful features that the LPEX Editor shares with SEU is its ability to syntax check your source. Syntax checking can be done either when the cursor leaves each line of source or all at once on either the currently selected source or on the entire source member.

Now you will create a syntax error and watch for the prompt to correct it.

To syntax check the file:

  1. In the PAYROLL Editor window move the cursor to line 211 which contains EXSR ACDESR.

    You might already be on that line but if not, type the line number in the sequence number column, or scroll down.

  2. Append an X to the EXSR op-code to make it EXSRX.
  3. Move the cursor off of the line.

    An error message appears to draw attention to the error.
    Editor window with syntax error

  4. Move the cursor onto the pink error message.
  5. Press F1.
    Second level help for syntax error

    This opens a window with second level help for the error.

  6. Minimize the Help window.
  7. Change EXSRX to EXSR to correct the error. (Similarly, you can use Edit > Undo to correct this).
  8. Move the cursor off the line you just fixed.

    The error message is automatically removed from the editor.

    Tip: You can toggle automatic syntax checking. Click Window > Preferences from the workbench menu and then expand Remote Systems, iSeries, LPEX Editor Parsers and select the language you want to change the settings for in the left pane of the Preferences window, select the Automatic syntax checking check box and then click OK.

    Tip: You can syntax check the whole source member currently in the editor by clicking Source > Syntax Check All.
    Preferences window to turn syntax checking on or off

Now you are ready to review your knowledge of this module by taking the quiz. You can also apply what you have learned in this module by completing the practice tasks detailed in More practice.

Quiz

  1. When column sensitive editing is selected:
    1. Each column is considered a separate entry space
    2. If you are inserting or deleting characters into a string that is in the Factor 2 entry, the result field entry does not move
    3. The default editor preference is that column sensitive editing is off
    4. All of the above
  2. The LPEX Editor has predefined settings, but also has an associated preference page containing settings that you can define. (T, F)
  3. LPEX Editor preferences are set in the:
    1. Preferences window
    2. Editor window
    3. New wizard
    4. Remote Systems view
  4. You can configure the LPEX Editor to adopt the keyboard and command personalities of many popular editors. (T, F)
  5. If you want to undo a set of changes made to a file you must use the _______ operation. Name the operation.
    1. Insert
    2. Replace
    3. Redo
    4. Undo
  6. You can also cancel the effects of an undo operation by using the _______ operation. Name the operation.
    1. Insert
    2. Replace
    3. Redo
    4. Undo
  7. This help is invaluable if you cannot remember the order of fields in an RPG specification or the allowed values for a variable field. Name the help. Choose the best answer.
    1. Context sensitive help
    2. Language sensitive help
    3. Display help
    4. Field help
  8. To receive language sensitive help, press the ____ key in an Editor window. Name the key:
    1. F2
    2. F3
    3. F1
    4. F4
  9. If the cursor is ________ an operation code, you receive help for that operation code; otherwise, you receive help for the current specification.
    1. before
    2. after
    3. on
    4. off
  10. Instead of entering or changing code directly in the Editor window, you can use ________.
    1. Prompts
    2. Filters
    3. SEU commands
    4. Format line
    5. All of the above
  11. The ______ view allows you to see your source with constructs in an indented mode. By default, the ________ view will show the indented view in the bottom pane.
    1. Outdent
    2. iSeries Indent
    3. Edit
  12. The iSeries Indent view is browse mode only and cannot be edited. (T, F)
  13. You use the _______ window to search for an item in the current source. Choose the best answer.
    1. Search
    2. Find
    3. Edit
    4. Find/Replace
  14. You can search for:
    1. A word
    2. A partial word
    3. A sequence of words
    4. A pattern if it follows the rules of regular expression
    5. All of the above
  15. The LPEX Editor allows you to ____ or subset your source so that you see only lines containing a given string.
    1. search
    2. find
    3. sort
    4. filter
  16. To help you navigate quickly through your ILE RPG source the editor allows you to filter lines based on the _________. Choose the best answer.
    1. string
    2. line type
    3. both
  17. If you would like to search through the members in a source physical file or through the files in a local directory, you can use the _______ tool. Choose the best answer.
    1. Compare
    2. Search
    3. Find
    4. Edit
  18. The ________ tool allows you to compare different versions of a program and find the differences. Choose the best answer.
    1. Convert
    2. Migrate
    3. Compare
    4. Search
  19. There are two ways to compare files. They are Compare tool in the workbench and the Compare tool in the CODE Editor. (T, F)
  20. Syntax checking can be done either when the cursor leaves each line of source or all at once on either the currently selected source or on the entire source member. (T, F)

More practice

Given your experience using the Remote Systems LPEX Editor, try these new tasks: Check out how token highlighting works in your ILE RPG source. Display a format line and use it to enter your source. Filter source by comments. Set auto-uppercase on. Use the product online help to assist you in these tasks.

Module recap

You have completed Module 3. Editing source. You have learned how to:

Now that you have mastered editing source, you can move on to verifying your source to ensure you have a clean compile on the iSeries system. This approach saves you iSeries cycles! And you perform both verify and compile from the Remote Systems view! Continue to Module 4. Verifying and compiling source.