Editing RPG, COBOL, CL, C, C++, and DDS members

About this task

Use the Remote Systems LPEX editor to edit your source members. This editor has many exciting and popular features offered for RPG, COBOL, CL, and DDS source, such as syntax checking, automatic uppercasing, program verification, and so on.
Note: To graphically design and modify DDS display files, you can also use Screen Designer, for DDS printer files you can use Report Designer. For more information on this, see Designing screens and reports.

In the help contents, expand LPEX editor for information on how to use all the features that are now also available in the Remote Systems LPEX editor, such as Editor commands, actions, and parameters and Entering and editing text.

Tip: You can switch between files you have open in the Editor view by pressing Ctrl+F6.
Restriction: The Remote Systems LPEX editor does not support the editing of source members from the QTEMP library.

To open a member in the Remote Systems LPEX editor:

Procedure

  1. Expand your connection in the Remote Systems view until you find the member you want to edit.
  2. Double-click the member, or right-click the member and select Open With > Remote Systems LPEX Editor.

What to do next

Tip: To open IBM® i members quickly, you can use the keyboard shortcut Ctrl+Shift+A, or right-click Objects and select Open Member, without the need to drill down through your Objects subsystem to find the member. For more information, see Fast Open for IBM i members.

See the instructions below, and the links to preference page information, for information on common tasks you can perform with the Remote Systems LPEX editor, such as compiling and verification. Many of these options are available from the pop-up menu in the editor, or from the Source, Compile, and Edit workbench menu items.

Frequent tasks you can perform with the Remote Systems LPEX editor:

To save a source member in the Remote Systems LPEX editor:

Autosave while editing: To enable or disable autosave while editing in the Remote Systems LPEX editor, you need to change an editor preference. From the Remote Systems view, click the drop-down menu and select Preferences > Remote Systems LPEX Editor. In the preference window, select the Autosave check box. The default value for Minutes between saves is set to 5. You can specify a value between 1 and 60 minutes. If the workbench closes unexpectedly while you are editing a file, restart the workbench and reopen the file you were editing. If there is a backup of that file, you will be prompted to open it for editing.

If you select Save All in the LPEX Remote Systems Editor, all open source members are saved sequentially, saving each source member at a time.

If you select Save As in the LPEX Remote Systems Editor, you can save the open source member to a different remote source member. You can either save as a new source member and the newly created source member is created or save to an existing source member and overwrite its content.

New member saving preferences have been added to the existing Objects Subsystem preference page. Select Remote Systems > IBM i > Objects Subsystem. The new member save behavior preferences allow you to define what save behavior to use:
  • Save directly to original member: Indicates that a member should be saved directly back to the original member.
  • Save to a temporary member and then copy to original member: Indicates that a member should be saved first to a temporary member on the remote server and then copied on top of the original member. A temporary file member will be created to store the uploaded content and then deleted immediately after the uploaded content is copied successfully to the original source member. The temporary file member will be created in the same library and source physical file as the original source member. Each temporary file member will be given a random name which consists of a prefix "RSE" and 7 random digits, such as RSE3670981. This protects the original source member from being corrupted in cases where the network connection drops during the save operation.

Source prompting: If you are using the Remote Systems LPEX editor, you might find editing easier with the source prompter. To invoke the source prompter, click anywhere inside your file and press F4. You can also click Source > Prompt from the workbench menu.

Refreshing the editor: To remove error messages from your source, you can perform a Refresh from the workbench menu by clicking Source > Refresh. You can also press Ctrl+F5 to refresh the editor.

Comparing files: To compare a currently opened member to another member, click Edit > Compare > Compare from the menu bar. You can also select two items in the Remote Systems view by holding down the Ctrl key and clicking the two items. Right-click and select Compare With > Each Other. Both members will be invoked side by side, with changes highlighted.

Keyboard shortcuts: Use the following keyboard shortcuts while editing text.
  • Alt+L: to select a single line or block of lines
  • Alt+C: to copy
  • Alt+M: to move
  • Alt+D: to delete selected lines
  • Alt+U: to deselect all lines
  • F1: to invoke language sensitive help
  • F3: to open an ILE RPG subroutine or procedure declaration
  • F4: to invoke source prompting
  • Ctrl+Shift+C: to compile
  • Ctrl+Shift+D: to select Find other menu and Find date
  • Ctrl+F5: to refresh the source and remove the show line error messages
  • Ctrl+Shift+F5: to refresh the Outline view
  • Ctrl+/: to comment the selected block of source
  • Ctrl+\: to uncomment the selected block of source
  • Ctrl+M: to select a block of source
  • Ctrl+Shift+M: to jump to the other end of a block of source
  • Ctrl+Shift+O: to show block nesting
  • Ctrl+Shift+V: to verify
    • After verification, select Ctrl+. to go to the next problem, and Ctrl+, to go to the previous problem.
Tip: The editor findNext and findPrevious actions, menu items, and keys will be "smart" so that if the last find was for a date, then the next will be for a date. If the find was for text, then the next find will be for text.
See also Editor profiles for more information on LPEX editor key combinations.

Opening a declaration: To open a declaration in an ILE RPG file, place your cursor in a selected word or piece of text and press F3. The editor will search for a declaration with that name in your current source, and reposition the cursor to its location. You can also select Source > Open Declaration on the popup menu to invoke the action.

Notes:
  • Searches are based on the position of the cursor. For example, if selected text spans more than one reference, the search is based on the cursor position.
  • If the search does not find a declaration, the cursor is not repositioned and you can continue editing as normal.

Retrieving content from a remote file: To insert the contents of a remote member into the currently opened member, click File > Get File. In the dialog box, browse through your directories using the tree view structure. Select the file you want to insert and click OK.

Launching context-sensitive help: While you are editing your source, you can press F1 at any time, with your cursor on a keyword, for context-sensitive help on the keyword.

Line selection: To select a line of source, place your cursor at the location of the line you want to select. Then, right-click and select Select line. You can then right-click again and perform actions such as Syntax Check Selection, Convert Selection To Free-Form, Cut, Copy, and so on.
Note: The Highlight Current Line option is located on the Controls page for the LPEX Editor preferences. To open the Preferences window select the Window > Preferences menu item. On the Preferences window, select LPEX Editor > Controls. The Highlight Current Line option is selected by default. To change the highlight color for the current line, select Appearance under LPEX Editor, click currentLine under Styles, and click the button beside Background to open the Color palette. After you select a new color click OK to close the Color palette, then click OK in the Preferences window to apply the change. For more information about the highlightCurrentLine option, see Editor parameters and click highlightCurrentLine in the list of parameter names.

Showing the date area: To make the Remote Systems LPEX editor display the date area in your source, you need to change an editor preference. From the Remote Systems view, click the drop-down menu and select Preferences > Remote Systems LPEX Editor. In the preference window, select the Show date area check box. You can also right-click while the cursor is in your source and select Source > Show date area in the popup menu.

Syntax checking:

To perform syntax checking, from the Source menu or the pop-up menu (with your cursor in the source), select Syntax Check Line or Syntax Check All. Syntax checking is enabled to run automatically every time you move off an edited or inserted line. To view the details of syntax error messages, place the cursor on the message and press F1.
  • To disable or re-enable automatic syntax checking, click the drop-down menu from the Remote Systems view and select Preferences > Remote Systems > Remote Systems LPEX Editor > i Parsers. In the preference window, on the left side, there are entries for CL, COBOL, DDS, ILE RPG, and RPG/400®. For each type of source member, you can specify whether or not you want to enable automatic syntax checking. For example, click CL on the left side of the window, and select or clear the Automatic syntax checking check box in the preferences area.
  • Syntax checking is also performed for SQLRPGLE and SQLCBLLE file types with embedded SQL statements. This kind of syntax checking, however, requires a live connection to a remote IBM i server, since the SQL statements are syntax checked on the host. To disable automatic syntax checking of SQL statements, click the drop-down menu from the Remote Systems view and select Preferences > Remote Systems LPEX Editor > i Parsers, and note the entries for COBOL and ILE RPG. Click either of these entries and clear the check box for Automatic syntax checking of SQL statements (performed on the server).

Prefix commands: To use prefix commands such as P, I, DD/DD, and so on, click inside the left-most column that displays numbers such as 000014, type the command, and press Enter. See the related links, and language reference documents for a list of the prefix commands available for each language. See also SEU base profile for more information of SEU prefix commands.

Automatic uppercasing: To make the Remote Systems LPEX editor automatically convert your source from lowercase to uppercase while you are editing, you need to change an editor preference. From the Remote Systems view, click the drop-down menu and select Preferences > Remote Systems LPEX Editor > i Parsers. In the preference window, on the left side, there are entries for CL, COBOL, DDS, ILE RPG, and RPG/400. For each type of source member, you can specify whether or not you want to enable automatic uppercasing. For example, click CL on the left side of the window, and select the Automatic uppercasing check box in the preferences area.

Automatic indenting: To make the Remote Systems LPEX editor automatically indent your source while you are editing, you need to change an editor preference. From the Remote Systems view, click the drop-down menu and select Preferences > Remote Systems LPEX Editor > i Parsers. In the preference window, on the left side, there are entries for CL, COBOL, DDS, ILE RPG, and RPG/400. For ILE RPG and CL, you can specify whether or not you want to enable automatic indenting, and how many spaces you want the source to be indented (when you press Enter). For example, click ILE RPG on the left side of the window, and select the Automatic indent check box on the right side of the window. Then, you can also specify the number of spaces to indent in the Blanks (1-20) field.

User-defined tabbing: You can adjust how your source is tabbed while you are editing, by customizing the user-defined tabbing. This option is available as a Remote Systems LPEX Editor parser preference. To customize user-defined tabbing:
  1. From the Remote Systems view, click the drop-down menu and select Preferences > Remote Systems LPEX Editor > i Parsers. In the preference window, on the left side, there are entries for CL, COBOL, DDS, ILE RPG, and RPG/400. You can specify user-defined tabbing for all of these types of source except DDS.
  2. Select one of the applicable types of source, and select the User defined tabs check box.
  3. If applicable, change the tabbing schema from the drop-down box.
  4. Position your mouse in the tabbing area (with the ^ marks) and double-click to add or remove a tab. In the And every field, you can also specify the frequency to add tabs after the last selection.

Customizing the Enter key: When editing ILE or non-ILE (OPM) RPG source, you can control the behavior of the Enter key, in that you can change the action that results when you press Enter. By default, pressing Enter repeats the previous specification type in your source. However, you can change this behavior to repeat the previous operation code if you are editing a C-specification, or to move the cursor to a specific column, and so on. To control this behavior, you need to access the editor preferences. From the Remote Systems view, click the drop-down menu and select Preferences > Remote Systems LPEX Editor > i Parsers. Select ILE RPG and then modify any of the entries on the right side of the window underneath Enter key behavior.

Specifying a format line for your source: While editing ILE or non-ILE (OPM) RPG source, you can select a specific format line for lines in your source. The format line, which appears at the top of the editor, indicates where the statement columns should be. To select a line format:
  • Right-click with your cursor in the specified line and select Select line.
  • From the workbench menu, select Source > Select format line.
  • Select a format line from the drop-down list in the dialog box, and click OK.

Opening /COPY and copy book members; Opening /INCLUDE for CL members: Your source might contain /copy, copy book statements, or /include which indicate that code from another source member is to be included when the current member is compiled. For example, a /copy or /include statement could point to a procedure that exists in another source member. These /copy members and /include members enable you to share code among your source members. In the Remote Systems LPEX editor, you can open the /copy, copy book members, or /include CL member for browsing or editing.
  • For RPG source, with your source member open in the editor, place your cursor at the location of the /copy statement. From the workbench menu, select Source > /COPY member > Edit, to edit the source member (and lock it on the IBM i server) or Source > /COPY member > Browse just to open the source member for viewing.
  • For COBOL source, place your cursor at the location of the copy book statement. From the workbench menu, select Source > Copy Book > Edit, to edit the source member (and lock it on the IBM i server) or Source > Copy Book > Browse just to open the source member for viewing.
  • For CL source, with your source member open in the editor, place your cursor at the location of the /include statement. From the workbench menu, select Source > /INCLUDE member > Browse just to open the source member for viewing.
  • If the referenced member cannot be found and no library name was specified, add the library that contains the member to the library list for the host connection.

    To modify the library list for the current session, go to the Remote System Explorer view. Under the Objects subsystem for the connection, select the Library List node and right-click to open the context menu. Select the Add Library List action.

    The initial library list for the connection can also be set for subsequent sessions by opening the properties for the connection or Object subsystem and modifying the Initial Library List settings.

Filtering by line types: Your source might contain many different kinds of line types, such as error lines, procedure lines, and so on. You can subset by these line types, in that, you filter out all other types of lines except for the one selected. In the example of ILE RPG source, to subset by line type, right-click while the cursor is inside your source, select Filter view and then select from one of the following choices:
  • Date
  • Code
  • Comments
  • Control
  • Procedures
  • SQL statements (are shown only if the source type is associated with the SQL parser)
  • Subroutines
  • Errors
(For different types of source, such as CL or DDS, these options are different.) Your source will now only show the lines of the type selected. To display all of your source again, select Show all from popup menu, or press Ctrl+W. You can also use the plus signs to the left of the filtered source to re-expand the source that is filtered out. The option to filter dates is available for any source with sequence numbers.

Showing externally described data information: If you have an externally described file in your source, you can display the fields for this file. Place your cursor at the location of the externally described file. From the workbench menu, click Source > Show fields. You can also right-click inside your source and select Show fields. The Field Table view then opens and displays the fields from the externally described file.
Tip: You can drag and drop an IBM i database or display file field from the Remote System Explorer's Field Table view onto an HTML or JSP file in page designer to create an IBM i Web Component Text Entry field. The new Text Entry field's name and data attributes will be inherited from the selected field.

Column-sensitive editing: You can enable column-sensitive editing for all RPG and DDS source. This means that your tabs are set up to move you to the defined columns, and as you type into one column, data in other columns is not shifted. To enable this preference, from the Remote Systems view, click the drop-down menu and select Preferences > Remote Systems LPEX Editor. In the preferences window, select the check box for Column sensitive editing.

Breakpoint support: You can set breakpoints in a section of executable code. To set a breakpoint, right-click and select Add breakpoint. When you debug your code, the debugger will stop at the breakpoints and let either step over or step into your code at that point, if there are any errors. See Breakpoints for more information.

File re-sequencing: File re-sequencing is a preference you can set for the Remote Systems LPEX editor. Your source members contain sequence numbers, similar to line numbers. If you have added or deleted lines of code while editing, you might want your files to be re-sequenced upon Save, so that there is no gap in the sequence numbers. To set this preference:
  • From the Remote Systems view, click the drop-down menu and select Preferences > Remote Systems LPEX Editor.
  • In the preferences window, select the check box for Resequence lines at save.
  • If applicable, alter the field for Resequence start at (1-9999) to specify what sequence number to begin with, and Resequence increment at (1-9999) to specify the increment of the sequence numbers from line to line, for example, if you enter 10 in this field, the sequence numbers could be as follows: 100, 110, 120, and so on.
To access the LPEX editor preference page, from the Remote Systems view, click the drop-down menu and select Preferences > LPEX editor. See Editor profiles for more information.

The asterisk (*) in the following table indicates supported features in the editor:
  ILE RPG and non-ILE RPG ILE COBOL and non-ILE COBOL CL, CMD, CLP, and CLLE DDS C and C++
Multiple view support * * * * *
Filter by line types * * * * *
Location bookmarks in source code * * * * *
Launching context-sensitive help (by pressing F1) and SEU help * * * * *
File re-sequencing (Available for all source with sequence numbers.) * * * * *
Prefix commands * * * * *
SEU key behavior * * * * *
Content assist * *      
Automatic source formatter     *    
Line selection * * * *  
Column-sensitive editing * *   *  
Breakpoint support * * *   *
Compiling (Available for all source types) * * * * *
Source prompting * * * *  
Syntax checking * * * *  
Automatic uppercasing * * * *  
Outline view * * * (for CLP, CLLE) *  
Show externally described data information * * *    
Open /COPY and COPYBOOK members; Open /INCLUDE member for CL * * *    
User-defined tabs * * *    
Customizable Enter key *        
Format lines *        
Template support * (only for ILE RPG) * (only for ILE COBOL)     * (only for C++)
Program verification * (only for ILE RPG) * * * (except for ICFF)  
Automatic indenting * (only for ILE RPG)   *    
Show block nesting * (only for ILE RPG)        
Hover help * (only for ILE RPG)        
Hyperlink * (only for ILE RPG)        
Conversion from fixed-form to free-form code * (only for ILE RPG)        
Creating an RPG procedure * (only for ILE RPG)        
Creating an RPG Java™ method call * (only for ILE RPG)        
Creating an RPG D-specification * (only for ILE RPG)        
Opening a subroutine or procedure declaration with F3 * (only for ILE RPG)        

Feedback