Editing[edit]

Editing Files[edit]

Editing sources is the main goal of any IDE. MiWorkplace is not different.

After you have created a connection, you can find any file and double-click it to open the editor. Depending on the file's extension (the language), we have additional support beyond just editing text. Varying from syntax coloring to code completion (CTRL+SPACE).

Miw sourceedit.png

Editor Key Bindings[edit]

F4 Prompt (CL and CMD)
ALT + ARROW UP Move line(s)
ALT + ARROW DOWN Move line(s) down
ALT + J Join lines
CTRL + + Increase Font (Zoom in)
CTRL + - Decrease Font (Zoom out)
CTRL + Space Content assist
CTRL + A Select all
CTRL + C Copy
CTRL + D Delete line
CTRL + E Execute Script (from Script Editor)
CTRL + ENTER Split a comment line.
CTRL + F Open Find / Replace Dialog
CTRL + K Find Next
CTRL + L Go to line
CTRL + P Print
CTRL + S Save
CTRL + V Paste
CTRL + X Cut
CTRL + Y Redo
CTRL + Z Undo
CTRL + SHIFT + C Compile
CTRL + SHIFT + D Duplicate line
CTRL + SHIFT + K Find Previous
CTRL + SHIFT + / Toggle Comment
DEL Delete character
SHIFT + ENTER Add new line at the end of the line
SHIFT + TAB Shift left
TAB Shift right

Templates and Snippets[edit]

Templates and snippets can boost your productivity by supplying you with some code snippets right at your fingertips (by pressing CTRL+Space in the editor).

Templates must be assigned a category (CL, RPG or Snippets). A template with the category CL will only be available in a CL editor (either QSYS or Stream File). Templates with the category Snippets are only available in the Snippets view.

Templates[edit]

Templates are small pieces of code that you can insert while editing text. Typically, templates are selected when pressing CTRL+SPACE. Just type the first few letters of the template and it will be selected:

Miw templcompletion.gif

Snippets[edit]

Snippets are larger pieces of code that can be inserted via the Snippets View

The Snippets view shows you all defined snippets. You will probably want to have your code skeletons for programs and procedures in that view for easily setting up and start the development of your new program.

Imiw snippets.png

Creating Templates and Snippets[edit]

Templates and snippets can be easily created in the preferences, see Main Menu → Window → Preferences → Editor → Templates.


Miw snip pref.png


Template Variables[edit]

Templates are not only static text but can also have variable content, variables. Template variables start with ${ and end with }. E.g.:

${description}

There are five special variables:

  • ${date} -- is resolved to the current date
  • ${user} -- is resolved to the current license user
  • ${cursor} -- this is the position where the cursor is placed after exiting the special editing mode
  • ${word_selection} -- is resolved to the currently selected text in the editor (it may span multiple lines)
  • ${line_selection} -- is resolved from the first character of the first line to the last character of the last line from the selected text

The template variables are placeholders that will be resolved to a value or will be placed into the source code as placeholders which the user can fill after inserting the template. After inserting the template the editor is switched to a special mode where the user can enter a value for each non-resolved placeholder. The TAB character is used to move to the next placeholder. ALT+TAB is used to move to the previous placeholder.

If a placeholder exists multiple times in a template all those occurrences are edited simultaneously.

Surround With Editor Support[edit]

The context menu of each editor has also the menu entry Surround With. Under this menu entry are the templates listed which contain either the variable ${word_selection} or ${line_selection} and from this menu entry can these templates be used.

Miw word template.png


Miw word compl.gif

Import / Export[edit]

The templates section in the Preferences dialog has buttons for importing and exporting templates. The templates are stored in a text file in XML format for an easy exchange of templates.

Templates are identified by their name. If a template is imported into an editor installation any existing template with this name will be replaced with the new one.

Outline View[edit]

The outline view provides an overview of the structure of your program. Depending on the language, the outline view may be more or less populated.


Miw outline.png


Clicking on an entry in the outline view will bring you to the line of that entry.

Import Code[edit]

Code can be very easily imported from an archive file to the IBM i server. MiWorkplace supports importing code to the QSYS filesystem or the IFS. The archive file must be in the ZIP format.


The import dialog is available by the menu entry "Import" in the context menu in the Remote Explorer. Either a library or a source file can be right-clicked for getting the "Import" menu entry in the context menu. If a library is selected a source file will be created by MiWorkplace. Depending on the content of the archive file it has either the name of the archived folder or SOURCES by default if the archive only contains files.

An import into a folder in the IFS will create the folder structure of the archive.

SEU Command Alternatives[edit]

In SEU you need to know many commands for an action, in a graphical editor (like MiWorkplace) things are done differently as you have more options like text selection or scrolling and paging up and down. And sometimes you don't have a direct equivalent to a key command but you can achieve the same goal on a different route.

Compile[edit]

PDM: Option 14

MiWorkplace: Right click on the member and select compile. Inside the editor press CTRL+SHIFT+C.

Prompt[edit]

SEU: F4

MiWorkplace: Place your cursor on the command and press F4.

Copy[edit]

SEU: C , Cn , CC

MiWorkplace: Select the text via the cursor (either mouse or keyboard). MiWorkplace also lets you copy parts of a line instead of the whole line. With CTRL+A you can select the whole code. CTRL+C copies the text to the clipboard.

Move[edit]

SEU: M, Mn, MM

MiWorkplace: Moving parts of the line can be achieved by selecting the text and then copying and removing the text in one move with CTRL+X. Then paste the code at the position you want with CTRL+V.

You can also move the lines up and down one or more lines. Just select the lines you want to move and press ALT+ARROW UP for move the selected line(s) one line up. The same goes for moving line(s) down with ALT+ARROW DOWN.

Duplicate lines[edit]

SEU: see Repeat

MiWorkplace: CTRL+SHIFT+D will duplicate the current line.

Delete[edit]

SEU: D, Dn, DD

MiWorkplace: CTRL+D deletes the current line. To delete only part of a line just use BACKSPACE or select the text and press DEL.

Find[edit]

SEU: FIND , F

MiWorkplace: Use the Find/Replace dialog, CTRL+F

Insert[edit]

SEU: I, In

MiWorkplace: ENTER puts a newline at the current cursor position. SHIFT+ENTER will put a newline at the end of the current line and thus adding a blank line one line below the current line.

Shift left/right[edit]

SEU: L, Ln, LLn

MiWorkplace: First select the lines you want to move. SHIFT will move all selected lines to the right by one identation (4 spaces, see preferences). SHIFT+TAB will shift the lines to the left by one indentation.

Overlay[edit]

SEU: O, On, OO

MiWorkplace: To replace a block of text with the text in the clipboard just select the text you want to replace and press CTRL+V to insert the text from the clipboard. The selected text will be replaced with the one from the clipboard.

Go to Start[edit]

SEU: TOP or enter line number 1

MiWorkplace: CTRL+POS1

Go to End[edit]

SEU: BOTTOM or enter last line number

MiWorkplace: CTRL+END

Go to specific line[edit]

SEU: n (enter line number)

MiWorkplace: CTRL+L opens a dialog where the target line number can be entered.

Save[edit]

SEU: SAVE

MiWorkplace: CTRL+S

Block Selection[edit]

The editor can also be put into block selection mode. The button is right to the editor tab title. You can now select a block of one or more columns and edit the text accordingly.

User Exits[edit]

Most user exits program are used to compose some lines of code like a template. MiWorkplace supports templates and snippets which will provide similar functionality. If you need more flexibility then take a look at the Script Editor.