Editing z/OS UNIX files

You can open a file in your z/OS® UNIX file system and edit the contents by using the z/OS Explorer. When your changes are complete, you can save the file if you are authorized to do so. You can also use the Save As action to save the changes with a different file name or file path.

To open a file for editing, locate the file in the z/OS UNIX files view, right-click and click Open. Alternatively, you can double-click the file. The file opens in an editor view.

Important: When you open a file for editing, z/OS Explorer places a copy of the file in your local workspace. When you save the file, z/OS Explorer replaces the file in the z/OS UNIX file system with the copy from your workspace. If the file in the file system has changed since z/OS Explorer took the copy, for example, another user has made and saved changes, the file in the file system is overwritten and the other user's changes are lost.

You can refresh the content of the file in your workspace at any time by pressing F5. This action synchronizes your copy with the server copy, but any local changes you have made and not saved are lost and will have to be reapplied. The refresh action is disabled if the file has unsaved edits to prevent you losing your changes.

When you first open the file for editing, the file opens in the editor view in the workbench edit area. The following screen capture shows an example file open in the editor view.

Example file open in the editor view.

The workbench status bar provides more details about the file. The status bar information for the previous example looks like the following screen capture. For example, the status bar information for the previous example shows that the file is writeable, the editor is in Insert mode, and the cursor is on line 4, column 22.

Example workbench status bar

Note: A z/OS UNIX file is shown as Writable even if the file permission is read-only. This is because you can make changes to the file in the editor, and then use the Save As action to save the file with a different file name or at a different location.

To display line numbers in the editor, right-click the gray vertical bar at the left-side of the view, then click Show Line numbers in the menu.

When you change a file, an asterisk is placed in front of the file name in the view tab: A screen capture of the view tab showing an asterisk in front of the file name.. The asterisk indicates that the file contents have changed but have not been saved.

The following editing actions are available from the Edit menu on the main menu for the workbench, or the right-click menu options in the view:
Table 1. Edit menu actions
Name Function Keyboard shortcut (Windows and Linux) Keyboard shortcut (OS X)
Undo typing Undo the last change in the editor Ctrl+Z cmd+Z
Redo Redo the previous change that was undone Ctrl+Y shift+cmd+Z
Cut Copies the currently selected text or element to the clipboard and removes the element. On elements, the remove is not performed before the clipboard is pasted. Ctrl+X cmd+X
Copy Copies the currently selected text or elements to the clipboard Ctrl+C cmd+C
Paste Paste the current content as text to the editor, or as a sibling or child element to the a currently selected element. Ctrl+V cmd+V
Delete Delete the current text or element selection. Delete key Delete key
Find Next Finds the next occurrence of the currently selected text. Ctrl+K cmd+K
Find Previous Finds the previous occurrence of the currently selected text. Ctrl+Shift+K shift+cmd+K
Incremental Find Next Starts the incremental find mode. After invocation, enter the search text. As you type the cursor moves to the character position after the cursor position that matches the text you type. The text you type is shown in the status bar. Ctrl+J cmd+J
Incremental Find Previous Starts the incremental find previous mode. After invocation, enter the search text. As you type the cursor moves to the character position before the cursor position that matches the text you type. Ctrl+Shift+J shift+cmd+J
Show Tooltip Description Not in use None None
Word Completion Proposes word completions for the current string based on all words found in any open editor. Alt+/ ctrl+.
Table 2. View context menu actions
Name Function Keyboard shortcut (Windows and Linux) Keyboard shortcut (OS X)
Undo typing Undo the last change in the editor Ctrl+Z cmd+Z
Revert File Revert the content of the current editor back to the content of the last saved file. Disabled if the editor does not contain unsaved changes.    
Save Save the content of the current editor. Disabled if the editor does not contain unsaved changes. Ctrl+S cmd+S
Save As Save the content of the current editor as a different file name, or at a different location. Disabled if the editor does not contain unsaved changes.    
Show In Not in use Alt+Shift+W  
Cut Copies the currently selected text or element to the clipboard and removes the element. On elements, the remove is not performed before the clipboard is pasted. Ctrl+X cmd+X
Copy Copies the currently selected text or elements to the clipboard Ctrl+C cmd+C
Paste Paste the current content as text to the editor, or as a sibling or child element to the a currently selected element. Ctrl+V cmd+V
When your edits are complete, save your changes:

To close the editor, click the Close icon Close icon in the editor view tab. If you try to close the editor with unsaved file changes, the Save Resource dialog is displayed so that you can choose whether to save your changes.