3.7 Syntax Checking
When you enter source, you want
to identify and correct syntax errors as you enter the source. Automatic syntax checking
is, by default, turned on for ILE RPG source.
When automatic syntax checking is
turned on, the syntax of each line of source code is checked automatically when you make a
change to the line and move the cursor off of that line.
First, lets turn automatic syntax
checking off. Then lets insert some errors into the source and then use the syntax feature
to find these errors in the file.
Follow these steps:
- Select the Options
>Language editing and then deselect Syntax checking.
- Move the cursor to row 78, column
29.
- Check the ruler to make sure the
Editor is in Replace mode. Now, create an error by typing an X over the
character E in the word MOVE.
Move the cursor to row
122, column 64.
- Create an error by typing 10
in the length column for the MOVE function.
- Move the cursor to row 1. Select
the Actions menu bar choice, then select Syntax check file.
- Press Alt+N to
move your cursor to the first error in the file.
- Correct the error by typing the
character E back into the word MOVE.
- Move the cursor off the row you
just fixed. The error message remains.
- Press Alt+N to
move your cursor to the next error in the file.
- This error results because the Len
columns is not blank. To fix this error, remove the number 10 from the columns.
To see help for an error
message, place your cursor on an error message and press F1. This opens a
window with help for the error. Select Close from the system menu to
close the help window.
- Move the cursor off the row you
just fixed. The error message remains.
- Select Actions > Delete
messages to delete the messages from the file.
- Press Ctrl+S to
save and upload the changes to AS/400.
- Select the Options >
Language editing and then select Syntax checking. Automatic
syntax checking is now enabled.
- Click on
to indicate that you've done all the steps.
This completes Exercise 3. You should now be familiar
with the CODE Editor features such as prompts,format lines and syntax checking when
editing ILE RPG source.
Next you verify and compile the ILE RPG/400 source for the Customer Inquiry
application.
But before you do, we recommend you do the Quiz.