Text Command [T]
Copies a file into Qedit. Use Text to convert a file into Qedit format or to make a copy of an existing file. After a Text, the new copy is "open" and ready to edit or browse.
TEXTfilename [,type]
filename [,SAVETABS]
filename [,BROWSE]
filename [,NEW]
filename [,SETINCR]
filename [,LABELS]
filename [,LENGTH size]
workfile [,workformat] [ (size) ] = filename [,type]
(Q=unnumbered)
(J=extra scr file, same as ,NEW)
(Defaults: size = 50% bigger)
If you do not specify a workfile, Qedit checks to see if you have a workfile Open and it is empty. If it is, Qedit will Text filename into it. If not, Text uses the primary scratch file. If you do Text xx,New or TextJ, Qedit creates an extra scratch file to receive the copied file. You can have up to eight extra scratch files (as well as the primary scratch file) and switch among them with Open ?.
Use filename,type to override the attributes that Qedit assigns to your file. Use workfile,workformat to override the attributes assigned to the workfile. See below for details.
The Text command works on any file that you can read, but it truncates records longer than 8,172 columns and prints a warning. You can use Qedit to edit binary files.
The Text filename,Browse command copies a file into Qedit, but it won't let you modify the file. You can use the List command, including List-Jumping, Hold, Visual mode HH and ZZ, and any other Qedit functions that do not modify the file. There are two advantages to Browse mode: it protects you from making unplanned changes to a file, and it does not update the Mod-Date of the file.
An asterisk (*) as filename means the workfile most recently shut.
If you do specify a workfile name, Qedit shuts your current workfile and creates a new workfile to hold a copy of filename.
If you try to Keep the file with its original name i.e. you enter a Keep without a filename, you will get an error.
/Text txtfile,browse
/K
File opened with Browse, please specify a Keep file name
You can still force a Keep by specifying an explicit filename as in:
/Text txtfile,browse
/Keep txtfile
TXTFILE.DATA.ACCT,OLD 80B FA # of records=16
Purge existing file [no]? y
Examples
Make copy of source file, change and save it:
/text hwsy.src {copy Hwsy.Src into scratch file}
/modify 10 {make changes}
/keep {save changes}
Absolute File Name
When you Text a file, Qedit remembers the absolute path name of the file, not the relative name. This becomes the default for the Keep command. If you Keep with an explicit name, Qedit remembers the absolute path of that name. If you do Set Keep Name xxx to override the default Keep name, Qedit remembers xxx as a relative name, not as an absolute name. This gives you all the options you need to take advantage of the cd command within Qedit.
How to Text Several Files?
Qedit has a primary scratch file that is referred to as "Qeditscr". Any time you take the default options for Opening or Texting a file, your work will be in the Qeditscr primary scratch file.
What if you want to edit two or more files and copy lines between them? You could Text the first file, Hold the desired lines, Keep your changes, then Text the second file and insert the lines. However, if you are doing a large number of edits, the constant Text and Keep operations are inconvenient.
A faster method is to Text each file into an extra scratch file of its own. Then use the Open ? or Open *-n command to switch quickly among them. By default Text always copies the file into the primary Qeditscr scratch file. However, Qedit can supply up to eight extra scratch files. Use the New option (text abcdef,new) or do Text-J (textj abcdef).
The New command can also create extra scratch files. Warning: If you do New;Text file,New you will create two Extra Scratch Files, not one.
Saving Your Work
When you Exit, Qedit checks whether you have any unsaved edits in any of your scratch files. If so, you are prompted to Discard? them, or stay in Qedit to save them. Qedit also asks you to Discard your changes if you Close a scratch file, which removes it from the Open-Stack and purges the file.
Clearing the Workfile
Sometimes Qedit will ask you if it is okay to clear the existing contents of the scratch file and sometimes it won't. If you have not made any changes to the scratch file since you last did a Text or Keep, Qedit assumes that you have another copy of the lines and it is okay to delete the copy in the scratch file.
In batch, the answer to the "Clear?" question will always be "yes". If you know the answer you want, you can append it to the file name parameter just as you do in the Keep command:
/text abc,yes
/text def,no
Using Set Keep for File Attributes
When you Text a file, Qedit remembers as many attributes of the file as possible. When you later Keep the file, Qedit attempts to reproduce the original file. The Text command does an implicit Set Keep command to record what it has discovered about the Text file.
Using TextQ for Numeric Data Files
TextQ means "text quiet" or "text unnumbered" and is the same as using ,UNN after the filename. Use TextQ to edit any data file that may contain numeric digits in the last eight columns. Otherwise, Qedit may interpret those digits as sequence numbers, if the first five records of the file contain data that looks like ascending sequence numbers.
Treatment of Sequence Numbers
Qedit retains whatever sequence numbers it finds in the external file. If Qedit finds an invalid number, it begins assigning new numbers starting from the last valid number and adding Increment.
If the file does not have sequence numbers, Qedit assigns new ones, starting at 1.0 and going up by a calculated increment. The calculated increment is based on the file's current characteristics such as the number of records.
This works well in the majority of cases. However, there are cases where the calculated increment is not accurate enough or the user wishes to have a specific increment. This can be done by setting the increment with the Set Increment command. Then, use the Setincr option on the Text command.
/Text bigfile {Use calculated increment}
/Set Increment .02 {Set the increment value}
/Text bigfile,Setincr {Override the calculated increment}
Files with Header Records
Text has an option to skip 1 to 9 records before deciding the "language" of the external file. The format is as follows:
TEXT lines/filename
where lines is the number of lines to skip over.
This is useful with source files from external sources, such as IBM machines, that may have control cards without sequence numbers, followed by a numbered COBOL source program. By skipping the control cards, Qedit may recognize the file as a COBOL program, instead of a Job file.
Tab Character
By default, Qedit retains tab characters in a file when it Texts the file. However, another option is to expand the tab characters into spaces (to the next tab as established by Set Tabs Stop). You can expand tabs on a specific file by using the Expandtabs option on the Text (or List or Add-File) command. To force all file accesses to expand tabs, do Set Expandtabs On (the default is Off). With Set Expandtabs On, use the Savetabs option to access a file without expanding tabs into spaces:
/text srcfile,expandtabs
/set expandtabs on
/text dbfile,savetabs {override Set Expandtabs On}
If you are editing files with tab characters, see Set Vis Tab.
Overriding Qedit's File Type
Sometimes Qedit will interpret the format of the external file incorrectly. You can override the file type that Qedit would assign by appending a file type keyword to the file name:
filename,COBOL | |
filename,FTN | or FORTRAN |
filename,SPL | |
filename,PASCAL | |
filename,JOB | |
filename,RPG | |
filename,TEXT | |
filename,COBFREE | |
filename,DATA | forces Jumbo workfile |
filename,UNNUMBERED | |
filename,HTML | |
filename,XML | |
filename,QSL | |
filename,JAVA |
The keyword may be shortened to any leading substring, but the comma is required. You cannot use this option to force Qedit to warp a file into something that it is not. You can only use it to resolve ambiguities (i.e., between FORTRAN, Pascal, and SPL, which look the same).
/text funny {this should be a COBOL file}
Language is now JOB {but it has a file code of 0}
678 lines in file
/text funny,cobol
Language is now COBX
678 lines in file
File Modification Timestamp
When you use the Text command on a file, Qedit stores the file's modification timestamp in the workfile. You can display the timestamp by using the Verify command. Qedit uses the stored timestamp to perform some verification if you try to either Keep the file or Shut and re-open the workfile.
$File Keyword
File names containing special characters might cause problems to Qedit. For example,
/Text file:name
Error: Extra or invalid character in Text command
If you run into this problem, you can use the $file keyword instead. The $file keyword can be used wherever a file name is expected, such as in Text, Add, List. The syntax is:
$file[=]"filename"
$File is a reserved keyword, which is followed by an optional equal sign and the actual file name enclosed in string delimiters. Without doing anything to the string, Qedit tries to open the specified file. The previous example now becomes:
/Text $file="file:name"
10 lines in file
Implicitly Folding Wide Lines
When texting files, Qedit assigns a language to the file. This is done by looking at file characteristics such as the file extension. Each language has a set of predefined attributes. One of these attributes is the maximum line length. As it reads the file in, Qedit is able to detect lines exceeding the maximum length. When that occurs, Qedit folds the line. Characters exceeding the maximum are moved to separate lines.
Since folding lines is equivalent to inserting new lines, Qedit has to renumber the file from that point. When all this occurs, Qedit displays a warning message. For example, if Qedit is texting in a Cobol line which maximum length is 80, a line with 200 characters is going to turn into 3 lines.
qux/t /home/demo/longline.cbl
'Language' is now COBX
Warning: Found line(s) over 80 characters. Lines folded and renumbered.
Error: line number out of sequence (001200) - renumbering the rest
See line 1.2
16 lines in file
Line 1.2 is the beginning of the long line. The file now looks like this.
1 This is really the first line.
1.1 This is the second line.
1.2 This line is too long. Qedit will split it into multiple lines of roughly
1.3 the same length. Line folding is not smart. In other words, words can be s
1.4 plit in the middle.
1.5 "commit work" cw
Originally, lines 1.2, 1.3 and 1.4 were together forming one very long line.
Explicitly Folding Wide Lines
There are 2 file types on UNIX: files with Newline delimiters at the end of each line and files without Newline delimiters. By default, Qedit/UX can not handle files without Newlines or files with lines longer than 8,172 characters. It is possible to edit these files by folding the content into manageable pieces. This is done using the Length option. Use this option to specify the size of each line. The maximum value is 8,172.
When reading the file in, each Qedit/UX read retrieves the specified number of characters until it reaches the end of the file. Lines will all have the same size except the very last line, if the total size of the file is not evenly divisable by the specified size. For example, if the file contains 8,000 characters and the specified Length is 80, Qedit/UX creates 100 lines. If the file contains 8,020 characters, there will be 100 lines of 80 characters and the last line will only have 20 characters.
If the Length option is used, Qedit/UX assumes the file does not have any Newline delimiters even if it actually had some. These characters are processed as if they were part of the data. In this case, Qedit/UX automatically disables Set Keep LF. To insert Newline delimiters at the end of each line, you can enable the option with
/Set Keep LF On
or use the LF option on the Keep command as in
/Keep myfile,lf