The CMS file editor XEDIT
CMS provides a file editor called XEDIT, which is a not only a
full-screen editor, but a powerful programming tool. XEDIT has
functions similar to vi
in Linux®. This topic introduces you to basic
editing functions.
To enter an editing session, use the XEDIT command.
xedit my file a
MY FILE A1 F 80 Trunc=80 Size=0 Line=0 Col=1 Alt=0 1
DMSXIN571I Creating new file: 2
3
4
===== * * * Top of File * * * 5
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7... 6
===== * * * End of File * * *
3
====> 7
8 X E D I T 1 File
Numbers in the figure explanations match the reverse type call-outs in the figure:
- File identification line. The first line displays
the file name, file type, file mode and other file characteristics.
F 80
means the length of a line is fixed at 80 characters.Trunc=80
means any characters beyond the 80-character length are truncated.Size=0
means there are no lines in this file.Line=0
means the current line is 0 (more about the current line in point 5).Col=1
is the position of the column pointer (more about the column pointer in point 6).Alt=0
means the file has had no alterations. - Message line. XEDIT communicates with you by displaying messages on the second and third lines.
- File area. This part of the screen is available to display the
file. You can make changes to the file by moving the cursor under
any line and typing over the characters, or by using special keys
to insert or delete characters. You can make as many changes as you
want on the displayed lines before pressing the Enter key. When you
press the Enter key, the changes are made to the copy of the file
that is kept in virtual storage. The SAVE or FILE subcommand permanently
records those changes on the copy of the file that resides on disk.
Because a file can be too long to fit on one screen, various subcommands scroll the screen so you can move forward and backward in a file. Scrolling the screen is like turning the pages of a book.
- Prefix area. The prefix area is the five left-most columns on the screen, and it displays five equal signs (=====). Each line in the file has a prefix area. You can perform various editing tasks such as deleting a line by entering short commands, called prefix subcommands, in the prefix area of a line.
- Current line.
The current line is the file line in the middle of the screen (above
the scale). It is highlighted, appearing brighter than the other file
lines.
The current line is important because most subcommands perform their functions starting with the current line. Naturally, the line that is current changes during an editing session as you scroll the screen, move up and down, and so forth. When the current line changes, the line pointer (not visible on the screen) moves. Many XEDIT subcommands perform their functions starting with the current line and move the line pointer when they are finished.
- Scale. The scale appears under the current line to
help you edit. It is like the margin scale on a typewriter.
The vertical bar (|) in column one on the scale is the column pointer. Various subcommands perform their functions within a line starting at the column pointer, which you can move to different positions on the scale by using XEDIT subcommands. The current column is the column under which the column pointer is positioned.
- Command line. The large arrow (====>) at the bottom of the screen points to the command input area. One way you communicate with the editor is to enter XEDIT subcommands on this line. You can type subcommands in uppercase or lowercase or a combination of both, and many can be abbreviated. For example, BOTTOM, Bottom, and b are all valid ways to type the BOTTOM subcommand (which scrolls the file to the bottom).
- Status area. The lower right corner displays the current status of your editing session, for example, edit mode or input mode, and the number of files you are editing. The status area in the figure shows you are editing one file.
Tip: If you want to explore XEDIT and its capabilities,
type help
at the XEDIT command line, which opens the XEDIT
help menu.
Input mode
i), you enter input mode.
MY FILE A1 F 80 Trunc=80 Size=9 Line=0 Col=1 Alt=0
DMSXMD573I Input mode:
* * * Top of File * * *
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....
_ 1
2
====> * * * Input Zone * * * 3
Input-mode 1 File
XEDIT
places the cursor 1 at the beginning
of the input zone 2 . The input zone is
an area in which you can place data. You can start typing at the cursor
and, when you reach the end of a line, press the new line (Enter)
key to return the cursor to the beginning of the next line. If you
press the new line key on a line without data, XEDIT returns the file
to editing mode.XEDIT blocks the command line 3 because you cannot enter subcommands while in input mode.
Example of using input mode
- Issue this command:
xedit my file a
- On the command line, type input and press the Enter key.
- Type this phrase, then press the Enter key:
CP is the z/VM hypervisor
- Type this phrase, then press the Enter key:
CMS is the interactive component of z/VM
- Type this phrase, then press the Enter key:
XEDIT is the CMS editor
- Press the Enter key.
MY FILE A1 F 80 Trunc=80 Size=3 Line=3 Col=1 Alt=3
DMSXMD587I XEDIT:
===== * * * Top of File * * *
===== CP IS THE Z/VM HYPERVISOR
===== CMS IS THE INTERACTIVE COMPONENT OF Z/VM
===== XEDIT IS THE CMS EDITOR
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7...
===== * * * End of File * * *
====>
X E D I T 1 File
Tip: XEDIT changed all lowercase letters to uppercase.
To prevent this, issue the subcommand set case
mixed ignore
before you add text.
Overview of changing files
- Insert key. When you press the insert key, the XEDIT cursor changes shape. By placing the cursor on a line, you can insert text between existing letters.
- Delete key. By placing the cursor on a line and pressing the delete key, the character to the right of the cursor is deleted and the line closes up.
- ADD and INPUT prefix commands. By moving the cursor
to the prefix area, typing
a
and pressing the Enter key, you create a new line in the file. If you want to add five lines, typea5
in the prefix area.The INPUT prefix command behaves similarly.
- DELETE prefix command.
By moving the cursor to the prefix area, typing
d
and pressing the Enter key, you delete a line. If you want to delete five lines, typed5
in the prefix area. - LOCATE subcommand. You
can find strings in the file by using the LOCATE subcommand. XEDIT
scrolls the file to the line in which the string occurs. The invocation
is
l /string
or simply/string
.Example: To find an occurrence of the wordinteractive
in a file, issue this command from the XEDIT command line:
or simply:====> l /interactive
====> /interactive
Example of changing files
Assume you are still editing the file in Example of using input mode.
- From the XEDIT command line, type this command and press the Enter
key:
====> top
- To prevent XEDIT from turning lowercase letters to uppercase, type this command on the command
line, then press the Enter key:
====> set case mixed ignore
- Move the cursor to the first prefix area, type
a
, then press the Enter key. - On the new line, type this phrase:
z/VM has many components
- Type over the next line so the letters are in their proper case:
CP is the z/VM hypervisor
- Create two blank lines between the first and second lines by typing
i2
in the second prefix area and pressing the Enter key. - Delete one of the blank lines by typing
d
in the prefix area, then pressing the Enter key. - From the XEDIT command line, locate the word
EDITOR
:====> /editor
Result: The lineXEDIT IS THE CMS EDITOR
becomes the current line. You should see a screen like this:MY FILE A1 F 80 Trunc=80 Size=5 Line=5 Col=1 Alt=0 ===== * * * Top of File * * * ===== z/VM has many components ===== ===== CP is the z/VM hypervisor ===== CMS IS THE INTERACTIVE COMPONENT OF Z/VM ===== XEDIT IS THE CMS EDITOR |...+....1....+....2....+....3....+....4....+....5....+....6....+....7... ===== * * * End of File * * * ====> X E D I T 1 File
SAVE, FILE, QUIT, and QQUIT
- Use SAVE when you want to save changes to a file permanently but continue editing the file.
- Use FILE when you want to save changes to a file permanently and quit editing the file.
- Use QUIT to quit editing a file you have not changed. If you have
made any changes, XEDIT issues a message:
DMSXSU577E File has been changed; type QQUIT to quit anyway
- Use QQUIT to quit a file and not save any changes you have made since the last save. The subcommand is handy if you decide you do not want any of the changes you have been currently making or if you want to be sure you have not changed a critical file.
- z/VM: CMS Primer
- For more advanced information, see z/VM: XEDIT User's Guide.