The EDTF Text Editor

EDTF is a simple text editor that is designed for editing stream files. EDTF is a good choice for entering and modifying Qshell programs, known as scripts , in the Integrated File System (IFS). EDTF is not the only choice, however; you may instead use text editors on client computers. You can also use EDTF to edit database files, but it is not well suited for this purpose because it knows nothing about database field descriptions.

Starting EDTF

Use the Edit File CL command (EDTF) to invoke the editor. The EDTF editor has three parameters, which are described in Table 3.1.

Table 3.1: Parameters of the EDTF Command




The name of a stream file in the Integrated File System. If this file does not exist, it will be created. The file name may include a path of directories.


A database file name, qualified in the format LIBRARY/NAME .


The name of the member in the database file.

You must run EDTF from a CL command line. It will not run from a Qshell command line. To get a CL command line within a Qshell session, press the F21 key.

Qshell scripts may be stored in database files, but they run faster when stored in the root file system of the IFS. All examples in this book assume that scripts are stored in the root, so the FILE and MBR parameters will not be used here.

In Figure 3.1, file case02.qsh is being opened for editing from a CL command line.

click to expand
Figure 3.1: The EDTF editor is invoked from a CL command line.

Figure 3.2 shows the editing session. Notice that it is similar to the Source Entry Utility (SEU) in several ways:

  • There is a command line at the top of the screen for file-level commands.
  • Each line in the entry area is preceded by an area in which line commands may be typed.
  • Most of the file-level and line commands are almost identical to corresponding SEU commands.
  • Most of the display is an entry area, in which you enter the text of the file.
  • Most of the EDTF function-key assignments are identical to corresponding assignments in SEU.

click to expand
Figure 3.2: Stream file case02.qsh has been opened for editing.

However, there are quite a few differences as well. Here are some of the more obvious ones:

  • EDTF is a much less robust editor than SEU and does not support nearly as many commands and editing options.
  • Lines are not numbered in EDTF sessions.
  • EDTF does not present an exit display when the F3 key is pressed.
  • EDTF does not include formatted prompting.

The top line of Figure 3.2 shows that the name of the open file is case02.qsh. The Record area on the second line indicates that the first record on the display is record 1 of the file. It also shows that there are 10 records in the file, and that the roll keys will page the display eight records at a time. The Column area on the second line in Figure 3.2 indicates that the first column on the display is column 1 of 59 columns in the record. Pressing F19 or F20 windows the display by 74 columns.

You may enter the commands shown in Table 3.2 in the Control area of the editing screen. Notice that most command names have two forms ”a short one and a long one. The long forms are unnecessary, because the short names are easier to key.

Table 3.2: Editing Commands for the Control Field




F, Find


Find a string.

C, Change

old string, new string

Replace a string with another string.

T, Top

Position the view at the top of the file.

B, Bot

Position the view at the bottom of the file.


Print from the current line to the end of the file.

Although the command names are capitalized in the table, they are actually not case-sensitive, so FIND , Find , and find are interchangeable. Parameters, on the other hand, are case-sensitive.

The find command accepts one parameter: a string for which to search. If the string includes blanks, surround it with single quotation marks or double quotation marks, as in the second of the following two examples:

f echo
f "Accounts payable"

If the string for which you are searching does not contain either single or double quotation marks, it does not matter which type of quotation marks you use to delimit the search string. However, if the search string contains one type of quotation-mark character, you must surround the string with the other type. To repeat the find command, press the F16 key.

The change command accepts two parameters: an existing string and the string to replace it. The following lines illustrate this command:

c app appl
c 'XX YY' 'XX YY ZZ'

To repeat this command, press F17.

The contents of the file are shown in the editing area, between the "Beginning of Data" and "End of Data" markers. Each record of the file begins with a three-character blank area into which editing commands may be entered. Table 3.3 lists these commands and their meanings.

Table 3.3: Editing Commands for the Line-Prefix Field




Put moved or copied records after this record.

A n

Put n copies of the moved or copied records after this record.


Put moved or copied records before this record.

B n

Put n copies of the moved or copied records before this record.


Copy this record.

C n

Copy n records, beginning with this record.


Copy all records between the two CC commands.


Delete this record.

D n

Delete n records, beginning with this record.


Delete all records between the two DD commands.


Insert a blank line after this record.

I n

Insert n blank lines after this record.


Move this record.

M n

Move n records, beginning with this record.


Move all records between the two MM commands.


Repeat this record.

R n

Repeat this record n times.


Repeat all records between the two RR commands.

RR n

Repeat all records between the two RR commands n times.

T n

Translate n records, beginning with this one, to the codepage specified in the Service panel.


Translate all records between the two TT commands to the codepage specified in the Services panel.

Most of the display is reserved for entering the text to be stored in the file. Type the text to the right of the three-byte line-command column. All text must be entered free-format ; formatted prompting, such as SEU provides when the F4 key is pressed, is not supported under EDTF.

Below the text-entry area is a function-key legend. Table 3.4 summarizes the function-key assignments for EDTF.

Table 3.4: EDTF Function-Key Assignments

Function key





Save the data and continue editing.



Save the data and exit the editor. If the file has changed, you will receive a message and will have to press F3 a second time to exit the editor.



Exit the editor without saving changes. If the file has changed, you will receive a warning message and will have to press F12 a second time to exit the editor.



Specify editing options.


Repeat Find

Find text using the most recent find or change command.


Repeat Change

Change text using the most recent find or change command.



Move left by the width of the window.



Move right by the width of the window.

Notice that the F3, F15, F16, F17, F19, and F20 keys behave in much the same way in EDTF as in SEU. Pressing F3 does not present an exit panel to permit you to save or abandon changes. Instead, use the F2 key to save the file at any time. Use F12 to exit without saving changes.

Introducing the Stream File Exercises

The following pages provide two simple exercises to help you get started using EDTF. In the first exercise, you will create a stream file and enter text into it. In the second one, you will revise the stream file.

First, you must have a directory in which to store the stream file. If you already have a directory, fine: move along to the next topic. If not, talk to your system administrator and get one. If your system administrator doesn't know what a directory is, or if you are the system administrator, then someone, maybe even you, is going to have to create a directory. Here's how to do that:

  1. You should have a directory called "/home" on your system. To see whether or not you do, run the Change Current Directory command (CHGCURDIR, CHDIR, or CD) from a CL command line:

    cd '/home'
  2. The system will answer with one of two messages, either "Current directory changed" or "Object not found." If you get the second message, there is no home directory. Use the CL Create Directory command (CRTDIR, MKDIR, or MD) to create it:

    mkdir '/home'
  3. You should probably create your own directory in which to put your stream files. You may already have a directory and not be aware of it. Use the Display User Profile command (DSPUSRPRF) to find out whether or not you have a home directory:

    dspusrprf jsmith

    After you type dspusrprf and press Enter, page to the last panel and look for the home-directory prompt.

  4. If you need to create a directory of your own, a good convention is to create your directory as a subdirectory of /home and name it with your first initial and last name , as Joe Smith has done in the following command:

    md '/home/jsmith'

This naming convention is not mandatory, of course, but it is a good one to use. Another good convention is /home/ user-profile , where user-profile indicates your user ID. The HOMEDIR (Home Directory) parameter of the Create User Profile command (CRTUSRPRF) defaults to this convention.

Creating a New Stream File

At this point, you should have a directory in which you can place stream files. Use CL's Change Current Directory command (CD) to work from that directory:

cd '/home/jsmith'

Now you are ready to create the new file. Enter the following command:

edtf 'test01.qsh'

Unless you already had a file named test01.qsh in your directory, you should see the display in Figure 3.10. If you already have a test01.qsh file, then you will see its contents instead. In that case, use a different file name for this exercise.

click to expand
Figure 3.10: If the file is empty, EDTF provides one blank line.

Since the file is new, EDTF gives one blank line on which to enter data. This is inadequate, because you are going to enter two lines. To add a line, type the letter I (in either uppercase or lowercase) in the prefix area of the blank line, as shown in Figure 3.11, and press Enter.

click to expand
Figure 3.11: Use the Insert command in the prefix area to insert new lines into the editing area.

Now there are two blank lines, so you are ready to write your stream file. Enter the two lines shown in Figure 3.12.

click to expand
Figure 3.12: Two lines of text have been entered into the editing area.

Press the F2 key to save the file to disk, then press the F3 key to exit the editor and return to the CL command line.

Revising a Stream File

To change the stream file you just created, start by running the EDTF command again to invoke the editor. This time, the system should load the editor with the contents of the test01.qsh file.

Move the cursor to the prefix area of the second record, type I (for insert) and press Enter. The editor adds a blank line just before the End of Data marker. Fill in the line as shown in Figure 3.13.

click to expand
Figure 3.13: An existing file has been opened and new text has been added.

As before, press F2 and F3 to save the changes and exit the editor.


The EDTF editor is a general-purpose text editor you can use for creating and modifying Qshell scripts and other text files in the Integrated File System. It is not the only, or even the best, editor for entering Qshell scripts, howeverPC- based editors are much more powerful and do not sap system resources. Still, EDTF has the advantage that it is available on all OS/400-based systems.

QShell for iSeries
Qshell for iSeries
ISBN: 1583470468
EAN: 2147483647
Year: 2003
Pages: 219 © 2008-2020.
If you may any questions please contact us: