Quick Guide to XEDIT

Document 180, UNET Tech Services
University of Maine System.

Introduction

CMS is an operating system for IBM mainframe computers. CMS users enter their e-mail, data and programs on terminals or microcomputers and store the information in disk files on the mainframe. The primary tool in CMS for doing this is XEDIT. XEDIT is a text editor (not a word processor).

This "Quick Guide" assumes a minimum familiarity with CMS. For more information on CMS please refer to "Using CMS."

Contents of this Document:

  • Starting XEDIT: the XEDIT Command
  • The XEDIT Screen
  • Moving through an Existing File
  • Editing a File: Some XEDIT Commands
  • Prefix Commands
  • Creating a New File
  • Making Changes
  • Leaving XEDIT
  • Using a PROFILE XEDIT File
  • More Information

  • Starting XEDIT: the XEDIT Command

    XEDIT can create a new file or work with an existing one. Each CMS disk file has a three-part name, consisting of a filename, a filetype and a filemode (abbreviated "fn ft fm"). In CMS commands the three parts are typed with spaces separating them. For example, you might have, or want to create, a file called:
      MYPROG PASCAL A
    

    Here, the filename (fn) is MYPROG. The filetype (ft) is PASCAL and the filemode (fm) is A. The filemode says that the file is stored on your private mainframe disk space. Don't confuse your mainframe disk space with disk space on your microcomputer!

    To begin editing a file, type the CMS command:

       XEDIT fn ft fm
    

    where "fn ft fm" is the file you want to work with. For example:
       XEDIT MYPROG PASCAL A
    
    Or, if you use the menus on the mainframe, select "Working with Files" and in that menu select either "XEDIT an existing file" or "XEDIT a new file." Enter the file's name (for a new file) or select it from the list if this is an existing file.

    Alternatively, if you use the "Filelist of personal files" entry in the menus, you can locate the file you want to edit in the list, use the TAB or arrow keys to place your cursor next to the file name in the list, and press the F11 key on your keyboard. This is the same as editing an existing file.

    If the file you specify does not already exist, XEDIT shows you on the screen that the "top of file" and the "end of file" have nothing between them. If the file already exists, XEDIT makes a working copy (leaving the original intact on disk), and displays the first few lines on your screen.

    XEDIT always sets up a working, temporary copy. Any changes you make to the working copy do not affect the permanent copy on disk until you specifically order XEDIT to store the working copy.

    Return to Contents.


    The XEDIT Screen

    When you start XEDIT, your screen is divided into four parts. Here is a picture of the XEDIT screen.
    1. At the top you see a line of information about the file, including its three part name. Immediately below that is a blank message line. If XEDIT needs to tell you something, it puts the message there. As you can see above, the file is called SAMPLE FILE A. It has 4 lines in it (size 4), the current line is line 0 (top of the file) and the lines have a maximum length of 80 characters (truncation length is 80).

    2. At the bottom on the right you see a status that says you are using XEDIT (in case you forget!). On the left is the command line: ====>
      To enter an XEDIT command, put your cursor at the arrow point (pressing the Enter or Return key will bring the cursor to the correct position), and type the command, then press Enter or return (see commands below). In the illustration above, the cursor is in the correct position on the command line.

    3. The middle part of the screen is the display area where the lines of the file are shown. The center line is highlighted and a "scale" line showing columns is put below it. The highlighted line is called the "current line" and many XEDIT commands perform operations relative to this line. In our example, the current line is the top of the file (line 0).

    4. Each line in the display area is prefixed by 5 equal signs. The equal signs are called the "prefix area." Certain XEDIT commands can be typed into the prefix area (see prefix commands below).

    Return to Contents.


    Moving through an Existing File

    When you edit an existing file that has more lines than will fit on the screen, you need to "move" down or up through the file. The lines you see at any one time in the display area are a "window" into the file. The window is defined by the highlighted current line. To move the window, you tell XEDIT to designate a different line as the current line. Please note that you can't make the window scroll by using the arrow keys, as happens in most word processors.

    XEDIT has many ways to move the current line. The easiest is to press your F8 key to move the window down one screen's worth, and the F7 to move up one screen.

    
    F8  - move down one screen.
    F7  - move up one screen.
    

    Return to Contents.


    Editing a File: Some XEDIT Commands

    You can always edit material in a file by retyping it. XEDIT is normally in so-called "overtype" mode, which simply means you can replace material by putting your cursor on it and typing over it. You can change to "insert" mode where you add NEW material rather than replacing letter by letter, by putting your cursor where you want to insert new text and pressing your insert key (for many keyboards this is the key marked "ins"). Pressing Enter or return exits from insert mode and puts you back into the normal overtype mode.

    In spite of this easy way of correcting material, you will still need XEDIT commands for many purposes. There are two kinds of commands: regular ones typed on the command line (see below in this section) and prefix commands (see next section).

    Regular (non-prefix) commands are always typed with the cursor at the point of the command line arrow in the bottom left. If your cursor is not already there, press the Enter or return key to move it. Always end a command by pressing Enter or return. Here are some XEDIT commands:

    TOP
    Makes the current line be the top of the file.
    BOTTOM
    Makes the last line of the file be current.
    LOCATE
    Searches the file for something. Example:
    LOCATE /xyz
    This searches each line following the current line for the letters "xyz" (the / is not part of the search string). The first line found containing "xyz" becomes the new current line.
    CHANGE
    Make a change in the current line. You must tell XEDIT what you want changed and what the replacement is. Example:
    CHANGE /xyz/qrst/
    This replaces "xyz" by "qrst" in the current line.
    SAVE
    Stores the working copy of your file onto disk but leaves you in XEDIT. This command replaces the original disk file with the working copy. It's good to use SAVE from time to time when you are doing a long job.
    FILE
    Like SAVE, except you leave XEDIT and return to CMS.
    QQ
    Leave XEDIT without copying the working file to disk. If you decide against the changes you have made, or you have made mistakes, use this to escape back to CMS.
    SET CASE M
    XEDIT tries to figure out whether you want all upper case text or mixed case. To do this it looks at the filetype (ft) of the file you are editing. But nowadays very few people want all upper case. To force XEDIT to use mixed case, type this SET command. If you will always want mixed case, you might put this command in a PROFILE XEDIT file (see section on this below).

    Some commands issued using F keys
    Some convenient commands can be issued using F keys rather than typing. The command QUERY PF will display the commands assigned to all the F keys. Here are a couple:

    F1 shows you the online help for XEDIT.

    F3 quits XEDIT (only good if you have done a SAVE or have not made any changes to the file).

    F7 and F8 move backward and forward through the file.

    F11 splits a line at the cursor position if the cursor is WITHIN the line, or if the cursor is pointing to the END of a line, it brings up the line below and "joins" it to the line where the cursor is.

    Return to Contents.


    Prefix Commands

    These are convenient commands that you type on top of the equal signs in front of a line. The commands can go anywhere on top of the five equals on a line. Use your arrow keys to move the cursor onto the equals. When you press Enter or return all the prefix commands you have entered will be executed.

    a or an
    Inserts one or "n" (where the "n" in "an" is a number) blank lines following the line where the "a" is typed. Example: a10
    d or dd
    The "d" command deletes that one line. The "dd" version is used to mark a block of lines for deletion. Type the "dd" in the prefix area (the equals) of the first line in the block and also in the last line of the block. Then when you press Enter or return, the entire block including the marked lines is deleted. Note that the marked lines don't both have to be showing on screen at the same time - the block can span several screens. You can use the F7 and F8 keys to move through the file to locate the ends of the block. You can mark the first and last lines in any order.
    c or cc plus f or p
    The "c" command copies that one line. Use the "f" or "p" to mark where the copy is to be inserted ("f" means insert FOLLOWING and "p" means PRECEDING). Once you have entered both the "c" and the "f" or "p", Enter or return completes the copy operation. The "cc" version is used to mark a block of lines for copying in the same way that "dd" is used to delete a block of lines. Use "f" or "p" to indicate where the copied block should be inserted. Note that the marked lines don't all have to be showing on screen at the same time, and you can mark in any order. One caveat: your "f" or "p" line must NOT be contained WITHIN the marked block!
    m or mm plus f or p
    The "m" and "mm" commands are used in exactly the same way as the "c" and "cc" commands discussed above. The difference is that "m" and "mm" do a MOVE rather than a copy. This means that the marked line or block is deleted from its original position as well as inserted in the location marked by the "f" or "p."

    Return to Contents.


    Creating a New File

    To create a new file, pick a three part name that isn't in use. Start up XEDIT using this new name.
    XEDIT fn ft fm

    Move your cursor to the prefix area (equals signs) on the line marked "top of file". Use the prefix command "a" to insert some blank lines (see the section above on prefix commands).

    Type in the information for your new file, using the arrow keys or the Tab key to move your cursor from line to line. If you make a mistake, move your cursor to the error and retype (see Making Changes below).

    When you need more blank lines, use the "a" command again. Use your F8 key to move down to the next screen when you have filled the current one.

    When you have done all the work you want, press Enter or return to move the cursor to the command line (====>). Type the command:
    FILE

    Return to Contents.


    Making Changes

    You can change lines in five ways:
    1. Get the "bad" line on the screen by using F8 or F7. Move your cursor to the "bad" spot and type the correction. This simply replaces the material character by character.
    2. Insert characters by placing the cursor at the insertion point, press your keyboard's insert key and type. End the insertion by pressing insert again or Enter or return. On many keyboards the insert key is marked "ins."
    3. Delete a character by moving the cursor to the character and pressing your keyboard's delete key. On many keyboards this key is marked "del" (this is NOT the backspace key).
    4. Make the line to change be the current line (use LOCATE), put your cursor on the command line (====>), and use the CHANGE command as described in the section on XEDIT commands earlier in this document.
    5. Use the "d" prefix command to delete whole lines, then the "a" command to insert blank lines and type in the replacement material.

    Return to Contents.


    Leaving XEDIT

    The FILE and QQ commands (see above) terminate XEDIT. FILE saves your work before quitting, QQ does not.

    Return to Contents.


    Using a PROFILE XEDIT file

    If you have XEDIT commands that you want to be executed whenever you edit any file, you can put those commands in a special mainframe file called PROFILE XEDIT A. For example, the SET CASE M command is a good candidate for your PROFILE XEDIT A file.

    The format of this file is:
    The first line in the file must be:

      /*  some comment goes here */
    
    where the initial "/" character is in the first column. Following that initial line, you put in your XEDIT commands, one per line.

    Return to Contents.


    More Information

    We have just scratched the surface in this write-up. There are many more prefix and regular commands. For more information, use your F1 key while using XEDIT to bring up the online help, or select XEDIT help from the "Working with Files" submenu. UNEt consultants will be glad to help you in person, over the phone (call 581-3524) or via e-mail (support@maine.maine.edu). We also teach seminars on this material each regular semester. Of course there are also printed manuals available for purchase from IBM.

    In addition to the above sources of information, you might try the online XEDIT tutorial. Logon to the mainframe and type the command:
    SLFTEACH.

    Return to Contents.


    Topic Index Frequently Asked Questions Document List Return to User Services Home


    University of Maine System Network for Education and Technology Services, Copyright © 1999, revision date 2/18/99.