EDITING FILES USING VEDIT

The editor that we will be using to edit our files is called VEDIT.   It is a text editor.   While you are in the lab you will be using this editor, however, if you are working in another location, make sure that you save your file in text format.  

Once a new file has been opened for editing, new lines must be inserted or added in order to type your program.   While editing, the possibility of typing errors exists and, therefore, there must also be a means for deleting and changing the contents of lines.

In this section we will work with manipulating text within a file.    The first portion will insert ten new lines.   We will then demonstrate how to add, delete, copy and move lines of text.    For practice, implement the instructions as the tutorial manual goes through the examples.   In order to be able to do this, log on to MVS.   Choose selection 1, create a new file, and name the new file TESTEDIT.JCL. The assumption will be made at the beginning of the MOVE and COPY instructions that the screen has been restored to the original ten lines of text.   Use the DELETE instruction to remove any additional lines and the INSERT instruction to restore any missing lines.   Make use of the ARROW keys to put the cursor in the proper location for changes.


HELPFUL HINTS:

  1. In order to view the menu bar at the top of the screen, press F10.   If you do not want the sub-menus to show automatically, use the RIGHT ARROW key to highlight the CONFIG title selection.   Use the DOWN ARROW until SCREEN DISPLAY is highlighted.   Press ENTER. This brings up another sub-menu.    Use the DOWN ARROW until ENABLE SUB-MENU PREVIEW is highlighted. Press ENTER.   Notice that it now says NO.   Press the ESCAPE key until the menu bar has disappeared.

  2. The keystroke combination of CTRL and C removes all menus.

  3. Use the ARROW keys to move the cursor around the screen.

  4. Press the PAGE UP key to view the previous screen of text within the file.

  5. Press the PAGE DOWN key to view the next screen of text within the file.

  6. Press the TAB key to advance to a preset tab position within each line.

  7. The F1 key brings up the help menu.

  8. There are several ways to accomplish each of the typical editing features.   You can use key stoke combinations, the mouse, or the menu.


INSERTING LINES

Whether beginning to edit a new file or adding lines to an existing file, the INSERT mode can be used.   The INSERT mode allows an unlimited number of lines to be added to a specific location in a file.    Press the INSERT key to toggle between the insert mode and the replacement mode.   Look at the upper right corner of the screen.   If you are in the INSERT mode it should say INS otherwise you are in the REPLACEMENT mode.


NEW FILES:

When beginning an edit session on a new file, make sure that you are in the INSERT mode and simply type.   It will allow you to type in as many lines as required.   End each line by pressing the ENTER key.


EXISTING FILES:

To add lines in previously existing text use the INSERT mode.   Position the cursor on the line in the file which immediately follows where the new lines are to be inserted.   This is done by (1) using the PAGE UP and PAGE DOWN keys to scroll to the proper line or (2) using the UP and DOWN ARROW keys to locate the desired line or (3) use the mouse to position the cursor on the appropriate line.   Press ENTER. This creates a blank line before the current line.   Move the cursor to the empty line and begin typing the additional lines of text.

TRY IT!

Type the following ten lines in the file TESTEDIT.JCL.

THIS IS LINE 1           
THIS IS LINE 2
THIS IS LINE 3
THIS IS LINE 4
THIS IS LINE 5
THIS IS LINE 6
THIS IS LINE 7
THIS IS LINE 8
THIS IS LINE 9
THIS IS LINE 10


DELETING LINES

There are two ways to delete lines of text.   One is to do a block delete and the other is to delete a single line of text.


LINE DELETE:

To delete a line of text, place the cursor on the line that you want to delete and press the CTRL key and the Y keys simultaneously.   This deletes the line.

If you change your mind and do not want to delete the line that was highlighted press the CTRL and U keys to undo.  


BLOCK DELETE:

It is also possible to delete more than one line at a time in this manner.   Put the cursor on the first line to be deleted. Press CTRL and L.   Notice the highlighting. Using the DOWN ARROW key move the cursor to the last line of the block of text to be deleted.   Notice that all of the lines between the first and last lines have become highlighted.   To delete the highlighted block press the SHIFT key and the DELETE key simultaneously.

If you change your mind and do not want to delete the block that is highlighted press the CTRL and U keys to undo.  

Now try this in your test file.   Delete lines 3, 4, 5, and 6.

THIS IS LINE 1
THIS IS LINE 2
THIS IS LINE 3 <== put cursor on this line and press CTRL L
THIS IS LINE 4
THIS IS LINE 5
THIS IS LINE 6 <== put cursor on this line and press SHIFT DELETE
THIS IS LINE 7
THIS IS LINE 8
THIS IS LINE 9
THIS IS LINE 10

The result should be:

THIS IS LINE 1
THIS IS LINE 2
THIS IS LINE 7
THIS IS LINE 8
THIS IS LINE 9
THIS IS LINE 10


RESTORE IT!

Using SHIFT INSERT, add back the original lines three through six.   You will need restore the file to its original contents in order to follow the next section.


AN ALTERNATE METHOD FOR BLOCK DELETING USING THE MENU:

Rather than have to remember all of the appropriate keystrokes you may want to use the menu system to guide you through the deleting process.

Put the cursor on the first line of the block to be deleted.   Press F10 to display the menu.   Use the RIGHT ARROW key to move to the BLOCK selection.   Press ENTER to bring up the sub-menu.    Use the DOWN ARROW key to highlight SET LINE MARKER.   Press ENTER. If you still see the main menu, press the ESC key until the main menu disappears.

Use the DOWN ARROW to find the end of the block that you want to delete.    Press F10 to display the main menu.   Use the LEFT ARROW key to move to the EDIT selection.   Press ENTER to display the sub-menu. Using the DOWN ARROW highlight the CUT TO SCRATCH PAD selection.   Press ENTER.   Notice that all of the highlighted lines in your text have been deleted.


USE THE MOUSE:

You can use the mouse to highlight the block of text that you want to delete.   Simply use the mouse to put the cursor on the first line of text to be deleted.   Press the left mouse button and hold it down while dragging the mouse downward.   Notice that the cursor will move down on the screen and highlight the lines that it encounters as it moves.

The menu bar can be displayed by moving the cursor to the top line of the screen using the mouse.   Click the left mouse button and the menu bar will appear.   You can use the mouse to put the cursor on the desired menu selection and then click the left mouse button.    Follow the menu directions given in the previous section to continue the deleting process but instead use the mouse to manipulate the menu instead of the ARROW keys and the ENTER key.


MOVING LINES

There are two ways to move lines of text.   One is to do a block move and the other is to move a single line of text.


LINE MOVE:

To move a line of text, place the cursor on the line that you want to move and press the CTRL key and the L key simultaneously.   This marks the line.   You should see the line become highlighted. Press the SHIFT and DELETE key simultaneously.   To move the highlighted line, position the cursor on the line following where the highlighted line is to go and press the SHIFT key and the INSERT key simultaneously.

If you change your mind and do not want to move the line that was highlighted press the CTRL and U keys as many times as needed to undo the move.


BLOCK MOVE:

It is also possible to move more than one line at a time in this manner.    Put the cursor on the first line to be moved.   Press CTRL and L. Notice the highlighting.   Using the down ARROW key move the cursor to the last line of the block of text to be moved.   Notice that all of the lines between the first and last lines have become highlighted.   To delete the highlighted block press the SHIFT key and the DELETE key simultaneously.    To move the previously highlighted block of lines, position the cursor on the line following where the block of lines is to go and press the SHIFT key and the INSERT key simultaneously.

If you change your mind and do not want to move the block, press the CTRL and U keys to undo.

NOW using the test file, move lines 3 through 7 so that they follow line 8.

THIS IS LINE 1
THIS IS LINE 2
THIS IS LINE 3 <== put cursor on this line and press CTRL L
THIS IS LINE 4
THIS IS LINE 5
THIS IS LINE 6 <== put cursor on this line and press SHIFT DELETE
THIS IS LINE 7
THIS IS LINE 8
THIS IS LINE 9
THIS IS LINE 10

The result should be:

THIS IS LINE 1
THIS IS LINE 2
THIS IS LINE 8
THIS IS LINE 3
THIS IS LINE 4
THIS IS LINE 5
THIS IS LINE 6
THIS IS LINE 7
THIS IS LINE 9
THIS IS LINE 10

Now move the block of lines back to its original position.  


AN ALTERNATE METHOD FOR BLOCK MOVING USING THE MENU:

Rather than have to remember all of the appropriate keystrokes you may want to use the menu system to guide you through the moving process.

Put the cursor on the first line of the block to be moved.   Press F10 to display the menu.   Use the RIGHT ARROW key to move to the BLOCK selection.   Press ENTER to bring up the sub-menu. Use the DOWN ARROW key to highlight SET LINE MARKER.   Press ENTER. If you still see the main menu, press the ESC key until the main menu disappears.

Use the DOWN ARROW to find the end of the block that you want to move.    Press F10 to display the main menu.   Use the LEFT ARROW key to move to the EDIT selection.   Press ENTER to display the sub-menu. Using the DOWN ARROW highlight the CUT TO SCRATCHPAD selection.   Press ENTER. Notice that all of the highlighted lines in your text have been deleted.

Now position the cursor on the line immediately following the place to insert the moved lines.   Press F10 to display the main menu. Use the RIGHT ARROW key to move to the EDIT selection.   Press ENTER to display the sub-menu.   Using the DOWN ARROW highlight the PASTE SCRATCHPAD selection.   Press ENTER. The previously deleted lines will now be inserted.


USE THE MOUSE:

You can use the mouse to highlight the block of text that you want to move.   Simply use the mouse to put the cursor on the first line of text to be moved.   Press the left mouse button and hold it down while dragging the mouse downward.   Notice that the cursor will move down on the screen and highlight the lines that it encounters as it moves.

The menu bar can be displayed by moving the cursor to the top line of the screen using the mouse.   Click the left mouse button and the menu bar will appear.   You can use the mouse to put the cursor on the desired menu selection and then click the left mouse button.   Follow the menu directions given in the previous section to continue the moving process but instead use the mouse to manipulate the menu rather than the ARROW keys and the ENTER key.


COPYING LINES

There are two ways to copy lines of text.   One is to do a block copy and the other is to copy a single line of text.


LINE COPY:

To copy a line of text, place the cursor on the line that you want to copy and press the CTRL key and the L key simultaneously.   This marks the line.   You should see the line become highlighted. Press the CTRL and INSERT key simultaneously.   To insert a copy of the highlighted line, position the cursor on the line following where the copy is to go and press the SHIFT key and the INSERT key simultaneously.

If you change your mind and do not want to copy the line that was highlighted press the CTRL and U key to undo.


BLOCK COPY:

It is also possible to copy more than one line at a time in this manner.    Put the cursor on the first line to be copied.   Press CTRL and L. Notice the highlighting.   Using the DOWN ARROW key move the cursor to the last line of the block of text to be copied.   Notice that all of the lines between the first and last lines have become highlighted.   To copy the highlighted block press the CTRL key and the INSERT key simultaneously.   To insert a copy of the highlighted block of lines, position the cursor on the line following where the highlighted line is to go and press the SHIFT key and the INSERT key simultaneously.

If you change your mind and do not want to insert a copy of the block that was highlighted press the CTRL and U keys to undo.

NOW using the test file, copy lines 2 through 4 so that a copy of these lines follows line 6.  

THIS IS LINE 1
THIS IS LINE 2 <== put cursor on this line and press CTRL L
THIS IS LINE 3
THIS IS LINE 4 <== put cursor on this line and press CTRL INSERT
THIS IS LINE 5
THIS IS LINE 6
THIS IS LINE 7 <== put cursor on this line and press SHIFT INSERT
THIS IS LINE 8
THIS IS LINE 9
THIS IS LINE 10

The result should be:

THIS IS LINE 1
THIS IS LINE 2
THIS IS LINE 3
THIS IS LINE 4
THIS IS LINE 5
THIS IS LINE 6
THIS IS LINE 2
THIS IS LINE 3      these lines have been added
THIS IS LINE 4
THIS IS LINE 7
THIS IS LINE 8
THIS IS LINE 9
THIS IS LINE 10


AN ALTERNATE METHOD FOR BLOCK COPYING USING THE MENU:

Rather than have to remember all of the appropriate keystrokes you may want to use the menu system to guide you through the coping process.

Put the cursor on the first line of the block to be copied.   Press F10 to display the menu.   Use the RIGHT ARROW key to move to the BLOCK selection.   Press ENTER to bring up the sub-menu. Use the DOWN ARROW key to highlight SET LINE MARKER.   Press ENTER. If you still see the main menu, press the ESC key until the main menu disappears.

Use the DOWN ARROW to find the end of the block that you want to copy.    Press F10 to display the main menu.   Use the LEFT ARROW key to move to the EDIT selection.   Press ENTER to display the sub-menu. Using the DOWN ARROW highlight the COPY TO SCRATCHPAD selection.   Press ENTER.

Now position the cursor on the line immediately following the place to insert the copied lines.   Press F10 to display the main menu. Use the RIGHT ARROW key to move to the EDIT selection.   Press ENTER to display the sub-menu.   Using the DOWN ARROW highlight the PASTE SCRATCHPAD selection.   Press ENTER. The previously copied lines will now be inserted.


USE THE MOUSE:

You can use the mouse to highlight the block of text that you want to copy.   Simply use the mouse to put the cursor on the first line of text to be copied.   Press the left mouse button and hold it down while dragging the mouse downward.   Notice that the cursor will move down on the screen and highlight the lines that it encounters as it moves.

The menu bar can be displayed by moving the cursor to the top line of the screen using the mouse.   Click the left mouse button and the menu bar will appear.   You can use the mouse to put the cursor on the desired menu selection and then click the left mouse button.    Follow the menu directions given in the previous section to continue the copying process but instead use the mouse to manipulate the menu instead of the ARROW keys and the ENTER key.


OPENING FILES

To open an exiting file during an edit session use the following directions.   Display the menu by pressing the F10 key. Choose the FILE selection.   From the sub-menu, use the DOWN ARROW to highlight the OPEN selection.   Press ENTER. This will bring up a box with a sub-menu. Within this box take the SAME BUFFER selection.   You will then be asked for the name of the file that you want to open.   Type the full name and path of the file to be opened.   Then press ENTER.


SAVING FILES

It is possible to save a file during an edit session.   Display the menu by pressing the F10 key.   Choose the FILE selection. From the sub-menu, use the DOWN ARROW to highlight the SAVE AS selection.   Press ENTER. This will bring up a box with the words ENTER FILENAME: in it.   Type the full name and path of the file to be saved.   Then press ENTER.

If the system already knows what file you are working on (either you opened it from the system or you have already saved it using SAVE AS) you do not always have to specify the file name before you save it.   Under the FILE selection is the SAVE AND CONTINUE selection.   Choose this selection to save the file under the current working file name.


SETTING TABS

Because many programming languages require different spacing and column requirements, it is advisable to set tabs.   Display the menu by pressing the F10 key.   Choose the CONFIG selection. From the sub-menu, use the DOWN ARROW to highlight the TAB STOPS selection.    Press ENTER. This will bring up a box for you to type the required tab stop column numbers.

Standard tabs:

COBOL: 8 12 16 20 24 NOTE: 8 and 12 are required the others are for indenting code for readability.

ASSEMBLER: 10 16 40 NOTE: 10 and 16 are required and 40 is for comments.


ENDING AN EDIT SESSION

There are several ways to end an edit session.  

  1. Press the ALT and X keys simultaneously.

  2. Display the menu by pressing the F10 key. Choose the FILE selection.   From the sub-menu, use the DOWN ARROW to highlight the EXIT selection.   Press ENTER.  

Using either of these methods to end an edit session will display a line at the top of the screen.   The purpose of this line is to ask if you want to save the file before exiting or to abandon any changes and exit.   Answer YES to save the file before exiting or answer NO to exit without saving.