KEDIT for Windows Ref er ence Man ual Ver sion 1.6

Mansfield Soft ware Group, Inc. P.O. Box 532 Storrs, CT 06268 http://www.kedit.com

De cem ber 2007 This PDF contai ns the full text of the KEDIT for Windows 1.6 Refer ence Manual. The entire docu m ent is in black and white, aside from the colored KEDIT logo on the cover page.

The text of the KEDIT for Windows 1.6 User’s Guide is avail able in a sepa rat e PDF file.

The con tents of both the Ref er ence Man ual and the User’s Guide are also available in HTML Help form in the KEDIT for Windows Help file, KEDITW.CHM.

Copy right © 1983-2007 Mansfield Software Group, Inc. All Rights Reserved.

KEDIT is a trademark of Mansfield Software Group, Inc. Windows is a trade mark of Microsoft Corpo ra tion. Contents

Chapter 1. Introduction ...... 11 1.1 Overview of Documentation...... 11 1.2 Syntax Conventions ...... 12

Chapter 2. Invoking KEDIT ...... 14 2.1 Running KEDITW32.EXE ...... 14 2.2 KEDIT Initialization Options ...... 16 2.3 Initialization Processing ...... 22 2.4 Editing Additional Files ...... 24

Chapter 3. KEDIT Commands ...... 26 ADD ...... 26 ALERT ...... 26 ALL...... 27 ALTER ...... 28 ANSITOOEM ...... 29 BACKWARD...... 30 BOTTOM...... 31 CANCEL ...... 31 CAPPEND ...... 31 CDELETE ...... 32 CENTER ...... 33 CFIRST, CLAST ...... 34 CHANGE...... 34 CHDIR, CHDRIVE...... 36 CINSERT ...... 38 CLIPBOARD ...... 39 CLOCATE ...... 40 CMATCH ...... 41 CMSG ...... 43 COMMAND ...... 43 COMPRESS ...... 44 COPY...... 45

3 COUNT...... 46 COVERLAY ...... 47 CREPLACE ...... 48 CURSOR ...... 49 DEBUG...... 51 DEFINE ...... 53 DELETE ...... 54 DIALOG ...... 55 DIRAPPEND ...... 58 DIRSORT...... 59 DMSG ...... 60 DOS, DOSNOWAIT, DOSQUIET ...... 61 DOWN ...... 63 DUPLICATE ...... 64 EDITV ...... 65 EMSG...... 67 ERASE ...... 67 EXPAND ...... 68 EXTEND ...... 68 EXTRACT ...... 69 FILE, FFILE ...... 69 FILL, FILLBOX ...... 71 , FINDUP, FUP ...... 72 FLOW ...... 73 FORWARD ...... 74 GET...... 75 HELP ...... 76 HEXTYPE ...... 77 HISTUTIL ...... 77 HIT ...... 80 IMMEDIATE ...... 81 INIUTIL ...... 81 INPUT ...... 82 ...... 82 KEDIT ...... 83 KHELP ...... 85 LEFT ...... 86 LEFTADJUST ...... 87

4 LESS ...... 87 LOCATE ...... 88 LOCK...... 93 LOWERCASE ...... 93 LPREFIX ...... 94 MACRO ...... 95 MACROS...... 96 MARK ...... 97 MERGE...... 99 MODIFY ...... 100 ...... 101 MOVE...... 102 MSG...... 103 NEXT ...... 104 NFIND, NFINDUP, NFUP ...... 104 NOMSG ...... 105 OEMTOANSI ...... 106 OVERLAY ...... 106 OVERLAYBOX...... 107 POPUP ...... 107 PRESERVE ...... 108 PRINT ...... 109 PURGE ...... 111 PUT, PUTD ...... 112 QUERY ...... 113 QUIT, QQUIT ...... 114 READV ...... 114 RECOVER ...... 117 REDO ...... 118 REFRESH ...... 118 REGUTIL ...... 119 RENAME ...... 121 REPEAT ...... 121 REPLACE...... 123 RESET ...... 123 RESTORE...... 124 RGTLEFT ...... 125 RIGHT ...... 125

5 RIGHTADJUST...... 126 SAVE, SSAVE...... 127 SCHANGE ...... 128 SET ...... 129 SHIFT ...... 129 SHOWDLG ...... 130 ...... 131 SOS ...... 133 ...... 138 SPLTJOIN ...... 139 STATUS ...... 140 SYNEX ...... 140 TAG ...... 140 TEXT ...... 141 TFIND...... 142 TOP ...... 143 UNDO ...... 143 UNLOCK ...... 143 UP ...... 144 UPPERCASE ...... 144 WINDOW ...... 145 WINEXEC ...... 146 WINHELP...... 147 WMSG ...... 148 XEDIT...... 148 & ...... 148 ? ...... 149 = ...... 150

Chapter 4. The SET Command...... 151 SET ALT ...... 154 SET ARBCHAR ...... 155 SET ARROW ...... 158 SET AUTOCOLOR ...... 158 SET AUTOEXIT ...... 160 SET AUTOINDENT ...... 160 SET AUTOSAVE ...... 161 SET AUTOSCROLL ...... 162

6 SET BACKUP ...... 163 SET BEEP...... 164 SET BOUNDMARK ...... 164 SET CASE ...... 166 SET CLOCK ...... 168 SET CMDLINE ...... 168 SET COLMARK ...... 169 SET COLOR ...... 170 SET COLORING ...... 172 SET CURLINE ...... 175 SET CURRBOX ...... 176 SET CURSORSIZE ...... 177 SET CURSORTYPE ...... 178 SET DEBUGGING ...... 178 SET DEFEXT ...... 179 SET DEFPROFILE ...... 180 SET DEFSORT ...... 181 SET DIRFORMAT ...... 182 SET DISPLAY ...... 183 SET DOCSIZING ...... 184 SET DRAG ...... 185 SET ECOLOR...... 186 SET EOFIN ...... 189 SET EOFOUT...... 189 SET EOLIN ...... 190 SET EOLOUT...... 191 SET FCASE ...... 192 SET FILEID, FMODE, FPATH, FNAME, FEXT, FTYPE ...192 SET FORMAT ...... 195 SET HELPDIR ...... 196 SET HEX ...... 196 SET HEXDISPLAY...... 197 SET HIGHLIGHT...... 198 SET IDLINE ...... 199 SET IMPMACRO...... 199 SET INISAVE ...... 200 SET INITIALDIR ...... 201 SET INITIALDOCSIZE ...... 203

7 SET INITIALFRAMESIZE...... 204 SET INITIALINSERT ...... 205 SET INITIALWIDTH ...... 206 SET INPUTMODE ...... 206 SET INSERTMODE ...... 208 SET INSTANCE ...... 208 SET INTERFACE ...... 209 SET INTERNATIONAL ...... 211 SET KEYSTYLE ...... 213 SET LASTOP ...... 214 SET LINEFLAG ...... 215 SET LINEND ...... 216 SET LOCKING ...... 217 SET LRECL ...... 218 SET MACROPATH ...... 219 SET MARGINS ...... 221 SET MARKSTYLE ...... 222 SET MONITOR ...... 223 SET MOUSEBEEP ...... 224 SET MSGLINE ...... 224 SET MSGMODE ...... 225 SET NEWLINES ...... 226 SET NOVALUE...... 227 SET NUMBER ...... 227 SET OFPW ...... 228 SET OPENFILTER ...... 229 SET PARSER ...... 230 SET PATH ...... 232 SET PCOLOR...... 233 SET POINT ...... 235 SET PREFIX ...... 236 SET PREFIXWIDTH ...... 239 SET PRINTCOLORING ...... 239 SET PRINTER ...... 240 SET PRINTPROFILE...... 242 SET QUICKFIND...... 243 SET RANGE ...... 244 SET RECENTFILES ...... 245

8 SET RECFM ...... 245 SET REPROFILE ...... 246 SET REGSAVE ...... 247 SET RESERVED ...... 248 SET RIGHTCTRL ...... 249 SET SCALE ...... 249 SET SCOPE ...... 250 SET SCREEN ...... 251 SET SCROLLBAR ...... 253 SET SELECT ...... 253 SET SHADOW ...... 254 SET SHARING ...... 255 SET STATUSLINE ...... 256 SET STAY...... 257 SET STREAM ...... 257 SET SYNONYM ...... 258 SET TABLINE ...... 260 SET TABS...... 261 SET TABSAVE ...... 262 SET TABSIN ...... 263 SET TABSOUT ...... 264 SET THIGHLIGHT ...... 265 SET TIMECHECK ...... 265 SET TOFEOF ...... 266 SET TOOLBAR...... 267 SET TOOLBUTTON ...... 267 SET TOOLSET ...... 272 SET TRAILING...... 274 SET TRANSLATEIN, TRANSLATEOUT ...... 275 SET TRUNC ...... 275 SET UNDOING ...... 276 SET VARBLANK...... 277 SET VERIFY ...... 277 SET WINMARGIN ...... 279 SET WORD ...... 280 SET WORDWRAP ...... 281 SET WRAP ...... 281 SET ZONE ...... 282

9 SET = ...... 283

Chapter 5. QUERY and EXTRACT ...... 284 5.1 QUERY...... 284 5.2 EXTRACT and Implied EXTRACTs ...... 285 5.3 QUERY and EXTRACT Operands ...... 287

Chapter 6. Macro Reference ...... 329 6.1 Program Structure ...... 329 6.2 Tokens ...... 330 6.3 Symbols and Variables ...... 331 6.4 Assignments ...... 333 6.5 Operators and Expressions ...... 333 6.6 Commands ...... 338 6.7 Keyword Instructions ...... 339 6.8 Functions ...... 349 6.8.1 Built-in Functions ...... 351 6.8.2 Notes on I/O Functions ...... 375 6.8.3 Boolean Functions ...... 377 6.9 The PARSE Instruction...... 381 6.10 Conditions...... 386 6.11 KEXX and REXX...... 388

Chapter 7. Built-In Macro Handling...... 390 7.1 Overview ...... 390 7.2 Keyboard Macros ...... 390 7.3 Toolbar Macros...... 394 7.4 Menu Macros...... 395 7.5 Mouse Macros ...... 395

Chapter 8. KEDIT Language Definition Files...... 397 8.1 Loading KLD Files...... 397 8.2 KLD File Format ...... 398

Chapter 9. Error Messages and Return Codes ...... 410 9.1 Error Messages ...... 410 9.2 Return Codes ...... 429

Index ...... 431

10 Chapter 1. Introduction n o i t c

1.1 Overview of Documentation u d o r This is the second of two vol umes of doc um enta ti on for KEDIT for Windows, the t n KEDIT for Windows Refer ence Manual . The first volume is the KEDIT for Windows I User’s Guide.

This Ref er ence Man ual has nine chap ters:

· Chapter 1, “Introduction” · Chapter 2, “Invoking KEDIT” · Chapter 3, “KEDIT Commands” · Chapter 4, “The SET Command” · Chapter 5, “QUERY and EXTRACT” · Chapter 6, “Macro Reference” · Chapter 7, “Built-in Macro Handling” · Chapter 8, “KEDIT Language Definition Files” · Chapter 9, “Error Messages and Return Codes” The com plete details of KEDIT com mands and options, including sepa rat e chapter s on ini tializa tion options, SET options, and the QUERY and EXTRACT com mands, can be found in this Refer ence Manual.

The User’s Guide has 12 chapter s and two appendi ces :

· Chap ter 1, “In tro duc tion’’

· Chap ter 2, “Get ting Started’’

· Chapter 3, “Using KEDIT for Windows’ ’

· Chapter 4, “Key board and Mouse’’

· Chapter 5, “Menus and Toolbars’’

· Chap ter 6, “Tar gets’’

· Chap ter 7, “The Pre fix Area’’

· Chap ter 8, “Se lec tive Line it ing and High light ing’’

Overview of Documentation 11 · Chap ter 9, “Tai lor ing KEDIT’’

· Chapter 10, “Using Macros’ ’

· Chap ter 11, “Sample Mac ros’’

· Chapter 12, “File Proces sing’ ’

· Ap pen dix A, “XEDIT Com pat i bil ity’’

· Ap pen dix B, “Glos sary’’

If you are just starting with KEDIT, you should first work with the User’s Guide. After you have gained some expe rience with KEDIT, you will most often use this Refer ence Man ual.

1.2 Syntax Conventions

· Many KEDIT com mands and opti ons can be abbre ate d. For exam ple, the DEFINE com mand can be entere d as DEF , DEFI, DEFIN, or DEFINE. The short- est legal abbre vi a ti on for a com mand is known as the com mand’s min i mal trun ca - tion. The mini mal trun ca tion for DE FINE is DEF. Min imal trun ca tions will be indi ed in the secti on where com mands and their opti ons are discusse d by show- ing the mini m al trunca ti on in upper cas e and the rest of the com mand’s name in lower cas e. So the DEFINE com mand is shown as

DEFine

· When you have a choice be tween two opti ons, the opti ons will be sepa rat ed by a verti bar (‘’|’’). For exam ple, the com mands that allow you to set somethi ng ON or OFF will show ON and OFF like this:

ON|OFF

· Opti onal operands are given in brackets , and operands for which you must substi - tute an ap pro pri ate value are given in ital ics. For am ple, the ADD com mand (which has A as its mini m al trunca ti on) can take a num ber n as its oper and or can have no operands, in which case one line is added to your file. This is shown as

Add [n]

· Be sure not to ac tu ally enter the brack ets and ver tical bars that ap pear in descrip - tions of com mand syntax. They are not part of the actual com mand and are only used to help de scribe the com mand. While up per case and low er case are used in com mand de scrip tions to in di cate min i mal trun ca tions, you can ac tu ally en ter com mands in any com bina ti on of uppercase and lowercase.

· In ex am ples where it is im por tant to in di cate the pres ence of a spe cific number of blanks (for exam ple, in the descri pti on of the JOIN com mand), the manual some- times uses the sym bol “V” to rep re sent a blank.

12 Chapter 1. Introduction · When a com plete indi ca ti on of the syntax of a com mand ac cording to the conven - tions given here would be too com pli cated, a sim pli fied version of the syntax is given and the text explai ns the details. n o i t

· Menu items and toolbar buttons are referred to by using initi al capi tal let ters on the c

words involved. For exam ple, the text refers to the Edit Find di alog box and the u d

Find Next toolbar button. o r t n I

Syntax Conventions 13 Chapter 2. Invoking KEDIT

2.1 Running KEDITW32.EXE

To use KEDIT for Windows, you need to run KEDITW32.EXE module. You norm ally do this by double- clicking on the KEDIT for Windows program icon. But you can also run KEDIT via the Windows Start menu, or you can enter the com mand yoursel f from within a Com mand Prompt window.

The KEDITW32 com mand is usuall y issued with no param eter s or options. When this happens, KEDIT for Windows starts by display ing a new file called UNTITLED .1. You then either add text to this file or, more often, use File Open to select some existing file to edit.

It is also possi ble to have KEDIT for Windows start by edit ing one or more files spec i- fied on the command line or to start by dis play ing a direc tory list ing in a DIR.DIR file. And you can also spec ify com mand line options that control certai n aspects of the upcom ing edit ing session.

Here are the dif ferent forms of the KEDITW32 com mand:

Editing a file KEDITW32 [fileid ...] [(options [)]] KEDITW32 Tells Windows to load in and exe cute the KEDITW32.EXE module.

fileid … Tells KEDIT the name of the file or files that you want to edit. If you don’t specify a fileid, KEDIT will start by ed iting a new file called UN TI TLED.1.

op tions Lets you spec ify spe cial ini tial iza tion op tions, dis cussed in Section 2.2, “KEDIT Initialization Options”, that will af fect this KEDIT ses sion. A left pa ren the sis must sep arate the fileid spec i fi ca - tion from the op tions spec i fi ca tions, which can op tion ally be fol- lowed by a right parenthesis.

Examples KEDITW32 Start KEDIT for Windows. Since you spec ifie d no fileid, KEDIT will begin by edit ing a new file called UNTITLED.1.

KEDITW32 .C Start KEDIT for Win dows, tell ing it that you want to edit the file TEST.C.

KEDITW32 DATA1.TXT DATA2.TXT Start KEDIT for Win dows, tell ing it that you want to edit the files DATA1.TXT and DATA2.TXT.

14 Chapter 2. Invoking KEDIT KEDITW32 C:\TEST\*.TXT Start KEDIT for Win dows, tell ing it that you want to edit all files in the C:\TEST direc - tory with an extension of .TXT.

KEDITW32 TAR GET.TXT (PRO FILE ALTPROF Start KEDIT for Win dows, tell ing it that you want to edit the file TAR GET.TXT and that, instead of auto mati cally exe ing your WINPROF.KEX file it should use ALTPROF.KEX as your pro file.

Viewing a KEDITW32 DIR [filespec ...] [(options [)]] directory KEDITW32 Tells Windows to load in and exe cute the KEDITW32.EXE module.

DIR Tells KEDIT that you want to start out with a di rec tory dis play. KEDIT will dis play the di rec tory listing in a file called DIR.DIR, just as it does when you issue the KEDIT DIR com mand. T

file spec … Spec ifies the files to be in cluded in the direc tory dis play. File spec ifi - I

cations can use the usual wild card char acters, as ter isk (‘‘*’’) and D E

question mark (‘‘?’’). If no file spec is given, KEDIT lists all files in K

the current direc tory , as discusse d in the first example below. g n i k

op tions Lets you spec ify ini tial iza tion op tions, as dis cussed in Section 2.2, o v

“KEDIT Initialization Options”. n I

Examples KEDITW32 DIR Start KEDIT with a direc tory list ing of all files in the cur rent direc tory. (When KEDIT for Windows starts up, the current directory is norm ally your Windows Docu m ents or My Docu m ents folder. If you invoke KEDIT via a desktop short cut, you can override this by speci fy ing a dif ferent “Start In” directory in the short cut’s Proper ti es dialog box. SET INITIALDIR also affects KEDIT for Windows’ initia l current directory.)

KEDITW32 DIR *.C *.H Start KEDIT with a direc tory listing of all files in the cur rent direc tory that have .C or .H as their extension.

KEDITW32 DIR D:\*.* (PRO FILE DIRPROF Start KEDIT with a direc tory list ing of all files in the root direc tory of the D: drive, and tell KEDIT that instead of auto mati cally exe cut ing your WINPROF.KEX file, it should use DIRPR OF.KEX as your pro file.

Running KEDITW32.EXE 15 2.2 KEDIT Initialization Options

The options that you spec ify on the KEDITW or KEDITW32 com mand line used to start a KEDIT for Windows session are known as ini tial iza tion options, because their primary use is to con trol some aspects of how KEDIT initializes itself at the start of an edit ing session. For exam ple, there is a NOREG option that tells KEDIT not to proces s config u ra ti on inform ati on saved in the Windows regis try , and a NOPROFILE option that tells KEDIT to bypass execu ti on of your profile.

Several of the options dis cussed here can also be used from within a KEDIT for Win- dows session, when you use the KEDIT com mand to add additi onal files to the ring. For exam ple, if REPROFILE ON is in effect, KEDIT nor mally re-execute s your profile whenever a new file is added to the ring, but you can override this by using the NOPROFILE option on the KEDIT com mand line used to add an additi onal file to the ring.

The initi aliza tion options that you can specify are:

COLumn m The COLUMN option tells KEDIT that, as soon as the file is loaded, the cursor should be moved into the file area to the speci fie d colum n of the current line. The current line is ini tially set to the line spec ified via the LINE option, or to the Top-of-File line if the LINE option is not used. An example:

KEDITW32 SAM PLE.FIL (LINE 62 COLUMN 12 This tells KEDIT to begin editing SAM PLE.FIL, and to start with line 62 as the cur rent line, with the cursor posi tioned in colum n 12 of that line.

Line and col umn values can optionall y be enclosed in double- quotes. For exam ple:

KEDITW32 SAM PLE.FIL (LINE "62" COLUMN "12"

DEFPROFile fileid The DEFPROFILE option lets you change the fileid of the default profil e to somethi ng other than WINPROF.KEX, or lets you give a drive and path speci fi ca ti on for WINPROF.KEX, thereby avoiding a path search. With REPROFILE ON, this default pro file may be re-executed many times dur ing a KEDIT ses sion, when ever a new file is added to the ring.

An exam ple:

KEDITW32 TEST.FIL (DEFPROFILE C:\MACROS\MYPROF.KEX If you specify the DEFPROFILE option on the com mand line, it over rides any DEFPROFILE value previ ously saved in the Windows regis try .

FRAMEsize MINimized|MAXimized|NORMal|RECALL The FRAM ESIZE opti on lets you specify that KEDIT should start with a mini m ized frame win dow, a maxi m ized frame win dow, a norm al (non-mini m ized, non-maxi m ized) frame win dow, or what ever size frame win -

16 Chapter 2. Invoking KEDIT dow was in ef fect at the end of the last KEDIT for Windows session. If the FRAMESIZE opti on is not spec ifie d, KEDIT sizes the frame win dow accord ing to the value of the INITIALF RAMESIZE opti on saved in the Windows regis try which has RECALL as its default.

An exam ple:

KEDITW32 TEST.FIL (FRAMESIZE MAX

INSTANCE SINGLE|MULTIPLE Use the INST ANCE opti on to specify whether, if another insta nce of KEDIT for Windows is already running when you try to invoke KEDIT, a new insta nce of KEDIT for Windows should be started. With INST ANCE SINGLE, the exist ing in - stance is ac ti vated, with any files that you spec ifie d on the com mand line added to the exist ing insta nce’s ring of files, and no new insta nce is started. With INST ANCE MULTIPLE, a new insta nce is started and multi ple copies of KEDIT for Windows will be running simultaneously. T I

If the INSTANCE option is not speci fie d on the com mand line, KEDIT uses the value D of SET INSTANCE that is saved in the Win dows reg is try; this defaults to INSTANCE E K SIN GLE. g n i k

An exam ple: o v n KEDITW32 ANOTHER.CPY (INSTANCE MULTI PLE I

LINE n The LINE option tells KEDIT that, as soon as the file is loaded, the speci fie d line of the file should become the current line.

An exam ple:

KEDITW32 SAM PLE.FIL (LINE 62

This tells KEDIT to begin editing SAM PLE.FIL, and to start with line 62 as the cur rent line.

The LINE option does not affect the cursor posi tion; the cursor is left on the com mand line and is not autom ati cal ly moved to the current line. However , you can use the COLUMN option to move the cursor to a spec ifie d colum n of the current line.

Line and col umn values can optionall y be enclosed in double- quotes. For exam ple:

KEDITW32 SAM PLE.FIL (LINE "62"

LOCK The LOCK option tells KEDIT to lock the file you edit, so that no other program s can access the file until you have finishe d edit ing it. The LOCK option forces the file to be locked, even if LOCKING OFF is in effect.

KEDIT Initialization Options 17 MACROPath ON|OFF|envvar|dirlist The MACROPATH opti on can be used to control which direc to - ries KEDIT looks in when it searches for macros. By de fault, KEDIT searches the cur - rent direc tory and all di recto rie s spec ifie d in the PATH envi ron m ent variable . Then it looks in the “KEDIT Mac ros” subdi rec tory of your Windows Docu m ents or My Docu - ments folder, the direc tory from which KEDIT for Windows was loaded, and the USER and SAM PLES subdi rec tori es of that di rectory . See the discus sion of SET MACROPATH for a de scripti on of the values that you can specify for the MACROPATH option.

If you specify the MACROPATH option on the KEDITW32 com mand line, it over rides any MACROPATH value saved in the Windows regis try .

An exam ple:

KEDITW32 TEST.FIL (MACROPATH KEXPATH

NEW KEDIT nor mally looks for the file that you want to edit on disk, read ing it in if it exists, and editing a new file by that name only if no exist ing copy of the file can be found. Use the NEW option to tell KEDIT not to bother looking for your file on disk, because you want to edit a new file by that name regard less of whether the file already exists. KEDIT does not look in the current directory for your file and does not do a path search for your file, but instead adds an empty file with the speci fie d fileid to the ring.

NODEFEXT The NODEFEXT option tells KEDIT to ignore the current set ting of DEFEXT when deter min ing a fileid, and to act as if DEFEXT OFF were in effect. NODEFEXT is always in effect for the first file added to the ring. The NODEFEXT option is provided for use on the KEDIT com mand line used to add additi onal files to the ring or move within the ring. It is used mainly in macro s that work with fileids that might not include exten sions.

NOFILEMENU When you fin ish editing a file, KEDIT nor mally adds its fileid to the list of recently-edited files dis played at the bot tom of the File menu. Use the NOFILEMENU option to pre vent a file (for exam ple, a work file used tem porari ly by a KEDIT macro) from being added to the list of recently-edited files.

NOINI The NOINI does the same thing as the NOREG option; for details see the descripti on below of the NOREG option.

(KEDIT for Windows now stores its config u ra ti on inform ati on in the Windows regis - try, but KEDIT for Windows 1.5 and earli er stored this inform ati on in the KEDITW.INI file. So NOREG is the newer name for this option, but for com pati bil ity rea sons NOINI remains available.)

NOLOCK The NOLOCK option tells KEDIT not to lock the file you edit. If LOCKING ON is in effect, you can use the NOLOCK option to over ride it for a par ticu lar file.

18 Chapter 2. Invoking KEDIT NOMsg The NOMSG option causes MSGMODE OFF to be put into effect for the file being added to the ring. This is a rarely used option, provided mainly for XEDIT com pat i bil ity.

NOPROFile The NOPROFILE option suppress es execu ti on of your profil e. It affects only the files current ly being added to the ring, and has no effect on files added to the ring later in your KEDIT session.

NOREG The NOREG option sup presses KEDIT’s process ing of set tings pre vi ously saved in the Win - dows regis try . KEDIT uses built-in default val ues for all of its SET options, and does not use the val ues saved the reg istry via Options Save Set tings. KEDIT also uses default val ues for its win - dow positions, fonts, etc., and does not load infor mation from the reg istry on recently-edited files, com mands, and search .

When the NOREG option is used KEDIT puts REGSAVE NOSTATE NOHISTORY into effect, so that the exist ing state and history infor mation in the Win dows regis try will not be over writ ten T at the end of your KEDIT session. I D E K If you use the NOREG option, the infor mation on saved set tings dis played by the Options Sta tus g

and Options Save Set tings dia log box will be based on KEDIT’s default set tings and not on your n i

actual saved set tings, since in this case KEDIT does not pro cess the saved set tings. k o v n The NOREG option is pri marily used when KEDIT is not behav ing as you expect and you want I to deter mine whether the unex pected behav ior is caused by some value saved in the reg istry or is instead KEDIT’s default behavior . Note that even with the NOREG option in effect, KEDIT will still exe cute your pro file unless you also spec ify the NOPROFILE option.

The NOREG option does the same thing as the NOINI option, an older option that remains avail - able for com pat i bil ity with pre vi ous ver sions of KEDIT.

PATH ON|OFF|envvar|dirlist The PATH opti on can be used to control which direc to rie s KEDIT looks in when it searches for files you want to edit. By de fault, KEDIT searches the cur rent di - rectory and all di recto rie s spec ifie d in the PATH envi ron m ent variable . Then it looks in the “KEDIT Mac ros” subdi rec tory of your Windows Docu m ents or My Docu m ents folder, the direc tory from which KEDIT for Windows was loaded, and the USER and SAMPLES subdi rec tori es of that di rectory . See the discus sion of SET PATH for a de - scripti on of the values that you can specify for the PATH option.

If you specify the PATH option on the KEDITW32 com mand line, it over rides any PATH value saved in the Windows regis try .

An exam ple:

KEDITW32 TEST.FIL (PATH EDITPATH

KEDIT Initialization Options 19 PROFDEBUG The PROFDEBUG option helps you debug prob lems with your KEDIT pro file by run - ning your pro file with the KEXX debugger active. It does this by inter nally issuing the com mand DEBUG WINPROF.KEX instead of the com mand MACRO WINPROF.KEX to run your KEDIT profil e. This turns on the debugging window and runs your profil e with interac ti ve tracing in effect.

PROFile fileid The PROFILE option tells KEDIT not to run the default profil e macro (control led by the DEFPROFILE option and usuall y WINPROF.KEX) but instead to run the spec ifie d profil e. Unlike the DEFPROFILE option, the PROFILE option only affects the profil e for the files current ly being added to the ring, and does not affect the profil e to be used when addi tional files are added to the ring later in your edit ing session. An exam ple: KEDITW32 TEST.FIL (PROFILE ALTPROF

UNTITLED The UNTI TLED option tells KEDIT that you want to edit a new, untitled file, whose file name and extension are of the form UNTITLED .n.

If the UNTITLED option is used, the com mand line involved cannot specify a fileid, since KEDIT auto mati cally gen er ates a new UNTI TLED.n fileid.

If no fileid is spec ifie d on the com mand used to start a KEDIT session, the UNTITLED option is assumed and need not be explicit ly spec ifie d; this is why KEDIT for Windows auto mati cally starts with a file called UNTI TLED.1 if invoked with no fileid. The UNTITLED option is also used by the macro that handles the File New menu item.

Width n The WIDTH option, whose value can range from 1024 to 999999, control s the length of the longest line that KEDIT can read in or proces s. The default value for WIDTH is 10000, meaning that you can edit files with lines up to 10000 charac ter s long; any lines that are lon ger are auto mati cally split when KEDIT reads them in. To use fully edit files with longer lines, you will need use to a larger WIDTH value.

If you fre quently need to edit files with lines longer than 10000 charac ter s long, you can issue the SET INITIALWIDTH com mand within a KEDIT session; this value will be autom ati cal ly saved in the Windows regis try and will determ ine the WIDTH value put into effect by default in future KEDIT sessions . If you specify the WIDTH option on the com mand line used to invoke KEDIT for Windows, it over rides any INITIALWIDTH value saved in the Windows registry.

The WIDTH value is establi shed during KEDIT ini tializa tion, and cannot be changed in the middle of a KEDIT session. An exam ple:

KEDITW32 (WIDTH 32000

Notes · Several of these opti ons—PRO FILE, NOPROFILE, LINE, COLUMN, PROF- DEBUG, LOCK, NOLOCK, NEW, NODEFEXT, NOFILEMENU, UNTI TLED, and NOMSG—can also be given from within KEDIT for Windows when you is- sue the KEDIT com mand to add addi ti onal files to the ring. These op tions let you

20 Chapter 2. Invoking KEDIT spec ify the profil e to be exe cute d, etc., for the newly-added file. You can also use the PROFILE, NOPROFILE, LINE, COLUMN, PROFDEBUG, and NOMSG op- tions with the DIR, DIRAPPEND, and MAC ROS commands, since these com- mands can also cause a file to be added to the ring. Be cause of the spe cial proces sing done inter nally by these com mands, the other options are not relevant.

· Most of these opti ons are rarely used, and KEDIT for Windows is usuall y invoked without any opti ons. Ini tializa tion opti ons are most often used to override KEDIT’s nor mal be hav ior dur ing a par tic u lar ed it ing ses sion. For ex am ple, you could use the WIDTH op tion to change the maxi m um line length for a parti cu lar edit ing session, or use the DEFPROFILE opti on to change the defaul t profil e from WINPROF.KEX to some other fileid for a par tic u lar ed iting ses sion. But to changes to the maxi m um line length or de fault profil e that would af fect all future edit ing sessions , you would inste ad is sue the SET INITIALWIDTH or SET DEFPROFILE com mands from within KEDIT. If you then save their new val ues in the Win dows reg is try via Op tions Save Set tings, the saved setting s will affect all future edit ing sessions . (Opti ons Save Set tings is require d for SET DEFPROFILE; the regis try is update d automatically for SET INITIALWIDTH and for a few other

options.) T I D

· Several of the ini tializa tion opti ons af fect behav ior that cannot be control led E K

directly from your profil e becaus e the proces sing involved takes place before g n

KEDIT runs your profil e. For exam ple, KEDIT must de term ine the WIDTH value i before your profil e is exe cute d so that it can set up some of the mem ory buffers that k o

it needs to use while proces sing your profil e. Sim ilar ly, the deci sion on what pro- v n file to run for the first file added to the ring must obvi ously be made be fore your I profil e can be exe cute d, so any SET DEFPROFILE com mands in your profil e can only af fect the de fault profil e used for future files added to the ring, not the profil e used for the first file added to the ring. (SET INITIALWIDTH or SET DEFPROFILE com mands issued in a previ ous ses sion and saved in the Windows regis try would, however , af fect the first file added to the ring in the current session.)

· You can also specify ini tializa tion opti ons through the envi ron m ent variable KEDITW. During initi aliza tion, KEDIT for Windows looks for this envi ron m ent vari able and proces ses any opti ons it contains.

SET KEDITW=op tions

The KEDITW envi ron ment vari able is rarely used. Since it af fects all KEDIT for Windows sessions and cannot be changed without first ing Windows, it is only useful for opti ons that you want in ef fect for all KEDIT sessions . But this of opti on is usuall y control led through the KEDIT SET com mand. For exam ple, if you alway s want to use a WIDTH value of 32000 inste ad of the defaul t of 10000, you can issue the com mand SET INITIALWIDTH 32000 from within KEDIT; this value will then be saved in the Win dows reg is try and will take ef fect in all future KEDIT sessions.

· Mul ti ple opti ons can be speci fie d with the KEDITW envi ron m ent variable or on the com mand line. For example,

KEDIT Initialization Options 21 SET KEDITW=DEFPROF C:\MACROS\MYPROF WIDTH 32000 KEDITW PROG.PAS (PROFILE PASCAL LOCK If you specify the same opti on twice or you give confli cting opti ons, the opti on spec ified last takes pre cedence. Op tions speci fied on the and line take pre ce - dence over opti ons spec ifie d via the KEDITW= envi ron m ent variable.

Passing When KEDIT runs your profil e (either at the start of an editing session or when arguments to REPROFILE ON is in effect and an additi onal file is being added to the ring), it passes your profile an argum ent string to your profil e. This string consis ts of the name of the file being edited (including its full path spec ifi ca ti on) and any options that you spec ify on the com mand line, including the left parenthe sis , optional right parenthe sis , and any text that follows the right parenthe sis . Your profil e can use the ARG(1) functi on or the PARSE ARG instruc tion to access this information.

Any text that follows the optional right parenthe sis on the com mand line is passed to your profil e but is other wise ignored by KEDIT. You can take advantage of this to pass param eter s of your own to your profil e. For exam ple, conside r the com mand line

KEDITW32 TEST.C (PROFILE SPE CIAL) USER PARM Your profil e (in this case, the PROFILE option would cause the profil e SPEC IAL.KEX to run) could use the follow ing to get at the param eter inform ati on passed to it:

parse arg fileid . '(' options ')' ex tra This would set three variable s. The vari able fileid would get the fileid involved, includ- ing the full drive and path spec ifi ca tion that KEDIT will use to edit the file. The variable options would get any ini tial iza tion options spec ified , in this case “PROFILE SPE CIAL”. The vari able extra would get the text that follows the right parenthe sis , in this case “ USER PARM”. Your profil e could then make decisions based on the values of these variables.

2.3 Initialization Processing

This sec tion describes some of the proces sing done dur ing KEDIT ini tializa tion, so that you can better understa nd the rela tionship between KEDIT’s ini tializa tion options, KEDIT’s sec tion of the Windows regis try , and your profile.

Single and When KEDIT for Windows is loaded, it checks to see if another instance of KEDIT for multiple Windows is already execut ing. If not, KEDIT conti nues to ini tialize in the norm al way. instances But if another instance is active, KEDIT needs to deter mine whether INSTANCE SINGLE should be in effect (in which case the existing instance of KEDIT will be acti - vated and the new instance of KEDIT will term inate ) or whether INSTANCE MULTIPLE should be in effect (in which case the new instance of KEDIT will con- tinue, running simulta neousl y with the existing instance).

If the INSTANCE SINGLE or INSTANCE MUL TIPLE initia liza tion option has been spec ifie d, KEDIT puts the speci fie d value into effect. If not, and if the NOREG and NOINI ini tializa tion options have not been spec ifie d, KEDIT checks the Windows reg- is try to see if it con tains a saved set ting of INSTANCE MUL TI PLE, and if so puts

22 Chapter 2. Invoking KEDIT INSTANCE MUL TIPLE into effect. Other wise , KEDIT puts the default of INSTANCE SIN GLE into effect. KEDIT then acts accord ingly, acti vat ing the exist ing instance for INSTANCE SINGLE or conti nu ing to ini tialize the new instance for INSTANCE MULTIPLE.

Registry Next, unless the NOREG or NOINI ini tializa tion options have been speci fie d, KEDIT reads inform ati on previ ously saved in KEDIT’s sec tion of the Windows regis try . Saved set tings from the reg is try are put into effect, over rid ing the default set tings built into KEDIT. KEDIT also pro cesses the regis try 's sta tus infor mation (on KEDIT’s fonts, window positi ons, etc.) and history inform ati on (KEDIT’s recently-edited files, recently-issued commands, etc.).

Initialization At this point the ini tial iza tion options (other than INSTANCE, NOREG, and NOINI, options which have already been proces ) are put into effect. Some of these options override the effect of KEDIT default setti ngs or setti ngs loaded from the Windows regis try . For example, the WIDTH initial iza tion option over rides any INITIALWIDTH set ting loaded from the regis try , and the PATH and MACROPATH ini tializa tion options over- T ride PATH and MACROPATH setti ngs loaded from the registry. I D E K

Profile KEDIT next searches for the ini tial file to be edited, if neces sary doing a path search g n processing control led by the PATH value, to locate the file. Then, unless the NOPROFILE option i k

has been speci fie d, KEDIT runs your profil e. o v n

If you have not used the PROFILE initi aliza tion option to specify the name of the pro- I file to execute , KEDIT uses as the name of your profil e the value of DEFPROFILE, which defaults to WINPROF.KEX. KEDIT looks for your profil e in the current direc- tory of the current drive. If KEDIT can’t find it there, it then does a path search, con - trolled by the MACROPATH value, for your pro file. Finally, it looks in the “KEDIT Mac ros” subdi rec tory of your Windows Docu m ents or My Docu m ents folder, the directory from which KEDIT for Windows was loaded, and the USER and SAM PLES subdi rec tori es of that directory . If your profil e still can't be found, KEDIT assumes that it do esn't exist.

Note that KEDIT begins to exe cute your profil e after it has proces sed setti ngs saved in the Windows regis try , has proces sed any initi aliza tion options, and has determ ined which file will be edited, but before it has loaded the file into mem ory. This means that your profil e can make decisions based on the fileid involved, that SET com mands issued from your profil e override the values of setti ngs loaded from the regis try , and that your profil e can issue com mands, like SET TABSIN and SET EOFIN, that affect the handli ng of your file dur ing the loading process.

If your profil e issues any com mand that depends on your file being loaded (such as a LOCATE or CHANGE com mand), KEDIT loads your file before proces sing the com - mand. Other wise , KEDIT loads your file after com pleti on of your profil e. (Excepti ons to this include the SET com mand, the EXTRACT com mand, implied EXTRACT func- tions, and Boolean functi ons, which are proces sed as they are encounter ed in your pro- file, and do not force loading of your file. This can affect the inform ati on they return. For exam ple, SIZE.1() will return 0 if issued before your file is loaded, regardles s of the size of your file. On the other hand, items like FEXT.1() don’t depend on your file being loaded and can be usefull y exam ined early in your profile.)

Initialization Processing 23 You can force KEDIT to load your file at any point in your profil e by issuing a com - mand like LOCATE 0. (LOCATE 0 is useful because it does not change the current line loca tion, which is usuall y set to the top-of-file line when a file is loaded but can be set else where if the LINE initial iza tion option is used.)

Here is a full list of the com mands that can be issued from your profil e without forc ing the loading of your file: SET, EXTRACT, DEFINE, CHDIR, CHDRIVE, CMSG, COMMAND, DEBUG, DMSG, DOS, DOSNOWAIT, DOSQUIET, EDITV, EMSG, ERASE, EXTRACT, HELP, HIT, IMMEDI A TE, LEFT, MACRO, MSG, NOMSG, PRESER VE, PURGE, QQUIT, QUERY, QUIT, RENAME, RESTORE, RGTLEFT, RIGHT, SET, SHOWDLG, SYNEX, WINDOW , WINEXEC, WINHELP, WMSG, =, and ?.

The positi oning done by the LINE and COLUMN initi aliza tion options takes place immedi ate ly after the file is loaded, and before KEDIT proces s any com mands in your profil e that oper ate on the content s of your file.

2.4 Editing Additional Files

The pre vious sec tion described the initi aliza tion proces sing done by KEDIT when the first file is added to the ring at the start of an edit ing session. From then on, whenever a file is added to the ring, sim ilar but somewhat sim pler proces sing takes place.

There is no need to worry about how many instances of KEDIT are active, since the additi onal file will be edited by the current instance of KEDIT. KEDIT keeps a copy of the saved setti ngs from the Windows regis try in mem ory throughout the editing ses- sion, so KEDIT does not need to re-read these setti ngs when a new file is added to the ring.

Initialization KEDIT does not re-proces s the ini tializa tion options set via the KEDITW= environ - options ment variable , but KEDIT does proces s any ini tializa tion options pres ent on the KEDIT com mand line used to add the addi tional file to the ring. Only the PROFILE, NOPROFILE, PROFDEBUG, LOCK, NOLOCK, NEW, NODEFEXT, NOFILEMENU, UNTITLED, and NOMSG options are valid at this point.

Profile When a file is added to the ring, KEDIT needs to initial ize all of its File level set tings, processing as well as the View level set tings for your initial view of the file. How this is done depends on whether your profil e will be re-exe cuted, which in turn depends on the value of SET REPROFILE.

If REPROFILE ON is in effect, or if the PRO FILE ini tial iza tion option is spec ified , KEDIT first initializes the File and View level set tings accord ing to the saved setting s in the Windows regis try . (If you speci fie d the NOREG or NOINI when invoking KEDIT, KEDIT instead uses its built-in default val ues and does not use the saved set- tings from the regis try ). KEDIT then runs your profil e, which may then make changes to these settings.

If REPROFILE OFF is in effect, your profile will not be re-execute d. KEDIT copies most of the File and View level set tings from the cur rent file to the newly-added file.

24 Chapter 2. Invoking KEDIT (ALT, LRECL, RECFM, DISPLA Y, SCOPE, TRUNC, VERIFY , and ZONE are excep - tions to this; their ini tial defaults are used.)

Notes · If you specify multi ple files at a on the KEDIT com mand line used to add ad - diti onal files to the ring af ter a KEDIT session has started, the proces sing de- scribed in this sec tion takes place re peat edly, once for each file added to the ring.

· If you specify multi ple files at a time on the com mand line used to invoke KEDIT for Windows, the full KEDIT ini tializa tion proces sing descri bed in the preced ing sec tion takes place for the first of those files and the proces sing descri bed in this sec tion takes place for the rest of those files. T I D E K

g n i k o v n I

Editing Additional Files 25 Chapter 3. KEDIT Commands

This chapter gives detailed inform ati on on all KEDIT com mands, with the excepti on of the SET, QUERY, and EXTRACT com mands. Full docu m enta ti on on the SET com - mand is in Chapter 4, “The SET Command”, and details of the QUERY and EXTRACT comm ands are in Chapter 5, “QUERY and EXTRACT”.

ADD

Format Add [n]

Description The ADD com mand adds n blank lines to your file. If n is not given, one line is added.

The blank lines are added below the focus line. The first blank line added becomes the new focus line and the cursor is positi oned in the left mar gin col umn of this line.

See also SOS LINEADD

Examples ADD Add one blank line below the focus line. (You can also press func tion key F2 to add one line to your file.)

ADD 5 Add five blank lines below the focus line.

ALERT

Format ALERT /prompt/ [options ]

where options can be:

EDITfield [/initial /] TITLE /title / OK|OKCANCEL|YESNO|YESNOCANCEL DEFButton n ICONExclamation|ICONInformation|ICONQuestion|ICONStop FIXEDfont PASSWORD

Description Use the ALERT com mand within KEDIT macros to display dialog boxes that present error messages or mes sages of spe cial impor tance to users of the macro. The more-frequently-used DIALOG com mand is used for norm al dialog boxes.

26 Chapter 3. KEDIT Commands See the DIALOG com mand for a full discus sion of the options involved. The ALERT com mand and the DIALOG com mand take the same operands and behave identi cally, with these excepti ons:

· Unles s you expli cit ly spec ify a dif ferent type of icon, the ICONSTOP (stop sign) icon is dis played when you use the ALERT com mand.

· If BEEP ON is in ef fect, the speaker will beep when an ALERT dia log box is dis - played.

· The re sults from ALERT are re turned in the macro variable s ALERT.0, ALERT.1, and ALERT.2. The DIA LOG com mand inste ad uses DIA LOG .0, DIA LOG .1, and DIALOG.2.

See also DIA LOG, POPUP

Examples ALERT /In valid name spec ified/ TI TLE /Er ror/ ALERT /Op tion in valid; con tinue ?/ YESNO DEFBUTTON 2

ALL

Format ALL [target ]

Description The ALL com mand causes KEDIT to search through your file for all lines contai ning s

the spec i fied tar get, using KEDIT’s selec tive line edit ing facil ities to select these lines d

for display . All other lines of your file are tem porari ly excluded from the display. n a m

When you once again want to work with all lines of your file, you can issue the ALL m

com mand with no operands, and all lines of your file will again be selected. o C Note that you can also use the Edit Selec tive Editing dialog box to control the selecti ve line editing facil ity.

User’s Guide Chapter 8, “Selective Line Editing and Highlighting”, gives a com plete intro duc tion to the ALL command and to KEDIT’s selec tive line edit ing facil ities.

After com pleti on of the ALL com mand with a tar get oper and, the first selected line becomes the focus line, and KEDIT puts SCOPE DISPLA Y into effect. The ALL com - mand gives lines that match the spec ified tar get a selec tion level of 1, gives lines that don’t match a selec tion level of 0, and sets DISPLA Y to 1 1 so that only matching lines will be selected for dis play. With SCOPE DIS PLAY, lines that are excluded from your display are also excluded from proces sing by all KEDIT com mands except FILE, SAVE, and SORT. If you put SCOPE ALL into effect, KEDIT com mands operate on all lines, even lines that are excluded from the display.

ALL 27 If SHADOW ON (the default) is in effect, a shadow line appears on your display wher- ever lines have been excluded, indi cat ing how many lines are excluded. With SHADOW OFF, excluded lines are not repre sent ed at all on your display .

The ALL com mand with no operands resets the selecti on level of all lines in the file to 0, and then sets DIS PLAY to 0 0, so that all lines of the file are selected for display . ALL with no operands does not change the focus line locati on.

See also User’s Guide Chapter 8, “Selective Line Editing and Highlighting”, LESS, MORE, TAG, SET DIS PLAY, SET SCOPE, SET SELECT, SET SHADOW, QUERY NBSCOPE

Examples ALL /tele phone/ All lines of your file contai ning the string ‘‘telephone’ ’ are selected for display ; all other lines are excluded. The first line of your file contai ning ‘‘telephone’ ’ becomes the focus line. (If your file does not contai n ‘‘telephone’ ’, KEDIT issues an error message and takes no further action.)

ALL /up per/ | /lower/ All lines of your file contai ning ‘‘upper ’’ or ‘‘lower’’ are selected for display .

ALL Issuing the ALL com mand with no operands causes all lines of the file to be selected for dis play, effec tively can celing the effect of a pre vi ous ALL comm and that caused lines to be excluded.

ALL BLANK DELETE * ALL In this exam ple, all blank lines are deleted from a file. The first ALL comm and selects all blank lines in the file for display and further proces sing and makes the first selected line the focus line. The DELETE comm and then deletes all selected lines (in this case, all blank lines) from the file. The sec ond ALL com mand then causes all lines remaining in the file to once again be selected.

ALL BLOCK This is han dled as a special case. All lines in the cur rently defined block are selected, and all other lines in the file are excluded.

ALTER

Format ALter char1 char2 [target [n [m]]]

Description The ALTER com mand is sim ilar to the CHANGE com mand, but rather than changing one string of char acters to another, it changes one char acter , char1, to another, char2.

28 Chapter 3. KEDIT Commands Either or both of the char acters can be spe cial char acters not rep re sented on the PC’s key board. To understa nd this descripti on of the ALTER com mand, you should first read the descripti on of the CHANGE com mand. The tar get, n, and m operands work in the same way as they do with the CHANGE command.

With the ALTER com mand, occurrence s of char1 (the first char acter that you specify) are changed to char2 (the sec ond char acter that you specify). You can spec ify char1 and char2 in either of two ways. If the charac ter appears on a key on the key board, you can sim ply enter it. For exam ple, to change an ‘‘A’’ into a ‘‘B’’ you could enter

AL TER A B You can also specify char1 and char2 by giv ing the char acter codes for the char acters involved. This allows you to easil y work with spe cial charac ter s not on the PC’s key - board. You enter the two- or three-digit dec i mal value of the code for the char acter you want. For example, to change a formfeed char acter (char acter code 12) to a tab char ac - ter (char acter code 9), you could enter

AL TER 12 09 The two methods can be mixed:

AL TER 09 + This exam ple would change a tab charac ter into a plus sign. (KEDIT requires ‘‘09’’ and not sim ply ‘‘9’’ in these exam ples so that it can disti nguish between the tab charac ter , which has char acter code 9, and the char acter ‘‘9’’, which has char acter code 57.)

When issued from a macro, the ALTER comm and sets the macro vari able ALTER.0 to 2, returns the num ber of occurrence s changed in ALTER.1, and returns the num ber of lines changed in ALTER.2. s

See also CHANGE d n a

Examples AL TER 09 32 ALL * m m Change all occur rences of tab char acters (char acter code 9) through out the entire file to o blanks (char acter code 32). C

AL TER + 12 :15 * Change all occurrence s of ‘‘+’’, in all lines from the focus line up to but not including line 15, to form feed char acters (char acter code 12).

ANSITOOEM

Format ANSITOOEM [target ]

Description Use the ANSITOOEM com mand to convert text in a speci fie d porti on of your file from the ANSI char acter set to the OEM char acter set.

ANSITOOEM 29 All text within the spec ified tar get area that falls within the cur rent ZONE col umns is con verted. If the target area is a box block, its entire con tents are con verted, regard less of the ZONE set tings.

See also OEMTOANSI, User’s Guide Section 3.7, “Character Sets”

Examples ANSITOOEM ALL Con vert all lines of the file from ANSI to OEM.

BACKWARD

Format BAckward [n|*|HALF|m Lines]

Description The BACKW ARD com mand causes KEDIT to scroll the current window backward, towards the top of your file. BAck ward KEDIT scrolls one window backward in your file. This com mand is norm ally as - signed to the Page Up key. BAck ward n KEDIT scrolls n windows backward in your file, as if you had pressed the Page Up key n times. BAck ward * KEDIT scrolls backward all the way to the top of your file, making the top-of-file line becom e the focus line. BAck ward HALF KEDIT scrolls one half-window backward in your file. BAck ward m Lines KEDIT scrolls backward m lines in your file.

You can also move forward and backward in your file by using the mouse to manipu lat e the ver tical scroll bar.

See also FOR WARD

Examples BACKWARD 2 KEDIT scrolls backward two windows in your file, as if you had pressed the Page Up key twice.

BACK WARD 4 LINES KEDIT scrolls four lines backward in your file.

30 Chapter 3. KEDIT Commands BOTTOM

Format Bottom

Description The BOT TOM comm and makes the last line of the file become the focus line. With INTER FACE CUA in effect, you can also press Ctrl+End to get to the end of your file. With INTER FACE CLAS SIC you can instead press Ctrl+Page Down.

See also TOP

CANCEL

Format CANCEL

Description The CANCEL com mand causes KEDIT to inter nally issue QUIT com mands for all files in the ring. Any files that have been changed since their last SAVE will remain in the ring, since QUIT only affects files that have not been changed.

See also QUIT, QQUIT

CAPPEND

Format CAppend [text] s d

Description The CAPPEND com mand (‘‘col umn append’’) sets the focus colum n to be one charac - n a

ter beyond the last charac ter of the focus line and then appends any text that you spec ify m

to the focus line, beginning at the focus column. m o For exam ple, if the focus line consis ted of C

Hello and you entered the com mand

CAVVthere. the focus line would be changed to

Hello there. The focus col umn would be positi oned at the blank between ‘‘Hello’’ and ‘‘there’’.

Note that in the above exam ple, the ‘‘CA’’ is fol lowed by two blanks. The first blank follow ing the com mand is ignored, but any additi onal blanks (in this case there is one) are appended to your text. Had you issued the com mand with only one blank

CAPPEND 31 CAVthere. no blanks would have been appended after the ‘‘o’’ of ‘‘Hello’’ and the focus line would look like this:

Hellothere. If CAPPEND is entered with no operands, no change is made to the focus line, but the focus colum n is set just beyond the last charac ter of the line.

CAPPEND can be used in connec ti on with the REPEAT com mand to append the same text to the end of a group of lines.

Examples CAPPENDV. A period is added after the last nonblank charac ter of the focus line. The focus col umn is set to the colum n with the period.

CAPPENDVVABCDEF Two blanks have been entered after CAPPEND. A blank and the letter s ‘‘ABCDEF’’ are placed at the end of the focus line, and the col umn pointer is set to point to the blank.

CDELETE

Format CDelete [column-tar get ]

Description The CDELETE com mand (‘‘col umn delete’’) deletes text, start ing at the focus colum n and conti nu ing through the colum n indi cated by the colum n tar get operand. (If no operand is given, only the charac ter at the focus colum n positi on is deleted.) Col umn targets, dis cussed in detail in User’s Guide Chapter 6, “Targets”, are a special type of tar get used only with the CDELETE and CLOCATE com mands. If the colum n tar get that you spec ify is on the focus line, only charac ter s on the focus line are deleted. If the colum n tar get is not located on the focus line (you speci fie d a string colum n tar get, STREAM ON was in effect, and KEDIT had to search beyond the focus line to find the string) charac ter s on two or more lines are deleted. Any lines on which all char acters are deleted are simply deleted from your file. If only some char ac- ters on a line are deleted, the line is not deleted from your file, but the required charac - ters are removed from the line. After the dele tion, the last line on which char acters were deleted becomes the focus line and the focus colum n’s locati on is unchanged.

See also SET STREAM

Examples CDELETE 2 The char acter at the focus col umn and the char acter fol low ing it are deleted.

32 Chapter 3. KEDIT Commands CDELETE -3

The char acter at the focus col umn and the two char acters pre ced ing it are deleted.

CDELETE *

All char acters on the focus line, start ing from the char acter at the focus col umn, are deleted.

:1 CL :73 CDELETE * RE PEAT *

This sequence of com mands would move you to line 1 of the file and make colum n 73 become the focus colum n. Then it would go through the file, removing all charac ter s in the file located at or to the right of colum n 73.

CDELETE /Hello/

All charac ter s from the charac ter at the focus colum n up to (but not including) the ‘‘H’’ in the next occur rence of ‘‘Hello’’ are deleted. If STREAM OFF is in effect, the occur - rence of ‘‘Hello’’ must be in the focus line or an error will result.

CENTER

Format CEnter [target ] s d n a

Description Text in the spec ified tar get area is cen tered within the cur rent mar gins. m m

You can use CENTER BLOCK to center line blocks, box blocks, and one-line stream o blocks. Box blocks and one-line stream blocks are given spe cial handli ng: KEDIT cen- C ters the text within the block boundari es, and text outside the block is not affected. You can not cen ter a multi-line stream block.

See also LEFTADJUST, RIGHTADJUST, SET MAR GINS

Examples CENTER Text in the focus line is center ed within the current mar gins. This is the default assign- ment for Shift+Ctrl+C.

CENTER ALL

All text in the file is cen tered within the cur rent mar gins.

CENTER 33 CFIRST, CLAST

Format CFirst CLAst

Description The CFIRST com mand (‘‘col umn first’’) makes the left zone colum n become the focus col umn.

The CLAST com mand (‘‘col umn last’’) makes the right zone colum n become the focus col umn.

CHANGE

Format Change /string1/string2/ [target [n [m]]]

Description Use the CHANGE com mand to change occurrence s of one string to another. Note that the Edit Replace dialog box provides a sim pler but somewhat less pow erful way to make such changes.

The CHANGE comm and causes KEDIT to search your file for occur rences of string1 and to change them to string2. KEDIT examines all lines in the tar get area and changes the first n occur rences of string1 in each line to string2. (An addi tional operand, m, lets you spec ify that KEDIT start with the mth occur rence of string1 rather than with the first occurrence.) If no tar get is given, KEDIT only searches the focus line. If n is not given, only the first occurrence of string1 in each line is changed to string2. You may enter an aster isk (‘‘*’’) instead of a num ber n to indi cate that all occur rences of string1 on a given line should be changed to string2. For example,

CHANGE /Hello/Goodbye/ 10 * This example tells KEDIT to change all occur rences of ‘‘Hello’’ in the focus line and the nine lines fol lowing it, for a total of ten lines, to ‘‘Goodbye’ ’. String1 and string2 are set off by delim iter char acters, which are nor mally slash char ac - ters (‘‘/’’). How ever, any spe cial char acter (char acters other than let ters, num bers, and blanks) can be used as the delim iter char acter . The only restric tion is that the delim iter char ac ter can not appear any where within string1 or string2. If string1 is longer than string2, the line of text involved will be shortened by the change. If string1 is shorter than string2, the line will be lengthened by the change. If the resulting line would extend beyond the trunca ti on colum n, all charac ter s pushed beyond the trunca ti on colum n will be lost. When search ing a line for text that matches string1, KEDIT is affected by the settings of ARBCHAR, CASE, and ZONE. The descripti on of SET HEX discusse s the hexa - deci m al and deci m al notati on you can use for string1 and string2 if HEX ON is in effect.

34 Chapter 3. KEDIT Commands WORD, PREFIX, and SUFFIX (which can be trun cated to ‘‘W’’, ‘‘P’’, and ‘‘S’’) can pre cede /string1/, just as they can with string tar gets, to indicate that the occur rences of string1 that you want to change must occur at word boundari es (or, for PREFIX or SUFFIX, be pre ceded or followe d by word boundari es). For example,

CHANGE WORD /The/Some/ 1 * would change any occurrence s of the word ‘‘The’’ on the focus line, but would not change occurrence s of the word ‘‘These’’.

You can also precede string1 with REGEXP (which can be truncat ed to ‘‘R’’). This allows you to use regu lar expres sion notati on in string1 and can use ref er ences to tagged reg u lar expres sions in string2. For example,

CHANGE R /ABC{[0-9]}XYZ/&1&1/ ALL * would change all occurrence s in your file of ‘‘ABC’’ followed by a digit fol lowed by ‘‘XYZ’’ to two occurrence s of that digit. So ‘‘ABC5XYZ’’ would become ‘‘55’’. KEDIT’s regu lar expres sion support is described in detail in User’s Guide Chapter 6, “Targets”.

If STAY ON is in effect, the line that is the focus line when you enter the CHANGE com mand remains the focus line when the CHANGE com mand has com pleted. If STAY OFF is in effect, the last line scanned becomes the new focus line after the CHANGE com mand com pletes.

You can make the CHANGE com mand operate within the current ly-defined block by using BLOCK as the tar get operand. The CHANGE com mand will operate within the porti ons of a line or stream block that are within the current zones. Box blocks are given specia l handli ng: KEDIT looks for string1 within the boundari es of the box block, regardles s of the zone setti ngs, and does not shift text in or out of the box while

mak ing changes. s d n

If you issue the CHANGE com mand with no operands, KEDIT re-exe cutes the last a CHANGE com mand issued from the com mand line. m m o

When issued from a macro, the CHANGE comm and sets the macro vari able C CHANGE.0 to 3, returns the num ber of occurrence s changed in CHANGE.1, returns the num ber of lines changed in CHANGE.2, and returns the num ber of lines truncat ed (because the changed text would have extended beyond the trunca ti on colum n) in CHANGE.3.

See also ALTER, COUNT, SCHANGE, SET ARBCHAR, SET CASE

Examples CHANGE /A/B/* * Changes all occur rences of the let ter ‘‘A’’ to the let ter ‘‘B’’ in all lines from the focus line through the bot tom of the file.

CHANGE /A/B/ALL * Changes all occur rences, in all lines of your file, of the let ter ‘‘A’’ to the let ter ‘‘B’’.

CHANGE 35 CHANGE /1234/5678/ Changes the first occurrence of ‘‘1234’’ in the focus line to ‘‘5678’’.

CHANGE /87 years ago/Four score and seven years ago/ Changes the first occurrence of ‘‘87 years ago’’ in the focus line to ‘‘Four score and seven years ago’’.

CHANGE ;A/B;C/D; 1 * Changes all occurrence s of ‘‘A/B’’ in the focus line to ‘‘C/D’’. Note that you could not use ‘‘/’’ as a delimiter here, since string1 and string2 both contai n slashes. A semico lon (‘‘;’’) was used instead.

CHANGE /large/small/ PARA 2 3 ‘‘PARA’’ indi cates that changes are to occur in the focus paragraph. The ‘‘2’’ indi cates that at most two occur rences per line of ‘‘large’’ are to be affected. The ‘‘3’’ indi cates that changes are to start with the third occurrence of ‘‘large’’ on each line. So this com - mand changes the third and fourth occurrence s of ‘‘large’’ to ‘‘small’’ on each line of the focus paragraph.

CHANGE Since no operand is given here, KEDIT re-exe cutes the last CHANGE com mand issued from the com mand line.

CHDIR, CHDRIVE

Format CHDir [d:]path CHDRive d[:]

Description Use the CHDIR comm and to make a differ ent direc tory become the cur rent directory . If both a drive and directory are speci fie d, KEDIT changes both the current drive and the cur rent direc tory.

You can use CHDIR or its mini m al trunca ti on, CHD, to change to a new current direc- tory from within KEDIT. , which is often used for this purpose from the DOS com - mand line, cannot be used, because KEDIT treats CD as an abbre via ti on of the CDELETE com mand. Another way to change the current directory from within KEDIT is to use the File Directory dialog box.

The current directory is used within KEDIT for several purposes. For exam ple, when you use File New to begin edit ing an untitl ed file, the current directory is used as the path speci fi ca ti on for that file. When you use the DOS com mand to shell to an MS-DOS com mand session, that session inherit s KEDIT’s current directory . And when you issue the KEDIT com mand and do not give a path speci fi ca ti on for the file you want to edit, KEDIT begins its search in the current directory . Note that the CHDIR

36 Chapter 3. KEDIT Commands com mand does not affect the default directory for the File Open dialog box, which KEDIT keeps separate track of.

CHDIR = is han dled as a special case; the drive and direc tory of the cur rent file become your cur - rent drive and directory .

Use the CHDRIVE com mand to make a dif ferent drive become the current drive; what- ever cur rent directory is already in effect for that drive will become KEDIT’s cur rent direc tory.

You can use the QUERY DIREC TORY com mand to deter mine the current drive and directory , or to deter mine the current directory of a speci fie d drive.

See also SET INITIALDIR

Examples CHDIR \PRO JECT Makes the \PRO JECT direc tory of the cur rent drive become the cur rent directory .

CHDIR E:\PRO JECT Makes E: the cur rent drive and makes E:\PRO JECT the cur rent directory .

CHDIR "E:\My Project" Makes E: the cur rent drive and makes E:\My Pro ject the cur rent directory . Note that directory names contai ning blanks must be enclosed in double quotes.

CHDIR =

If you are editing, for exam ple, C:\TEST\NOTES.TXT, then the C: drive becomes the s

current drive and C:\TEST becomes the current directory . d n a

CHDRIVE D: m m

Makes the D: drive become the current drive; the D: drive’s current directory becomes o your new current directory . C

CHDIR \\SERVER\PROJECTS\TEST This makes the direc tory \\SERVER\PRO JECTS\TEST, accessed using a UNC (Uni - versal Nam ing Conven ti on) name, become the current directory . Note that when a UNC directory is the current directory , there is no current drive.

CHDIR, CHDRIVE 37 CINSERT

Format CInsert text

Description The CINSERT com mand (‘‘col umn insert’’) inserts the text you spec ify into the focus line, beginning at the focus colum n loca tion. Text that was at or to the right of the focus colum n loca tion is shifted to the right to make room for the inserted text.

A single blank sepa rat es CINSERT from the text that you want inserted. If CINSERT is followed by more than one blank, all blanks after the first are taken to be part of the text that you are insert ing. KEDIT inserts the text that you enter, from the char acter after the blank follow ing CINSERT through the end of the com mand string, including any trail - ing blanks.

Here is an exam ple of the CINSERT com mand. Assume the focus line looks like this:

ABCDEJKLM If you issue

CLOCATE :6 the focus colum n will be at the ‘‘J’’ in col umn 6 of the focus line. If you then issue

CINSERT FGHI KEDIT will insert ‘‘FGHI’’, start ing at colum n 6 and pushing ‘‘JKLM’’ to the right, yield ing

ABCDEFGHIJKLM The CINSERT com mand does not change the focus colum n or focus line locati on. Any charac ter s that would be inserted beyond the trunca ti on colum n, or that would be shifted beyond the trunca ti on colum n by the inserti on, are truncated.

See also CREPLACE, COVERLAY

Examples CINSERTVVHello Here, the ‘‘CINSERT’’ is fol lowed by two blanks, so the second blank becomes part of the text to be inserted. KEDIT inserts a blank followed by ‘‘Hello’’ into the focus line, starting at the focus colum n loca tion.

CI X KEDIT inserts an ‘‘X’’ into the focus line, starting at the focus colum n loca tion.

CI XVV KEDIT inserts an ‘‘X’’ followed by two blanks, start ing at the focus colum n loca tion.

38 Chapter 3. KEDIT Commands CLIPBOARD

Format CLIPboard COPY|CUT| CLIPboard APPEND CUT|COPY CLIP board PUT text CLIP board AP PEND PUT text CLIPboard CLEAR

Description The CLIPBOAR D com mand moves data to or from the Windows clipboard. It is used mainly in the macros that handle the clipboard related items on the Edit menu, and in their toolbar and keyboard equiva lent s. CLIP board COPY If the cursor is on the com mand line, the content s of the com mand line se lec tion are copied to the clipboard, re plac ing any previ ous content s of the clipboard. If there is no com mand line se lec tion, KEDIT will inste ad copy the current ly marked block to the clipboard. Com mand line se lec tions are possi ble only if INTER FACE CUA is in effect.

If the cursor is in the file area, the content s of the current ly marked block are cop- ied to the clipboard, re plac ing the previ ous content s of the clipboard. An error message is display ed if there is no block marked in the current file.

The Edit Copy menu item, the Copy to Clipboard toolbar button, Ctrl+Delet e, and (if IN TER FACE CUA is in effect) Ctrl+C all is sue the CLIP BOARD COPY com- mand. CLIP board CUT This does the same thing as CLIP BOARD COPY (that is, it cop ies the con tents of s d

a marked block or com mand line se lec tion to the clipboard), and then it delet es the n data involved from your file or from the com mand line. a m m

The Edit Cut menu item, the Cut to Clipboard toolbar button, Shift+Del, and (if o

IN TER FACE CUA is in effect) Ctrl+X all is sue the CLIP BOARD CUT command. C CLIP board PASTE If the cursor is on the com mand line, data from the clipboard is copied to the KEDIT com mand line at the cursor posi ti on, replac ing any exist ing com mand line selec tion. You can only paste a single line of text from the clipboard to the com - mand line. If there are mul tiple lines of text in the clip board, at tempts to paste to the comm and line will cause an er ror mes sage. Any tab char acters in data pasted to the com mand line are changed to blanks.

If the cursor is in the file area, data from the clipboard is copied into your file. If INTER FACE CUA is in ef fect and you have just marked an anchored block (that is, marked a block with the mouse or with Shift+cursor -pad-key), KEDIT first de- letes the block, then posi ti ons the cursor at the loca ti on of the delet ed block, and then in serts the clip board’s con tents at that lo ca tion. Oth er wise, KEDIT in serts the marked block at the cursor position.

CLIPBOARD 39 If the clip board data came from a KEDIT stream block, from a KEDIT comm and line se lec tion, or from some appli cati on other than KEDIT for Windows, it is in- serted into your file at the cur sor po sition as a stream of text. If the data came from a KEDIT box block, it is insert ed at the cursor posi ti on as a rect angu lar sec tion of text. If the data came from a KEDIT line block, it is in serted be low the cur sor line as a group of new lines.

Tab charac ter s in clipboard data pasted into your file from other appli cati ons are expanded to blanks. If TABSIN OFF is not in ef fect, KEDIT does this accord ing to the current TABSIN colum n set tings; other wise KEDIT uses the current SET TABS columns.

The Edit Paste menu item, the Paste from Clipboard toolbar button, Shift+Ins, and Ctrl+V all issue the CLIP BOARD PASTE command. CLIP board AP PEND CUT CLIP board AP PEND COPY If there is no text in the clip board, these com mands have the same ef fect as CLIP - BOARD CUT and CLIPBOARD COPY. Other wise , these com mands append the content s of the current selec tion to the exist ing clipboard text.

If text is al ready in the clipboard and it does not end in a new line sequence (a car- riage re turn and a line feed), these char acters are added to the ex isting clip board text before the content s of the selec tion are appended. CLIP board PUT text CLIP board AP PEND PUT text CLIP BOARD PUT pro vides a way to directly set the con tents of the clip board from within a KEDIT macro.

The speci fie d text replac es, or is appended to, any exist ing text in the clipboard.

For CLIPBOAR D APPEND PUT, if text is al ready in the clipboard and it does not end in a new line se quence (a car riage re turn and a line feed), these char acters are added to the exist ing clipboard text be fore the new text is appended. CLIP board CLEAR The clipboard is empti ed of any data that it contai ns.

CLOCATE

Format CLocate column-tar get

Description Use the CLOCATE comm and (‘‘col umn locate’’) to locate a col umn tar get. KEDIT changes the focus colum n (and in some situ a ti ons the focus line) so that it is posi tioned at the col umn tar get that you specify.

Col umn targets, dis cussed in detail in User’s Guide Chapter 6, “Targets”, are a special type of tar get used only with the CDELETE and CLOCATE com mands.

40 Chapter 3. KEDIT Commands If you issue the CLOCATE com mand with no operands, KEDIT will re-execute the last CLOCATE com mand issued from the com mand line, searching again for the same col - umn tar get. Opera ti on of the CLOCATE com mand is affected by the setti ngs of ZONE, CASE, ARBCHAR, VARBLANK, HEX, WRAP, STAY, and STREAM. If THIGHLIGHT ON is in effect, as it is by default, KEDIT will high light strings found by CLOCATE on your display .

Examples CL 1 The focus col umn moves one colum n to the right of its current positi on.

CL :20 The focus col umn moves to colum n 20.

CL * The focus col umn moves one colum n beyond the right zone colum n.

CL /ABC/ The focus col umn moves to the first charac ter of the next occurrence of ‘‘ABC’’. If STREAM OFF is in effect, this occurrence must be on the focus line. If STREAM ON is in effect and the occurrence is not on the focus line, the focus line locati on also changes.

CL ~/X/ The next col umn that does not contai n an ‘‘X’’ becomes the focus colum n.

CL -/Hello/ s

KEDIT searches the focus line, starting one colum n to the left of the focus colum n, for d n

the string ‘‘Hello’’. If ‘‘Hello’’ is not found by the time the search reaches the left zone a col umn, and if STREAM ON is in effect, KEDIT searches the lines preced ing the focus m m

line, from right to left. o C

CMATCH

Format CMATCH [OUTER|IN NER]

Description Use the CMATCH (‘‘col umn match’’) com mand to find a parenthe sis , brace, or bracket that matches the charac ter in the focus colum n. When you work with program ming lan- guages like C that make fre quent use of bal anced pairs of braces and parenthe ses, the CMATCH com mand can help you verify that matching braces and parenthe ses are prop erly positioned.

CMATCH is most useful when assigned to a key or to a toolbar but ton, so that if you press the key with the cursor posi tioned on, for exam ple, a left parenthe sis , the cursor

CMATCH 41 will move to the match ing right paren the sis. By default, the CMATCH command is assigned to Shift+F3.

If the char acter at the focus col umn is a ‘‘{’’ or ‘‘}’’, the CMATCH comm and moves the focus colum n to the matching ‘‘}’’ or ‘‘{’’. The same thing happens with ‘‘(‘‘ and ’’)’’, with ‘‘[’’ and ‘‘]’’, and with ‘‘<’’ and ‘‘>’’.

If you are working in a file with syntax color ing enabled and you are using a parser that defines matching items like parenthe ses, the CMATCH com mand will properl y han dle nested pairs of matching items and will skip over text in quotes or in comments.

If syntax color ing is not enabled, or if the active parser does not handle the item at the focus colum n, CMATCH will still handle nested pairs of parenthe ses, braces, and brackets , but will not properl y han dle parenthe ses, braces, and brackets inside com - ments or quotes.

CMATCH can also handle matching keywords that are defined in a syntax color ing parser. For exam ple, in a KEXX macro contai ning the fol lowing:

if a = 5 then do j = 17 do I = 1 to 10 say i*j end end

you can place the cursor on the DO at the end of the first line and press Shift+F3 to move the cursor to the corre spond ing END in the last line.

The OUTER and INNER operands control what happens with matching items for which the syntax color ing parser has defined beginning, middle, and end elem ents. With CMATCH OUTER and CMATCH with no operands, the cursor will move between the beginning and end ele ments. With CMATCH INNER, the cursor will move to the next beginning, middle, or end element.

For exam ple, in the fol lowing C code each of #if, #elif, #else, and #endif are high - lighted by the syntax color ing facil ity:

#if de fined(a) x = 17; #elif de fined(b) x = 19; #else x = 20; #endif

If the cursor is positi oned on any of these items, CMATCH OUTER and CMATCH with no operands will move the cursor to the next outer ele ment. If the cursor is on #if, #elif, or #else, it will move to #endif. If the cursor is on #endif, it will cycle back to #if.

With CMATCH INNER, the cur sor will stop at inner items as well as outer items, mov - ing from #if to #elif to #else to #endif and back to #if again.

42 Chapter 3. KEDIT Commands CMSG

Format CMSG [text]

Description The CMSG (‘‘com mand line message ’’) com mand, used prim aril y in macros, display s the spec i fied text on the com mand line.

See also DMSG, EMSG, MSG, WMSG

Examples CMSG mod ify zone KEDIT display s ‘‘modify zone’’ on the com mand line.

COMMAND

Format COMMAND command

Description KEDIT usuall y checks each com mand issued from the com mand line to see if you have used the SET SYNONYM com mand to redefine its behavior . If so, KEDIT proces ses the com mand as spec ifie d in the synonym defi ni ti on. The COMMAND com mand allows you to bypass this synonym proces sing, so that the com mand is execute d exactly as you spec ifie d it, and any synonym for the command is ignored.

COM MAND is useful mainly when issued from the com mand line, because the nor mal action for com mands issued from macros is to bypass synonym proces sing. When you want synonym proces sing to apply to a com mand issued from within a macro, you must spe cif ically request it via the SYNEX command. s d n The effect of the COM MAND com mand is simi lar to the effect of pre serv ing the sta tus a of SYNONYM, setti ng SYNONYM OFF, issuing the desired com mand, and restoring m m

the status of SYNONYM. o C See also SYNEX, SET SYNONYM

Examples COMMAND DELETE 3 KEDIT directly exe cutes the DELETE 3 com mand, regardles s of whether you have defined a synonym for the DELETE com mand.

COMMAND 43 COMPRESS

Format COMPress [target ]

Description The COMPRE SS com mand com presses strings of one or more blanks in your text, replacing them with tab charac ter s. If you issue the COM PRESS com mand with no operands, the focus line is compressed . Oth er wise, all lines in the target area are com - pressed. After the com pression, the focus line locati on is unchanged if STAY ON (the default) is in effect; oth er wise, the last line compressed becomes the new focus line. To com press a line, the COM PRESS com mand looks at each tab col umn in the line (as set with the SET TABS com mand). Any string of one or more blanks leading up to the tab col umn is replaced by a sin gle tab char acter (char acter code 9). For example, assume that you have issued SET TABS 1 6 11 16 and that the focus line looks like this (with each pair of charac ter s start ing in a tab posi tion):

AB CD EF GH Com press ing the line yields the follow ing (with tab charac ter s shown here as plus signs (‘‘+’’)):

AB+CD+EF+GH The COMPRE SS com mand can be use ful in com bina ti on with the EXPAND com - mand, which expands lines by replacing tab charac ter s with strings of blanks extending to the next tab positi on. For exam ple, if you had a 20-line table with entries lined up in colum ns 1, 6, 11, 16 and wanted to readjust the table entries to start in colum ns 1, 10, 20, 30 you could first issue

SET TABS 1 6 11 16 and then com press the table with

COMPRESS 20 Then you would set up tab posi tions for the new table:

SET TABS 1 10 20 30 and finally expand the tab char acters cre ated by the COM PRESS comm and accord ing to the new tab posi tions:

EXPAND 20 In the above exam ple, expanding the sam ple line using tab posi tions 1, 10, 20, 30 yields

AB CD EF GH Com press ing a line of text that contai ns no tab charac ter s and then, without changing the tab set tings, imme di ately expand ing it restores the line to its orig inal state.

44 Chapter 3. KEDIT Commands The COM PRESS and EXPAND comm ands are rel atively rarely used. More frequen tly used are the SET TABSIN and SET TABSOUT com mands, which control whether KEDIT auto mati cally expands tab char acters in a file when it reads the file in from disk and com presses them when it writes the file out to disk.

See also EXPAND, SET TABS, SET TABSIN, SET TABSOUT

Examples COMPRESS BLOCK All lines in the current ly marked line block are com pressed according to the current tab set tings.

COMPRESS :12 All lines from the focus line to line 12 (but not including line 12) are com pressed according to the current tab setti ngs.

COPY

Format COpy target1 target2 COpy BLOCK

Description Use the COPY com mand to copy text from one locati on to another.

There are two forms of the com mand: COpy target1 target2 All text in the target area spec ified by target1 is copied, with the copied text placed im me di ately af ter the line spec i fied by target2. With this form of the com mand, the s d

tar get area spec i fied by target1 cannot be a box or stream block and text can only n be copied within the current file, and not from one file in the ring to another. a m

COpy BLOCK m o

This form of the COPY com mand copies all text in the current ly marked block. C The block can be in the current file or in another file, al lowing you to copy text from one file to another . If the block is a line block, text is copied after the focus line. If the block is a box or stream block, text is copied to the left of the text at the focus colum n posi ti on. The block mark moves with the copied text; the old copy of the block is no longer marked. COPY BLOCK is as signed by de fault to Alt+C and Alt+K. Alt+K cop ies the block but leaves the copy marked. Alt+C copies the block, and then uses the RESET com mand to unmark the block. You can also copy blocks by using the Copy button on the defaul t bot tom toolbar, by using Ctrl+mouse but ton 1 to drag and drop the block, and by using the Edit menu to copy the block to the clipboard and then paste it to a new loca ti on.

See also MOVE

COPY 45 Examples In the follow ing exam ples, assume that line 4 is the focus line.

COPY :12 /ABC/ Lines 4 through 11 are copied follow ing the next line contai ning ‘‘ABC’’.

COPY 6 :15 Lines 4 through 9 of the current file (a total of six lines) are copied follow ing line 15 of the cur rent file.

COPY BLOCK -* A copy of all lines in the current ly marked block is placed fol lowing the top-of-file line. This form of the com mand works only if there is a line block marked in the current file.

COPY BLOCK If the current ly marked block is a line block, KEDIT copies its content s follow ing line 4 of the file. If the block is a box or stream block, KEDIT copies the block to the left of the focus colum n positi on.

COUNT

Format COUnt /string/ [target ]

Description Use the COUNT com mand to count the num ber of occurrence s of a given string in the spec i fied tar get area of your file. (If no tar get is speci fie d, KEDIT counts the occur- rences of string in the focus line.)

The string that you search for is spec ified in the same way as the string you search for with the CHANGE com mand. Slash (‘‘/’’) char acters are nor mally used to delimit strings, but you can use any specia l charac ter that does not appear within the string.

You can make the COUNT com mand operate within the current ly-defined block by using BLOCK as the tar get operand. The COUNT com mand will operate within the porti ons of a line or stream block that are within the current zones, and will operate within the entire area of a box block, regardles s of the zone columns.

If the tar get area is a box block, KEDIT counts all occurrence s of string within the boundari es of the block. Other wise , KEDIT counts all occurrence s of string within the current ZONE set tings.

The search for occur rences of string is also affected by the set tings of ARBCHAR, CASE, and HEX, in the same way that these set tings affect the search for the string1 operand of the CHANGE com mand.

When the COUNT com mand com pletes, it display s a message giving the num ber of occurrence s of the string that were found and the num ber of lines exam ined that con - tained occur rences of the string. If STAY OFF is in effect, the last line examined by the

46 Chapter 3. KEDIT Commands COUNT com mand becomes the focus line. With STAY ON, the focus line locati on is not affected by the COUNT command.

COUNT with no operands reissues the last COUNT com mand issued from the com - mand line.

When issued from a macro, the COUNT com mand sets the macro vari able COUNT.0 to 2, returns the num ber of occurrence s counted in COUNT.1, and returns the num ber of lines contai ning at least one occurrence in COUNT.2.

Examples COUNT /a/ KEDIT counts the num ber of occurrence s of the let ter ‘‘a’’ in the focus line. Depending on the setti ng of the third operand of SET CASE, only lower cas e ‘‘a’’s or both lower - case and upper case ‘‘a’’s are counted.

COUNT /Mo zart/ ALL KEDIT counts all occurrence s of ‘‘Mozart ’’ in your file.

NOMSG COUNT /Mo zart/ ALL This com mand would be use ful if issued from within a macro. Preced ing the COUNT com mand with NOMSG will suppress any message s to the screen, but the macro vari- able COUNT.1 will be set to the num ber of occurrence s of ‘‘Mozart ’’ in your file, and COUNT.2 will be set to the num ber of lines involved.

COVERLAY

Format COVerlay text s d n a

Description The COVERLAY com mand (‘‘col umn overlay ’’) overlay s the text in the focus line, m

starting at the focus colum n, with the text you specify . m o

A sin gle blank sep a rates COVERLAY from the ‘‘over lay text’’ that will over lay data in C the focus line. Wher ever there is a blank in the overlay text, the corre spond ing charac - ter in the focus line is not changed. Wher ever there is an under score char acter (‘‘_’’) in the overlay text, the corre spond ing charac ter in the focus line is replaced by a blank. All other char acters in the over lay text replace the cor re spond ing char acters in the focus line. Assume that the focus colum n is at col umn 1 of your text and that the focus line looks like this: ABCDEFGHIJ If you then enter the com mand

COV 12_456V89 the focus line will be changed to

COVERLAY 47 12 456G89J There is no way to put under score charac ter s (‘‘_’’) into the overlay text without having them convert ed to blanks in the focus line. The CREPLACE com mand does the same thing as the COVERLAY com mand, except that all char ac ters in the text you spec ify with CREPLACE are placed into the focus line, without the spe cial behavior that blanks and underscore s have when used with the COVERLAY com mand. You can use the COVERLAY com mand in connec ti on with the REPEAT com mand to overlay text in a group of lines.

See also CINSERT, CREPLACE, OVER LAY

Examples Assume that the focus colum n is colum n 1.

COVERLAY | | | | This com mand would put bars in colum ns 1, 4, 7, and 10 of the focus line and leave the other charac ter s of the focus line unchanged. The COVERLAY com mand, used in con- necti on with the REPEAT com mand, can be used to help draw boxes and sidebars next to and around existing text.

CREPLACE

Format CReplace text

Description The CREPLACE com mand (‘‘col umn replace’’) replaces char acters in the focus line, starting at the focus colum n loca tion, with the speci fie d text.

For exam ple, assume that the focus line is:

To be or has to be If you issue the com mand

CL :10 the focus colum n will be at the ‘‘h’’ of ‘‘has’’, which is in colum n 10. If you then issue

CREPLACE not the ‘‘not’’ will be placed in col umns 10 through 12, replacing ‘‘has’’:

To be or not to be KEDIT replaces char ac ters in the focus line with the text given with the CREPLACE com mand, from the charac ter after the blank that follows ‘‘CREPLACE’’ through the end of the com mand string, which may contai n trail ing blanks.

48 Chapter 3. KEDIT Commands The CREPLACE com mand does not change the focus colum n or focus line locati on.

See also CINSERT, COVERLAY

Examples CREPLACE 1234 KEDIT replaces text, start ing at the focus colum n, with ‘‘1234’’.

CREPLACE ABCVV KEDIT replaces text, starting at the focus col umn, with ‘‘ABC’’ follow ed by two blanks.

CURSOR

Format CURsor Screen line [col] CUR sor Screen UP|DOWN|LEFT|RIGHT CURsor [Escreen] line [col] CUR sor [Escreen] UP|DOWN|LEFT|RIGHT CUR sor CMdline [col] CURsor Column CURsor File line [col] CURsor Home

CURsor REVERT s d n Description The CURSOR com mand, used mainly within macros, posi tions the cursor within the a current win dow. (Use SOS TABCMDF or SOS T ABCMDB to move the cur sor to a m m

dif fer ent window.) o C CUR sor Screen line [col] Posi ti ons the cursor at a spe cific line and col of the docu m ent window; the upper left cor ner of the docu m ent window is line 1 colum n 1. If the spec ifie d posi ti on is not valid for the cursor (for exam ple, the cursor would move to a reserve d line or beyond the boundary of the window), an error occurs. Line and col can be speci - fied as an abso lut e num ber or as an equal sign (‘‘=’’), where a num ber indi cat es the line or col umn to which the cursor should move, and an equal sign indi cat es that the line or colum n posi ti on of the cursor should not change. CURsor Screen UP|DOWN|LEFT|RIGHT Moves the cursor one row or colum n in the indi cat ed direc ti on. If you try to move UP or DOWN past the highest or lowest possi ble line of the doc um ent window , the cursor wraps to the low est or highest possi ble line. If you try to move LEFT or RIGHT past the edge of the docu m ent window , the cursor moves to the first char- acter on the next line or to the last charac ter on the previous line.

CURSOR 49 CUR sor [Escreen] line [col] For CUR SOR ESCREEN, line and col are spec ified as ab so lute numbers or as equal signs, in the same way as they are for CUR SOR SCREEN, but the lines and colum ns are num bered dif ferentl y: The com mand line is line 0. The first line of the docu m ent window that can contai n a file line is line 1, the second line of the docu - ment win dow that can con tain a file line is line 2, etc. (That is, the ID line, tab line, scale line, etc., are not counted in the num bering.) If the line or col umn spec ifie d is beyond the boundary of the docu m ent window , the line or col umn num ber is ad- justed to the docu m ent window boundary . If the line that the cursor would end up on is above the top-of-file line or below the end-of-file line, the cursor is moved to the top-of-file line or end-of-file line. Colum n num bering starts with the first col- umn of the docu m ent window that can contai n text and ends with the last colum n that can contain text; the prefix area is not counted. CURsor [Escreen] UP|DOWN|LEFT|RIGHT Moves the cursor one row or colum n in the indi cat ed direc ti on, possi bly caus ing verti cal or hori zon tal scrolling if you try to move the cursor beyond the boundary of the file area. CURsor CMdline [col] Moves the cursor to the speci fie d colum n of the com mand line. If col is omitted, the cursor moves to colum n 1 of the com mand line. CUR sor Col umn Moves the cursor to the col umn pointer col umn of the focus line. CUR sor File line [col] Moves the cursor to the speci fie d line and col of the file. If the line and colum n of the file that you spec ify are not current ly display ed in the docu m ent window , KEDIT will not scroll the window to bring them into view. Inste ad, an error will occur. CUR sor Home Moves the cursor to the first colum n of the com mand line if you issue it when the cursor is not on the com mand line. If you issue it when the cursor is on the com - mand line, the cursor moves to the line (and, if possi ble, colum n) of the file that the cur sor was on when the cur sor was last in the file area. If the line of the file in - volved is no longer in the doc um ent window , the cursor moves to the current line. CUR SOR HOME is as signed by default to Shift+F12. CUR sor RE VERT A rarely-used oper a ti on used to make CUA scrolling conven ti ons work out in mac- ros like the de fault Del and Bksp mac ros. If IN TER FACE CUA is in effect, the cursor retai ns its posi ti on in the file when you use the scroll bars to scroll the file, and the cursor may scroll out of the docu m ent window . When this happens, the next non-scroll bar acti on norm ally forces the cursor back into the window at the near est vis ible lo ca tion in the file. CUR SOR RE VERT in stead forces the file to be repo si ti oned in the docu m ent window as it was before scroll ing began, with the cursor in its origi nal posi ti on, undo ing the ef fect of the scrolling. KEDIT inter nally issues CURSOR REVER T com mands be fore execution of the TEXT, EXTEND, and CLIPBOARD commands.

50 Chapter 3. KEDIT Commands See also SOS

Examples CUR SOR SCREEN 8 7 The cursor moves to line 8 and colum n 7 of the docu m ent window , where the upper left corner of the docu m ent window is line 1 colum n 1. An error occurs if this is not a valid cur sor position.

CUR SOR ESCREEN 8 7 CUR SOR 8 7 These are equiva lent , and move the cursor to the eighth line of the window that can contai n a line of your file, and to the seventh colum n of the file area.

CUR SOR ESCREEN = 9 CUR SOR = 9 These are equiva lent , and move the cursor to the ninth colum n of the file area of what - ever line the cursor is on.

CUR SOR FILE 29 44 This moves the cursor to line 29, colum n 44 of your file. If line 29, col umn 44 of your file is not display ed in the current window , an error occurs.

DEBUG

Format DEBUG [/tracesetting] macroname [text] DEBUG START macroname s d

DEBUG STOP macroname n a

Description The DEBUG com mand lets you control which KEXX macros have tracing in effect m m

when they begin execu ti on. This lets you trace the exe cuti on of a KEXX macro that is o not working properl y without the need to edit the text of the macro to insert (and then C later remove) TRACE instruc tions. DE BUG [/tracesetting] macroname [text] This form of the DEBUG com mand is like the MACRO com mand, in that you spec ify the name of a macro to run (macroname) and an opti onal gum ent string (text) to pass to the macro. The dif ference is that the debug ging window will be turned on if it is off and tracing will be in ef fect when exe cu ti on of the macro be - gins. KEDIT will use the ini tial tracesetting that you can opti onall y specify , or it will use the de fault trace set ting con trolled by SET DE BUG GING (which is nor - mally +R, for in ter active trac ing of all clauses and expression results). DE BUG START macroname It is sometimes dif fi cult to is sue the DE BUG command for a macro that is not working cor rectly. For exam ple, if you have a macro assigne d to Alt+A that only fails if that key is pressed with the cursor on the current line, moving the cursor to

DEBUG 51 the com mand line to issue DE BUG ALT+A will not work. The sec ond form of the DEBUG com mand can be used to deal with this problem.

Macroname must be an in-mem ory macro, and it is added to an inter nal list main- tained by KEDIT. Whenever that macro be gins exe cu ti on, the trace setti ng con- trolled by SET DE BUG GING (nor mally +R) will be put into effect.

Using our exam ple, if Alt+A is fail ing only when it is pressed with the cursor on the current line, you could issue the com mand DE BUG START ALT+A Then you can move the cursor to the current line and press Alt+A. The ALT+A macro will then run with the debugger ac tive. DE BUG STOP macroname Cancel s the ef fect of DEBUG START. In our exam ple, when you no longer want to trace ex ecu tion of ALT+A, you can en ter the command DE BUG STOP ALT+A

See also User’s Guide Section 10.4, “Debugging KEXX Macros”, PROFDEBUG ini tial iza tion option, MACRO, SET DEBUGGING , KEXX TRACE instruction

Examples DEBUG COUNTER If the debugging window is not already on, KEDIT turns it on. Then KEDIT puts the level of tracing defined by SET DEBUGGING (which norm ally speci fies +R, for inter- active trac ing of clauses and results) into effect and runs the macro COUNTER.

DE BUG /+I COUN TER If the debugging window is not already on, KEDIT turns it on. Then KEDIT puts a trac- ing level of +I (which means inter active trac ing of clauses and all inter medi ate and final expres sion results) into effect and runs the macro COUNTER.

DE BUG START F5 KEDIT adds the F5 macro to an inter nal list of macro s that will run with the level of trac ing spec ified by SET DEBUGGING (nor mally +R) in effect. When ever F5 is pressed, assum ing the debugging window is on, KEDIT will trace it as it executes.

52 Chapter 3. KEDIT Commands DEFINE

Format DEFine macroname macrodefinition DEFine macroname DEFine fileid

Description Use the DEFINE com mand to give KEDIT the defi ni ti ons of in-mem ory macros. The macros can then be executed via the MACRO comm and or, when the name of a macro corre sponds to KEDIT’s name for a key on your key board, by press ing that key. DE Fine macroname macrodefinition This form of the DE FINE com mand tells KEDIT to de fine a macro called macroname and to assign to it the speci fie d macrodefinition. This method is useful only for short macros whose defi ni ti on can fit com pletely on a single line. DE Fine macroname When you give a macroname but no def ini ti on for it, KEDIT display s the current def i ni tion of macroname, which should be the name of an in-mem ory macro. This form of the DEFINE com mand is provided as a shorthand equiva lent for the QUERY MACRO command. DE Fine fileid With this form of the DEFINE com mand KEDIT loads macro defi ni ti ons, which may be many lines long, into mem ory from the disk file speci fie d by fileid.

If fileid has an exten sion of .KML, the file can contai n the names and defi ni ti ons of many macros. The file must be in KEDIT Macro Library form at, which is dis- cussed in User’s Guide Chapter 10, “Using Macros”. KEDIT searches for .KML s

files in the same places that it searches for .KEX files, which are dis cussed next. d n a

If fileid has an exten sion of .KEX (or any exten sion other than .KML), the file m

must contai n the defi ni ti on of a single macro, with the filenam e com ponent of the m spec i fied fileid taken as the name of the macro be ing defined. o C

If the macro is not in mem ory, KEDIT reads the macro in from a disk file. If fileid con tains a drive or path spec ifi cation, KEDIT reads the macro from the spec ified drive or direc tory . Other wise , KEDIT looks for the macro in your current direc - tory. If this fails, KEDIT looks in any direc to rie s that you have speci fie d via SET MACROPATH. Fi nally, it looks in the “KEDIT Mac ros” subdi rec tory of your Windows Docu m ents or My Docu m ents folder, the direc tory from which KEDIT for Windows was loaded, and the USER and SAMP LES subdi rec tori es of that di - rec tory. If the macro still can not be located, an er ror mes sage is issued and the MACRO command fails.

As dis cussed in User’s Guide Section 10.2.3, “Storing Your Macros”, we norm ally rec omm end that macros that you cre ate be kept in the “KEDIT Macros” sub di rec - tory of your Windows Docu m ents folder (which is someti mes known as the My Doc u ments folder).

DEFINE 53 See also User’s Guide Chapter 10, “Using Macros”, MACRO, MACROS, PURGE, SET MACROPATH

Examples DE FINE F1 do I = 1 to 20; 'input' I; end This DEFINE com mand assigns to the F1 key a macro that inputs the num bers from 1 through 20 into your file.

"DE FINE F1 do I = 1 to 20; 'input' I; end" This is how the DEFINE com mand from the first exam ple might look if you included it in your PRO FILE.KEX file. Since in this case the DEFINE command is a lit eral string contai ned in a macro, it should be enclosed in quotes, and since the string contai ns sin - gle quotes, double quotes are used. DEFINE ESCAPE 'QUIT' This defines a macro called ESCAPE which simply issues a QUIT comm and. Note that ESCAPE is not the name of a KEDIT key. You may have intended to assign this macro to the ‘‘escape ’’ key on the keyboard, but ESC is the correct name to use for that key, so the escape key would not have been rede fined. (See Chapter 7, “Built-in Macro Handling”, for a discus sion of the key names used by KEDIT.) This type of mistake can someti mes lead to confu sion, because while ESCAPE is not the name of any KEDIT key, you have issued a valid DEFINE com mand for a macro called ESCAPE that could be run with the com mand MACRO ESCAPE.

DEFINE RETRY Since only a macro name is spec ifie d here, but no def ini ti on is given for it, KEDIT dis- plays the cur rent def ini tion of a macro called RETRY.

DEFINE KEYS.KML KEDIT assumes that KEYS.KML is a file in KEDIT Macro Library for mat, and loads into mem ory all the def ini tions the file con tains.

DEFINE RETRY.KEX KEDIT defines an in-mem ory macro called RETRY, reading its defi ni ti on from the file RETRY.KEX.

DELETE

Format DELete [target ]

Description Use the DELETE com mand to remove text from the file you are edit ing. All text in the spec i fied tar get area is deleted. If you don’t specify a tar get, only the focus line is deleted.

By default, Alt+D issues the related SOS LINEDEL comm and, which deletes one line from your file. The default Alt+G defi ni ti on, as well as the Delete button on the bottom

54 Chapter 3. KEDIT Commands toolbar, issues the DELETE BLOCK com mand to delete the current ly marked block. If INTER FACE CUA is in effect, you can also delete a block by pressing the Del key immedi ate ly after marking the block with the mouse. If you uninten ti onall y delete too much text from your file, you can use KEDIT’s undo facil ity to try to recover it.

See also SOS LINEDEL

Examples DELETE Deletes the focus line.

DELETE 5

Deletes the focus line and the four lines follow ing it, for a total of five lines.

DELETE *

Deletes all lines from the focus line through the end of the file.

DELETE ALL

Deletes all lines of the file.

DIALOG

Format DIA LOG /prompt/ [options ] s d

where options can be: n a

EDITfield [/initial /] m TITLE /title / m o

OK|OKCANCEL|YESNO|YESNOCANCEL C DEFButton n ICONExclamation|ICONInformation|ICONQuestion|ICONStop FIXEDfont PASSWORD

Description Use the DIALOG com mand within KEDIT macros to display a sim ple dialog box that presents message s to, and optionall y obtains input from, the user of the macro.

Here is how the DIALOG com mand might appear in a macro:

'DIA LOG /Enter Employee Number:/ TITLE /Run Payroll/ EDITFIELD'

The result ing dialog box would look like this:

DIALOG 55 There are five areas in the dialog box that you can control :

· An opti onal titl e field, spec ifie d by the TITLE oper and of the DIA LOG com mand, is display ed on the border at the top of the dia log box.

· A prompt, speci fie d as the first oper and to the dia log com mand, is al ways dis - played. You can use it to prompt a user for input or sim ply to display a message to the user.

· An opti onal edit field, control led by the EDITFIELD opti on of the DIA LOG com - mand, al lows the user of your macro to enter data.

· Mouse- and key board-selectable buttons, which can dis play choices like Yes/No or OK/Cancel , are used to end dis play of the dia log box. (When the EDITFIELD opti on is used, as it is in our exam ple, OK and Cancel buttons are auto m ati cal ly supplied.)

· A bitmapped icon, such as a questi on mark, can be display ed as part of the dia log box.

Here is a descripti on of each of the possi ble operands for the DIALOG com mand. The /prompt/ oper and is required; all of the others are optional. /prompt/ The speci fie d prompt text, which must be enclos ed in de lim it ers, is dis played in the prompt field of the di alog box. If the text of the prompt is too wide for a di alog box, KEDIT au to mati cally wraps the text across mul tiple lines, split ting it at word boundari es. KEDIT also starts a new line wherever the prompt contai ns a carria ge re turn (char acter code 13), a line feed (char acter code 10), or a car riage return-linefeed pair. TI TLE /ti tle/ The speci fie d ti tle, which must be enclos ed in de lim it ers, is dis played on the bor- der at the top of the dia log box. EDITfield [/ini tial/] The EDITFIELD opti on tells KEDIT to display an editable field in the di alog box, so the user can enter a line of input for your macro. You can opti onall y specify , in de limit ers, text to be used as the initial con tents of the edit field. When the DI A -

56 Chapter 3. KEDIT Commands LOG com mand com pletes, the content s of the edit field are returne d to your macro in the variable DIALOG.1. OK|OKCANCEL|YESNO|YESNOCANCEL These opti ons control which buttons are display ed at the bot tom of the dia log box: ‘‘OK’’; both ‘‘OK’’ and ‘‘Cancel ’’; both ‘‘Yes’’ and ‘‘No’’; or ‘‘Yes’’, ‘‘No’’, and ‘‘Cancel ’’. The de fault, unles s the EDITFIELD opti on is present, is OK. If EDITFIELD is pres ent, OKCANCEL is the defaul t and the only allowed choice. When the DIA LOG com mand com pletes, the text of the button used to close the dia log box is returne d, in upper cas e, in the variable DIALOG.2. DEFButton n DEFBUTTON, which defaul ts to 1 (for the leftmost but ton), control s which of the buttons at the bottom of the dia log box is ini tially highli ghted and is re turned in the vari able DIA LOG .2 if the user of the macro does not selec t some other button. ICONExclamation|ICONInformation|ICONQuestion| ICONStop These opti ons control what icon appears in the dia log box.

By defaul t, if the YESNO or YESNOCANCEL opti ons are used, a questi on mark is display ed. Other wise , the defaul t ac tion is to display no icon. FIXEDfont The prompt text is norm ally display ed in a propor ti onal font; the FIXEDFONT option causes it to display in a fixed-pitch font. FIXEDFONT is useful if there are multi ple lines of text in the prompt and you want certai n colum ns of the text to line up. PASS WORD PASSWORD causes data enter ed into the result ing di alog box to be masked, so that po ten tially sen si tive data is not vis ible on the screen. The PASS WORD operand is only valid when the EDITFIELD oper and is also used, and it must come s

after the EDITFIELD oper and. d n a

DIALOG returns its results through macro variable s, much as the EXTRACT com - m

mand does. Three variables are set: m o di a log.0 2 C

di a log.1 The content s of the edit field when the di alog box was closed, or the null string if no edit field was dis played.

di a log.2 The text, in upper cas e, of the button se lected when the dia log box was closed.

See also User’s Guide Chapter 11, “Sample Macros”, ALERT, POPUP, READV, SHOWDLG

DIALOG 57 DIRAPPEND

Format DIR [filespec ...] DIRAppend [filespec ...]

Description The KEDIT DIR com mand is sim ilar to the DOS DIR com mand. When you issue the DIR com mand, KEDIT create s a file in the PC’s mem ory contai ning directory inform a- tion about the files you spec ify. This file, called DIR.DIR, becomes the cur rent file. The file is norm ally never written to disk. Instead, you work with the directory information and then press functi on key F3 to QUIT from the file to remove it from mem ory. If you use File Close to close a DIR.DIR file, it is removed from mem ory but not written to disk even if it has been modified.

If you issue the DIR com mand with no file spec operand, KEDIT lists inform ati on for all files in the cur rent direc tory. Oth er wise, file spec gives the file name and extension, and optionall y drive and path specifier, of the files you are inter ested in. Asterisks (‘‘*’’) and question marks (‘‘?’’) act as wildcard charac ters , as they do for DIR com - mands issued from the Windows com mand prompt. As shown in an exam ple below, the DIR com mand can proces s more than one file spec at a time. KEDIT sorts the content s of the DIR.DIR file into alpha beti cal order based on the name and extension of the files involved. You can use the SET DEFSORT com mand to change this default sort order. You can also re-sort a DIR.DIR file into a dif ferent order by using the DIRSORT com mand. You can use the SET DIRFORMAT com mand to control how many colum ns of the DIR.DIR file are set aside for the file name and for the file exten sion. By default, KEDIT sets aside 30 col umns for the file name and 10 colum ns for the file extension. With the default of FCASE ASIS in effect, fileid com ponents in lower cas e or in mixed case are dis played as is, but fileid compo nents that are entirely in upper case are dis - played in low er case, since this is gen er ally easier to read. Note that the maxi mum file size that the DIR command will dis play is 2**32-1 (that is, 4294967295), regardles s of the actual size of very large files.

With the default key def ini tions, you can edit one of the files listed in the DIR.DIR file by placing the cursor on the line describing the file you want to edit and pressing Alt+X. If you place the cur sor on a line in the DIR.DIR file that describes a direc tory, as opposed to a file, Alt+X will replace the con tents of the DIR.DIR file with a list ing of the speci fie d directory . While Alt+X lets you move down in the directory tree, Shift+Ctrl+X lets you move up in the tree. Shift+Ctrl+X replaces the con tents of DIR.DIR with a listing of the parent directory of the file described on the cursor line. You can also use the mouse to work with the DIR.DIR file. Double clicking but ton 1 on a line in a DIR.DIR file works like Alt+X does: if the line describes a file, KEDIT begins editing the file; if the line describes a direc tory, KEDIT gives you a list ing of the directory . The Parent Directory button on the DIR.DIR toolbar works like

58 Chapter 3. KEDIT Commands Shift+Ctrl+X, giving you a listing of a parent directory . Other DIR.DIR toolbar but tons let you sort a directory file by name, extension, size, or date. If DIR.DIR is already in the ring when you issue the DIR com mand (because of a DIR com mand issued earli er in your KEDIT session) its content s will be replaced.

The DIRAPPEND comm and does exactly the same thing as the DIR comm and, except that if DIR.DIR is already in the ring when you issue the DIRAPPEND com mand, KEDIT does not replace its content s but instead adds inform ati on about the files you spec ify to the existing content s of DIR.DIR and then re-sorts the entire file in the order spec ified by SET DEFSORT.

Since DIR and DIRAPPEND can cause a file (DIR.DIR) to be added to the ring, the PROFILE, NOPROFILE, PROFDEBUG, and NOMSG options, as discusse d in Chapter 2, “Invoking KEDIT”, can also be given with these com mands.

See also DIRSORT, SET DEFSORT, SET DIRFORMAT

Examples DIR A direc tory list ing of your cur rent direc tory is placed in a file in mem ory called DIR.DIR, which becomes the current file.

DIR D:X*.PAS A directory listing of all files in the current directory of your D: drive whose name starts with ‘‘X’’ and whose extension is .PAS is placed in DIR.DIR.

DIR \ A direc tory list ing of all files in the root direc tory of the cur rent drive is placed in

DIR.DIR. s d n

DIR *.C *.H *.ASM a m

A direc tory listing of all files in the cur rent direc tory with an exten sion of .C, .H, or m

.ASM is placed in DIR.DIR. o C DIRAPPEND *.COM A direc tory list ing of all files in the cur rent direc tory with an exten sion of .COM is added to DIR.DIR, which is then re-sorted in the order speci fie d by SET DIRSORT.

DIRSORT

Format DIRSORT [Date|Exten sion|Name|Path|Size ...]

Description The DIRSORT com mand lets you re-sort the content s of the DIR.DIR file based on the fields you spec ify. (The DIR command puts a direc tory list ing into a file called DIR.DIR. It then sorts the list ing in the order spec ified by the SET DEFSORT

DIRSORT 59 com mand; by default the sort is done according to the name and extension of the files listed.)

The DIRSORT command is valid only if issued while the cur rent file is the DIR.DIR file or is some other file with an extension of .DIR. DIRSORT Date Sorts DIR.DIR ac cord ing to the date and time of each file, with the new est files listed first. DIRSORT Ex ten sion Puts DIR.DIR into alpha bet i cal order ac cording to the file exten sion. DIRSORT Name Puts DIR.DIR into alpha bet i cal order ac cording to the file name. DIRSORT Path Puts DIR.DIR into alpha bet i cal order ac cording to the drive and subdi rec tory of each file. DIRSORT Size Or ders DIR.DIR ac cord ing to the size of each file, with the larg est files listed first.

These operands can be com bined. For exam ple,

DIRSORT EXTEN SION SIZE sorts DIR.DIR according to file extension and, if several files have the same extension, sorts these by size.

The toolbar for DIR.DIR files provides buttons that use the DIRSORT com mand to sort your file by file name, file extension, size and date.

See also DIR, DIRAPPEND, SET DEFSORT

DMSG

Format DMSG [text]

Description The DMSG (‘‘debug message ’’) com mand dis plays the spec ifie d text in the debugging window . The com mand has no effect if DEBUG GING OFF is in effect.

The DMSG com mand is suppli ed as a macro debugging aid. You can display debug- ging inform ati on in the debugging window while your macro is exe cuting to avoid interfer ence with the nor mal KEDIT display.

See also DEBUG, MSG, SET DEBUGGING

60 Chapter 3. KEDIT Commands Examples DMSG En ter ing outer loop If DEBUGGING ON is in effect, KEDIT display s ’’Enter ing outer loop’’ in the debug- ging window .

DOS, DOSNOWAIT, DOSQUIET

Format DOS [command ] DOSNowait command DOSQuiet command

Description Use KEDIT’s DOS com mand to run DOS com mands from within KEDIT. You can run utili ti es, com pil ers, and most other DOS program s. After your com mands have exe - cuted, you return to KEDIT and can resume editing where you left off.

The DOS com mand with no operands opens a DOS window and passes control to it, with KEDIT’s window tem porari ly removed from your display . You remain in DOS, able to issue any num ber of DOS com mands, until you return to KEDIT by issuing the EXIT command.

When you have a single com mand to execute , you can enter the com mand as an oper- and to KEDIT’s DOS com mand. KEDIT execute s the com mand in a DOS window . After the com mand has com pleted, press any key to return from the DOS window to KEDIT.

Using the DOSNOWAIT and DOSQUIET com mands is sim ilar to using the DOS com -

mand and speci fy ing the com mand that you want to exe cute. The three com mands dif - s

fer in how they han dle the DOS win dow that they create: d n a

· When you issue the DOS com mand and specify an op erand as a com mand to be m passed to DOS, the DOS window create d to run the com mand dis plays the mes- m o

sage ‘‘Press any key to conti nue’’ upon com pleti on of the com mand and does not C return con trol to KEDIT un til you press a key. This ensures that you can see any output from that com mand before the DOS win dow disap pears . KEDIT’s window is re moved from your display while the DOS window is active. · The DOSNOWAIT com mand cre ates a DOS window and runs the com mand that you specify . KEDIT’s window is re moved from your display while the DOS win- dow is acti ve. But af ter the com mand com pletes, the DOS win dow disap pears and control im medi ate ly returns to KEDIT, with out ing for you to press a key. · The DOSQUIET com mand cre ates the DOS window as a mini m ized window , so that you norm ally do not see any output from your com mand even as it is exe cut - ing. While the com mand is exe cut ing, KEDIT’s window will re main on your screen but KEDIT will be wait ing for the com mand to com plete. If KEDIT re- ceives any keystroke s or mouse clicks while the com mand is exe cut ing, it will re- store the DOS window to its norm al size on your display . When the com mand finishe s exe cut ing, the DOS win dow is closed and control returns to KEDIT.

DOS, DOSNOWAIT, DOSQUIET 61 Use the WINEXEC com mand, and not the DOS, DOSNOWAIT, or DOSQUIET com - mands, to start another Windows program from within KEDIT. These com mands can start other Windows program s, but only by first creat ing a DOS com mand window , and the WINEXEC com mand avoids this extra overhead.

The com mand string that KEDIT passes to DOS can be up to 4096 charac ter s long, but because of cer tain parame ters that KEDIT itself must include in this comm and string, the practi cal limit for the length of the com mand you issue via DOS, DOSNOWAIT, or DOSQUIET is approxi m ately 4000 charac ter s.

EXITCODE When issued from within a macro the DOS and DOSQUIET com mands, along with the WINEXEC WAIT com mand, return inform ati on about the exit code set by the com - mand that was exe cuted. (DOSNOWAIT and WINEXEC NOWAIT do not return an exit code.) The exit code is only returned if the DOS/DOSQUIET/WINEXEC WAIT command itself gets a return code of 0 (that is, it sets the macro vari able RC to 0).

The exit code is a 32-bit value that is returned in the follow ing macro variable s:

exitcode.0 3

exitcode.1 The exit code from the com mand, as a signed dec im al num ber

exitcode.2 The exit code from the com mand, as an unsigne d deci m al num ber

exitcode.3 The exit code from the com mand, as a charac ter string contai ning the 8 hexa dec i m al digit s of the 32-bit exit code

For exam ple, if you use the DOS com mand to start a com mand shell and you exit from that com mand shell by typing “EXIT -2”, the fol lowing variable s would be set:

exitcode.0 3

exitcode.1 -2

exitcode.2 4294967294

exitcode.3 FFFFFFFE

If you start a DOS com mand prompt and close the com mand prompt window by double-clicking on its close button, or if you use Ctrl+C to interrupt a com mand that does not have its own handler for Ctrl+C, the exit code returned will be C000013A, which indi cates an unhandled excepti on, yielding

exitcode.0 3

exitcode.1 -1073741510

exitcode.2 3221225786

exitcode.3 C000013A

62 Chapter 3. KEDIT Commands Note that exitcode.1 and exitcode.2 in this exam ple, along with exitcode.2 in the pre- ceding exam ple, are 10-digit values that are subject to rounding if you do arithm eti c opera ti ons on them with the default NUMERIC DIGITS value of 9 in effect.

See also WINEXEC

Examples DOS TYPE ABC.TXT The com mand TYPE ABC.TXT will be execute d in a Com mand Prompt window . After the TYPE com mand completes , the results will remain dis played in the DOS win - dow until you press any key. You will then return to your KEDIT session.

DOSQ \TEMP

MKDIR \TEMP will exe cute in a mini mized DOS win dow, and KEDIT’s win dow will remain on the dis play while it execute s. When the com mand has com pleted, the mini - mized DOS ses sion will end immedi ate ly, without wait ing for you to press a key. The DOSQUIET com mand is useful for execu ti on of com mands like MKDIR, which usu- ally generate no output.

DOS

Shells to a Com mand Prompt window , where you can issue a series of com mands. To return to KEDIT, issue the EXIT com mand.

DOWN s d n Format Down [n] a m m o

Description The line n lines below the focus line becomes the new focus line. If n is not spec ified , C the line one line below the focus line becomes the focus line.

The NEXT com mand and the LOCATE com mand with a rela ti ve line num ber tar get perform the same functi on as the DOWN com mand.

See also UP

Examples DOWN The line that is one line below the focus line becomes the new focus line.

DOWN 4

The line that is four lines below the focus line becomes the new focus line.

DOWN 63 DUPLICATE

Format DUPli cate [n [target ]]

Description Use the DUPLICA TE com mand to duplicat e one line or a group of lines n times. If no tar get is given, the focus line is dupli cated. If a tar get is given, all lines in the target area are dupli cated n times. If n is not spec ifie d, the focus line is dupli cated once.

The first line added to the file by the duplica ti on proces s becomes the new focus line.

The DUPLICA TE com mand is assigned by default to functi on key F8 and to Alt+=.

Examples DUP The focus line is dupli cated once. The newly-added line is inserted below the focus line and becomes the new focus line.

DUPLI CATE 6 Dupli cate the focus line six times.

DUP 4 6 The focus line and the five lines after it, for a total of six lines, are dupli cated four times.

DUP 2 BLOCK The current ly marked line block is dupli cated twice.

64 Chapter 3. KEDIT Commands EDITV

Format EDITV GET varname1 [varname2 ...] EDITV PUT varname1 [varname2 ...] EDITV SET varname1 value [varname2 value ...] EDITV SETL varname value EDITV LIST [varname1 ...]

EDITV GETF varname1 [varname2 ...] EDITV PUTF varname1 [varname2 ...] EDITV SETF varname1 value [varname2 value ...] EDITV SETLF varname value EDITV SETFL varname value EDITV LISTF [varname1 ...]

Description You may occasion ally have a set of macros, exe cuted at differ ent times dur ing a KEDIT session, that need to share inform ati on. The variable s norm ally used within KEDIT macros (that is, KEXX variable s) don’t help in this sit ua ti on, because they are local to the macro and their values are not retained after the macro fin ishes exe cut ing. The EDITV com mand, designed for use mainly from within KEDIT macros, provides a soluti on to this problem , allowing val ues deter mined in one KEDIT macro to be accessed by KEDIT macros that you run later. EDITV manip u lates two classes of variables:

· Edit vari ables, which are global to the edi tor and retai n their val ues throughout a s d

KEDIT session. n a

· Mul tiple sets of file vari ables, one set for each file in the ring. File vari ables are m m

spe cific to a par tic u lar file and re tain their val ues un til you re move the file from the o ring with a FILE or QUIT command. C

The EDITV comm and sets, retrieves, or lists these vari ables.

EDITV SET, which you can use either from within a KEDIT macro or from the com - mand line, takes one or more pairs of vari able names and values and for each pair assigns the spec ified edit variable the spec ified value. Vari able names and val ues are sepa rat ed by blanks, and the val ues therefore cannot contai n blanks. For example,

EDITV SET X 17 sets the edit vari able X to ‘‘17’’, while

EDITV SET X 17 Y 19 Z sets the edit vari able X to ‘‘17’’, Y to ‘‘19’’, and Z to a null string.

EDITV 65 EDITV SETL takes the name of an edit vari able and assigns to it a given value, which can contai n blanks. For exam ple,

EDITV SETL S This is a sentence.

sets the edit vari able S to the string ‘‘This is a sen tence.’’

EDITV PUT provides a direct method for assigning the val ues of one or more KEXX macro vari ables to edit variables of the same name. For example, con sider the fol low - ing KEDIT macro:

A = 18 * 2 B = 'Hello' 'EDITV PUT A B'

The first line sets the macro variable A to ‘‘36’’ and the sec ond line sets the macro vari- able B to ‘‘Hello’’. The third line then sets the edit vari able A to have the same value as the macro vari able A, which is ‘‘36’’, and sets the edit variable B to have the same value as the macro vari able B, which is ‘‘Hello’’. After the macro has fin ished, the macro vari ables A and B are gone, but the edit vari ables A and B remain, and can be accessed by subse quent EDITV commands.

EDITV GET does the opposit e of what EDITV PUT does. It is used within a KEDIT macro to set the values of one or more macro variable s to the val ues of edit vari ables of the same name. For example, assume that the macro in the above example had been run, and then the follow ing macro was run:

'EDITV GET A B' 'IN PUT' A B

This macro would retrieve the values of edit vari ables A and B, plac ing these values into the macro variable s A and B. The macro would then input the text ‘‘36 Hello’’ into your file.

Note that EDITV GET and EDITV PUT are valid only when used within KEDIT mac- ros, and cannot be used from the com mand line. Note also that variable names referred to when you use EDITV GET or EDITV PUT should norm ally appear within quoted strings; other wise , the names of the vari ables may not be properl y passed to the EDITV com mand.

EDITV LIST display s the values of one or more edit variable s or (if no vari able names are given) of all edit variable s with non-null values.

If you attempt to GET or LIST the value of an edit variable that has not been assigned a value, a null string is returned.

EDITV GETF, EDITV PUTF, EDITV SETF, EDITV SETLF, EDITV SETFL, and EDITV LISTF follow the above patter n, except that instead of working with edit vari- ables, they work with the file vari ables asso ciated with the cur rent file. There are multi - ple sets of file vari ables, one set for each file in the ring. (EDITV SETLF and EDITV SETFL both do the same thing; they are analo gous to EDITV SETL.)

66 Chapter 3. KEDIT Commands EMSG

Format EMSG [text]

Description The EMSG (‘‘error message ’’) com mand, used mainly in macros, display s the spec i- fied text on the mes sage line as an error message. If BEEP is ON, the EMSG comm and also causes the PC’s speaker to BEEP.

See also ALERT, CMSG, DMSG, MSG, WMSG

Examples EMSG No block cur rently marked KEDIT display s ‘‘No block current ly marked’’ on the message line and, if BEEP is ON, the speaker beeps.

ERASE

Format ERASE fileid

Description KEDIT’s ERASE com mand is sim ilar to the DOS ERASE com mand. You give the file spec ifi ca ti on for the file you want erased from a disk. This involves the file name, extension, and optionall y the drive and path speci fi ca ti on. The speci fie d file is erased from your disk.

The KEDIT ERASE com mand erases files on disk and has no effect on the copies in the PC’s mem ory of files current ly being edited. It is less pow erful than the DOS ERASE comm and, because it does not accept wild card char acters (‘‘*‘‘ and ’’?’’). You can use s d

KEDIT’s DOS com mand to issue the ‘‘real’’ DOS ERASE command. n a m

See also DOS, RENAME m o C Examples ERASE C:ABC.PAS The file ABC.PAS, in the cur rent direc tory of the C: drive, is erased.

ERASE \SONGS\MU SIC.BAS The file MUSIC.BAS, in the \SONGS direc tory of the cur rent drive, is erased.

ERASE 67 EXPAND

Format EXPand [target ]

Description The EXPAND com mand expands tab charac ter s in your text into strings of blanks. If you use the EXPAND com mand with no operands, KEDIT expands the tab charac ter s in the focus line. Oth er wise, KEDIT expands the tab char acters in all lines of the spec i- fied tar get area.

To expand a line, the EXPAND com mand goes through the line looking for tab charac - ters (char acter code 9). When ever a tab char acter is encoun tered, it is replaced by a string of blanks extending to the next tab posi tion (as set by the SET TABS command).

After the expansion, the focus line locati on is unchanged if STAY ON (the default) is in effect; oth er wise, the last line expanded becomes the new focus line.

The EXPAND com mand is most often used in connec ti on with the COMPRE SS com - mand. An exam ple of com pression and expansion is given in the dis cussion of the COM PRESS command.

The COMPRE SS and EXPAND com mands are rarely used. More frequentl y used are the SET TABSIN and SET TABSOUT com mands, which control whether KEDIT autom ati cal ly expands tab charac ter s in a file to blanks when reading the file in from disk and com presses blanks to tabs when writing the file out to disk.

See also COMPRESS, SET TABS, SET TABSIN, SET TABSOUT

Examples EXPAND ALL All tab char acters in all lines in the file are expanded accord ing to the cur rent tab set tings.

EXPAND 2 Tab charac ter s in the focus line and the line below it, for a total of two lines, are expanded according to the current tab setti ngs.

EXTEND

Format EXTEND command

Description EXTEND is a spe cialized comm and used mainly in the macros assigned to Shift+cur - sor-pad-keys that let you extend selecti ons when INTERF ACE CUA is in effect.

68 Chapter 3. KEDIT Commands The EXTEND com mand extends the selec tion from its current anchor point (or, if there is no current selecti on, from the cursor posi tion) to a new locati on. To determ ine the new loca tion, KEDIT exe cutes the com mand; the selec tion is extended to the posi tion occupied by the cursor after the com mand com pletes. For example,

EX TEND SOS CRIGHT CRIGHT would execute the com mand SOS CRIGHT CRIGHT, which would move the cursor two charac ter s to the right. So an existing selec tion would be extended two charac ter s to the right or, if there were no existing selec tion, a two-charac ter selecti on would be marked.

If EXTEND is issued when INTER FACE CUA is not in effect, or when the cur sor is in the pre fix area, EXTEND exe cutes the speci fied com mand but takes no other action. If the cursor is on the com mand line when you issue the EXTEND com mand, a com mand line selec tion is marked or extended; if the cursor is in the file area, a non-persis tent stream block is marked or extended.

EXTRACT

Format EXTract /oper and / ...

Description The EXTRACT com mand, valid only when issued from a macro, provides one method for a KEDIT macro to extract infor mation from KEDIT. KEDIT returns infor mation to your macro by set ting the values of variable s within your macro.

EXTRACT is fully dis cussed in Chapter 5, “QUERY and EXTRACT”. s d n a

FILE, FFILE m m o C Format FILE [fileid] FFile [fileid]

Description Use the FILE com mand when you have finishe d edit ing the current file and you want KEDIT to the edited ver sion of the file to disk. KEDIT writes the file to disk using the fileid that you specify , removes the file from mem ory, and (if you are editing multi - ple files) makes the previ ous file in the ring become the current file. You will norm ally issue the FILE com mand without speci fy ing the optional fileid oper- and. In this case, the file will be writ ten to disk under its cur rent fileid. The cur rent fileid is dis played on the title bar of the file’s docu m ent window and, unless you have changed it with the SET FILEID com mand, is the fileid you origi nall y used when you started edit ing the file with the KEDIT com mand. If you use the optional fileid operand, you can make use of the vari ous short cuts for spec ify ing it discusse d in connec ti on with the SET FILEID command.

FILE, FFILE 69 There is one case where the fileid operand is not optional. If you use the FILE com mand on an unti tled file (the UNTI TLED.n files used when you start KEDIT without specifying a fileid or use the File New menu item), you must tell KEDIT the fileid to use for the disk file that is cre ated.

Using the File command is sim ilar to using the File Close menu item on a mod ified file and, when prompted, spec ify ing that the file should be saved. Note that the File Close menu item removes unmodi fie d files from mem ory without writing them to disk, while the FILE com mand always writes a file to disk, even if it has not been modified.

Like the more-fre quently-used FILE com mand, the FFILE com mand writes the current file to disk and then removes the current file from the ring. The dif ference between the com mands is that there are two sit ua ti ons in which the FILE com mand will give you an error, to warn you that you may be inadver tent ly overwrit ing some data, while the FFILE com mand will write your file to disk regardles s of the possi ble problem.

The first sit ua ti on occurs when you begin edit ing a file with one fileid, but then want to write it to disk with a new fileid. If a file with the new fileid already exists, the FILE com mand gives you an error message , because you may not intend to overwrit e the exist ing file.

A sec ond sit ua ti on occurs if some other proces s on your system , or some other user on your network, has changed the file you are edit ing during your editing session. KEDIT tries to deter mine if the file has changed by look ing at the time the file was last updated and seeing if this has changed since you began editing the file (or last saved it to disk). If TIMECHECK ON, the default, is in effect, the FILE com mand gives you an error mes sage if you attempt to write to a file whose timestamp has unex pect edly changed.

In both of these cases, you can use the FFILE com mand instead of the FILE com mand to indi cate to KEDIT that you are aware of the sit u a tion and that you still want to write your file to disk.

See also SAVE, SSAVE, QUIT, QQUIT, SET BACKUP, SET TIMECHECK

Examples In these examples, assume you are editing a file called A:\PROG\SAMP.PAS and that the cur rent default drive is C, with C:\MAIN as the cur rent direc tory.

FILE KEDIT would write the file to disk under the name A:\PROG\SAMP.PAS and then remove it from the ring.

FILE A:\ KEDIT would write the file to A:\SAMP.PAS and then remove it from the ring.

FILE =.CAL KEDIT would write the file to disk under the name A:\PROG\SAMP.CAL and then remove it from the ring.

70 Chapter 3. KEDIT Commands FILE C: Since you are speci fy ing a dif ferent drive for the file, but do not specify a directory , KEDIT uses the current directory of the new drive. KEDIT would write the file to C:\MAIN\SAMP.PAS and then remove it from the ring.

FILE SAMP3.PAS

KEDIT would write the file to A:\PROG\SAMP3.PAS (since you did n’t spec ify a drive or path, the file’s existing drive and path are used) and then remove it from the ring.

FILE \TEST\ KEDIT would write the file to A:\TEST\SAMP.PAS (the A:\TEST direc tory must already exist) and then remove it from the ring.

FILL, FILLBOX

Format FILL [char] FILLbox [char]

Description The FILL com mand, assigned by default to Ctrl+I (and, with INTERF ACE CLASSIC, to Alt+F) fills a block with cop ies of the spec ified char ac ter, over writ ing the orig inal content s of the block. If no block is marked in the current file, FILL gives you an error. If no char is spec ified , KEDIT fills the block with blanks. s

The FILL com mand fills the entire content s of a box or stream block, from colum n 1 to d n

the trunca ti on colum n, with the speci fie d charac ter . With line blocks, FILL operate s a

between from the left zone colum n to the right zone column. m m o

FILLBOX does the same thing as FILL and exists for com pati bil ity with older versions C of KEDIT, in which the fill oper ati on could only be perform ed on box blocks.

The Actions Fill dialog box or the Fill Block button on the bottom toolbar can also be used to fill a block with copies of the spec ifie d charac ter .

If HEX ON is in effect, you can use hex adec im al or dec im al nota tion to specify the fill char ac ter.

Examples FILL KEDIT replaces the content s of the current ly marked block with blanks.

FILL x KEDIT fills the cur rently marked block with cop ies of the let ter ‘‘x’’.

FILL, FILLBOX 71 FILL X'03'

Assum ing that HEX ON is in effect, KEDIT fills the current ly marked block with cop- ies of the char acter with char acter code 3.

FIND, FINDUP, FUP

Format Find text FINDUp text FUp text

Description The FIND com mand searches forward through your file for a line that starts (in colum n 1) with the text that you specify . That line becomes the new focus line. The search starts with the line below the focus line and conti nues until the desired text is found or the end-of-file line is reached (wrapping to the top of the file if WRAP is ON).

FINDUP (which can also be given as FUP) does the same thing as the FIND com mand, except that KEDIT searches upward for the desired line, beginning with the line above the focus line.

These com mands are included in KEDIT mainly for com pati bil ity with XEDIT. The TFIND com mand is a more general com mand that is prefer a ble in most sit ua ti ons.

KEDIT remem bers the last operand used whenever the FIND, FINDUP, NFIND, or NFINDUP com mands are issued from the com mand line and, if you later issue one of these com mands with no operands, this ’’rem em bered operand’ ’ is reused.

If CASE IGNORE is in effect, an alphabetic char acter in the search text will match either its upper case or low er case equiv alent. Blanks in the search text act as wild card charac ter s, matching any single charac ter , blank or nonblank, in your file. Under score (‘‘_’’) char acters in the search text match blanks in your file.

See also LOCATE, NFIND, NFINDUP, TFIND

Examples FINDUP ABC The next line that begins with ‘‘ABC’’ becomes the focus line.

FINDVVABC

Here, FIND is followed by two blanks. The first blank sepa rat es the com mand FIND from the text to be searched for. The second blank is the first charac ter of the text to be searched for. Since a blank matches any char acter in your file, this comm and will search for a line with any charac ter in col umn 1 and ‘‘ABC’’ in col umns 2 through 4.

72 Chapter 3. KEDIT Commands FIND ABC DEF This com mand searches for a line that has ‘‘ABC’’ in col umns 1 through 3 and ‘‘DEF’’ in col umns 5 through 7, with any charac ter in col umn 4.

FLOW

Format FLOW [target ]

Description The FLOW com mand reform ats the text in a porti on of your file. FLOW with no operands (which is assigned by default to Shift+Ctrl+F and, with INTERF ACE CLASSIC, to Ctrl+F) refor mats the text in the focus para graph. FLOW with a tar get oper and refor mats the text in all para graphs in the target area.

The FLOW com mand adjusts the text within a para graph so that all lines of the para - graph start at the left mar gin col umn (except for the first line of the paragraph, which starts at the para graph indent colum n), and all lines of the para graph contai n as much text as will fit between the left and right mar gins. (The left and right mar gins and the paragraph indent colum n are set with the SET MAR GINS command.)

The SET FORMA T com mand affects other aspects of FLOW’s behavior: whether paragraphs are right-justi fied (by sprinkli ng extra blanks between words on each line to force each line of the paragraph to end in the right mar gin col umn), how KEDIT deter- mines where new paragraphs begin, and whether KEDIT places two blanks or one blank at the end of each sen tence that it reformats.

When the FLOW com mand finishe s, the line below the last line proces sed by the

FLOW com mand becomes the focus line. s d n Notes · Be careful not to use the FLOW com mand in a file that does not contai n a docu - a m

ment di vided into paragraphs. For exam ple, if you issue the FLOW com mand in a m

data file or com puter program , the FLOW com mand could refor m at all of the text o in the file into one large para graph. (You could use the undo facil ity to try to re - C cover from this.)

· You should also be care ful when using the FLOW com mand with a tar get op er and. KEDIT will inter pret all text in the tar get area as belong ing to a para graph, and re- for mat it accor d ingly, which is in ap pro priate if the target area in cludes ti tles, headings, etc.

· The FLOW com mand works by delet ing all of the lines of the para graph involved, and in sert ing the re for matted lines into the file in their place. Any text in the orig i - nal paragraph beyond the trunca ti on colum n is lost, as are any line names asso ci - ated with the lines of the origi nal paragraph.

See also User’s Guide Section 3.11, “Word Processing Facilities”, SET FORMA T, SET MAR GINS

FLOW 73 Examples FLOW This com mand is norm ally assigned to Shift+Ctrl+F. KEDIT reform ats the paragraph in which the focus line is located.

FLOW ALL

KEDIT assumes that your file consis ts of a num ber of paragraphs that need to be refor- matted, and KEDIT reform ats all of them.

FORWARD

Format FOrward [n|*|HALF|m Lines]

Description The FOR WARD com mand causes KEDIT to scroll the current window forward in your file. FOr ward KEDIT scrolls one window forward in your file. This com mand is norm ally as - signed to the Page Down key. FOr ward n KEDIT scrolls n windows forward in your file, as if you had pressed the Page Down key n times. FOr ward * KEDIT scrolls forward all the way to the end of your file, making the end-of-file line becom e the focus line. FOr ward HALF KEDIT scrolls one half-window for ward in your file. FOr ward m Lines KEDIT scrolls forward m lines in your file.

You can also move forward and backward in your file by using the mouse to manipu lat e the ver tical scroll bar.

See also BACK WARD

Examples FORWARD 2 KEDIT scrolls forward two windows in your file, as if you had pressed the Page Down key twice.

FOR WARD 8 LINES

KEDIT scrolls eight lines forward in your file.

74 Chapter 3. KEDIT Commands GET

Format GET [fileid [fromline [forlines]]]

Description The GET com mand reads lines from the disk file you spec ify and inserts them into the file you are edit ing, below the focus line. The last line inserted becomes the new focus line. You can insert an entire disk file or, by using the optional fromline and forlines operands, you can insert any desired porti on of a disk file. fileid The first oper and of the GET com mand is the fileid of the disk file to be insert ed. The disk file is not itsel f changed in any way; only a copy of its content s is insert ed. If no path is speci fie d, KEDIT looks in the current direc tory of the spec ifie d drive. If both drive and path are omit ted, KEDIT looks in the current direc tory of the cur- rent drive and then, depend ing on the value of your PATH setti ng, does a path search for the file, and then looks in the “KEDIT Mac ros” subdi rec tory of your Windows Docu m ents or My Docu m ents folder, in the direc tory from which KEDIT was loaded, and in the USER and SAM PLES subdi rec tori es of that directory.

The short cuts for spec i fy ing a fileid that are discusse d in connec ti on with the SET FILEID com mand can also be used with the GET com mand. fromline Fromline is a nu meric op er and that tells KEDIT which line of the disk file is the first line you want insert ed. If this oper and is not given, the forlines op er and can- not be given ei ther, and the enti re content s of the disk file, starting from line 1, are in serted into the cur rent file. s d

forlines n Forlines tells KEDIT how many lines are to be in serted. If forlines is a num ber, a m

that num ber of lines is insert ed. If forlines is omit ted or given as an aster isk (‘‘*’’), m

all lines start ing from fromline through the end of the disk file are insert ed. o C GET with no operands is used to read in from disk the tem porary file that the PUT com - mand cre ates when you issue the PUT com mand without giving a fileid.

The GET com mand is affected by the set tings of EOLIN, EOFIN, TABSIN, and TRANSLATEIN.

See also PUT, PUTD

Examples GET A:ABC.TXT KEDIT inserts all of ABC.TXT from the cur rent directory of the A: drive into the cur - rent file below the focus line. After comple tion of the oper a tion, the last line inserted becomes the new focus line.

GET 75 GET A:ABC.TXT 12 1 Line 12 of A:ABC.TXT is inserted.

GET A:ABC.TXT 12 GET A:ABC.TXT 12 * In both cases, KEDIT inserts text from A:ABC.TXT into the cur rent file, start ing from line 12 and conti nu ing until it reaches the end of A:ABC.TXT.

GET A:\RW\ABC.TXT 1 15 The first fif teen lines of A:\RW\ABC.TXT are inserted into the cur rent file.

HELP

Format HELP [topic]

Description Use the HELP com mand to display the KEDIT for Windows Help file.

HELP with no operands shows the table of content s for the Help file.

HELP topic shows the Help inform ati on for the spec ifie d topic. If help for the topic cannot be found, the Help program ’s Search dialog box is dis played, so that you can view the list of avail able Help topics.

The topics that you specify can include KEDIT com mands, SET options, QUERY and EXTRACT operands, Boolean func tions, KEXX instruc tions, and built-in KEXX functi ons. You can also get help for KEDIT error message s by speci fy ing the error mes- sage number.

Examples HELP Display the table of content s for the KEDIT for Windows HELP file.

HELP CHANGE HELP C Display Help for the CHANGE com mand --- the Help com mand lets you spec ify legal trunca ti ons of the com mands you want help for.

HELP SET WRAP HELP WRAP HELP SET WR Display help for the SET WRAP com mand.

HELP QUERY ARBCHAR HELP Q ARBCHAR Display help for QUERY ARBCHAR.

76 Chapter 3. KEDIT Commands HELP 2 HELP ERROR 2 Display help for KEDIT error message num ber 2.

HELP SUBSTR HELP SUBSTR() Dis play Help for the KEXX SUBSTR built-in func tion.

HELP SEARCH HELP INDEX HELP CONTENTS You can also display the Search, Index, or Content s panes of the Help file. (Help Con - tents is equiva lent to Help with no operands.)

See also SET HELPDIR

HEXTYPE

Format HEXType

Description The HEXTYPE com mand lets you see the inter nal char acter codes for the char acters in the focus line.

For each char acter , KEDIT dis plays the dec im al value of the code for the char acter , the hex adec im al value of the code for the char acter , and the char acter itself. The deci m al and hex adec im al codes for a char acter are dis played ver tically , directly above the s

character itself. d n a

See also SET HEXDISPLAY, SET VERIFY m m o C HISTUTIL

Format HISTUTIL CLEAR MEMORY|REG IS TRY type|ALL HISTUTIL GET MEMORY|REG IS TRY type HISTUTIL INFO type HISTUTIL RE LOAD type|ALL HISTUTIL SAVE type|ALL

Description HISTUTIL is a specia lize d com mand that can be used to query and manipu lat e the his- tory infor mation (recently-edited files, recent comm ands, etc.) that KEDIT main tains.

The type of history inform ati on involved can be any of the follow ing:

HISTUTIL 77 CMDLINE Com mand line his tory DEBUGGER KEXX debugger history DI A LOG DI A LOG/ALERT com mand EDITFIELD his tory DI REC TORY File Di rec tory di a log his tory FIND Edit Find di alog, Quickfind, Find field of Edit Replac e RECENTFILES File menu list of re cently-ed ited files REPLACEWITH Re place With field of Edit Re place di a log SELECTIVEEDITING Edit Se lec tive Ed it ing his tory

The dif ferent forms of the HISTUTIL com mand work as follows:

HISTUTIL HISTUTIL CLEAR MEM ORY|REG IS TRY type|ALL CLEAR

Deletes all his tory of the spec ified type, or of ALL types, from either MEMOR Y or the REG IS TRY.

HISTUTIL CLEAR REG ISTR Y ALL is equiva lent to REGUTIL CLEAR HIST ORY.

HISTUTIL GET HISTUTIL GET MEM ORY|REG IS TRY type

Valid only within macro s. Retrieves the his tory val ues of the spec ified type, either from MEM ORY or from the REGIS Y, set ting the follow ing variable s: HISTUTIL.0 n, where n is the num ber of history items of the type in- volved retri eved from mem ory or from the regis try . HISTUTIL.i For I = 1 to n, holds the value of the ith item from the re - quested his tory list. The higher num bered items are the ones most re cently added to the list.

HISTUTIL INFO HISTUTIL INFO type

Valid only within macros. Returns inform ati on about a type of his tory list by set ting these macro vari ables: HISTUTIL.0 5 HISTUTIL.1 The type involved, in the mixed case used as the name of the sec tion within the reg is try where KEDIT saves its his - tory. HISTUTIL.2 Num ber of history items of this type current ly saved in mem ory by KEDIT. HISTUTIL.3 Maxi m um num ber of history items of this type that KEDIT will save. HISTUTIL.4 Max i mum length, in char ac ters, of in di vid ual his tory items of this type that KEDIT will save.

78 Chapter 3. KEDIT Commands HISTUTIL.5 Prefix charac ter s placed in front of values of this type saved by KEDIT. This is 3 for FIND and 0 for all other types; the notes be low discuss the FIND pre fix bytes.

For exam ple, the results for HISTUTIL INFO CMDLINE might be: HISTUTIL.0 5 HISTUTIL.1 “Cmdline” (quotes aren't part of the value returne d) HISTUTIL.2 92 HISTUTIL.3 100 HISTUTIL.4 1000 HISTUTIL.5 0

HISTUTIL HISTUTIL RE LOAD type|ALL RELOAD Replaces the cur rent in-mem ory his tory of the spec ified type, or of ALL types, with the history inform ati on of the type involved that is current ly stored in the regis try .

HISTUTIL HISTUTIL SAVE type|ALL SAVE Saves the current in-mem ory history of the spec ifie d type, or of ALL types, to the regis - try, replacing whatever history inform ati on of the type involved was previ ously in the registry.

HISTUTIL SAVE ALL is equiva lent to REGUTIL SAVE HIST ORY.

Notes · The HISTUTIL com mand depends to a larger extent than most KEDIT com mands do on the KEDIT’s inter nal im plem enta ti on detai , and is therefore more likely than most KEDIT com mands are to be subject to incom pati ble changes in future s d

versions of KEDIT. You should not develop macros that depend on the use of the n HISTUTIL com mand unles s you are aware of and are com fortable with this a possibility. m m o

· KEDIT uses vari ous undoc u m ented heuristics, subject to change betwee n versions C of KEDIT, to main tain the in for mation in its his tory lists. For ex ample, pli cate items in dif fer ent his tory lists are au to mat i cally de leted un der dif fer ent con di tions. And the content s of some his tory lists can be af fected by other KEDIT com mands; the Find history list, for ex am ple, is in some cir cumstances affected by LOCATE command targets.

· With the de fault of REGSAVE STATE HIS TORY in effect, KEDIT will au to mati - cally update the history infor m ati on in the Windows regis try at the end of your KEDIT session, overrid ing the changes made to the regis try by any HISTUTIL CLEAR|SAVE REGIS TR Y com mands earli er in the session. If you want to avoid this, you can put REGSAVE STATE|NOSTATE NOHISTORY into effect.

· In the Find his tory list, each search string is pre ceded by three prefix char acters which depend on the opti ons selec ted in the Edit Find di alog box. The first pre fix

HISTUTIL 79 charac ter used with FIND is ‘c’ or ‘_’ depend ing on the Match Case opti on, the sec ond is ‘w’ or ‘_’ depend ing on the Find Whole Words Only opti on, and the third is ‘r’ or ‘_’ depend ing on the Regu lar Expression option.

See also REGUTIL

HIT

Format HIT macroname1 [macroname2 ...]

Description The HIT com mand adds the macros you specify to an inter nal ‘‘HIT queue’’. Whenever KEDIT needs to proces s a key, it first looks to see if any macros are in the HIT queue. If there are, KEDIT does n’t actu ally read a key from the key board and pro cess the macro assigned to that key. Instead, KEDIT proces ses the next macro in the HIT queue. If the HIT queue is empty, KEDIT reads from the keyboard. You can specify multi ple macros in one or more HIT com mands; the HIT queue can hold the names of up to twelve mac- ros. The macros must be in-memory macros.

The HIT com mand is used mainly in macros and is included in KEDIT for com pati bil - ity with earli er versions of KEDIT, where it was useful for getti ng around some of the lim i ta tions of the key redef i ni tion facil i ties. Most sit u a tions where the HIT com mand was used in the past are best handled now with the MACRO command.

The differ ence between using the MACRO comm and to cause a macro to be exe cuted and using the HIT com mand to cause a macro to be exe cuted is this: When you issue the MACRO comm and, the spec ified macro is immedi ately executed, and is effec tively called as a subrou ti ne. When you issue the HIT com mand, the current macro conti nues to run, and the HIT macro is not execute d immedi ate ly, but is instead execute d later, when KEDIT next needs keyboard input. Also, unlike the MACRO com mand, the HIT com mand requires that the macro be an in-mem ory macro; HIT will not look on disk for a macro in a .KEX file.

KEDIT does not look in the HIT queue when you use the READV or DIALOG com - mands, or when proces sing PULL instructi ons issued from macros, and HIT queue entries have no effect on the results of the QUERY LASTKEY com mand.

See also MACRO

Examples HIT F2 XYZ The next time KEDIT needs key board input, it proces ses the F2 macro as if you had pressed the F2 key, and then proces ses the macro XYZ, which must be an in-mem ory macro.

80 Chapter 3. KEDIT Commands IMMEDIATE

Format IMMe di ate macrodefinition

Description The IMMEDI A TE com mand allows you to enter the text of a one-line macro on the KEDIT comm and line and have the macro immedi ately executed by KEDIT. This is useful when you want to run an ‘‘on-the-fly’’ macro in a spe cial situ a ti on, or when you want to try a short test macro to exper im ent with fea tures of KEDIT macros.

Mac ros run via the IMMEDI A TE com mand fol low the same rules as any other KEDIT macro. The macro can contai n more than one clause, with the indi vidual clauses sepa - rated by semico lons.

See also User’s Guide Chapter 10, “Using Macros”, DEFINE, MACRO, KEXX INTER PRET instruc tion

Examples IM ME DI ATE say 1234 * 5.67 KEDIT multi plies 1234 by 5.67 and display s the result, 6996.78.

IM ME DI ATE do I = 3 to size.1() by 3; ':'I; 'upper case'; end

Uppercases every third line of your file.

INIUTIL s d n a

Format INIUTIL SAVE|CLEAR STATE|HIS Tory|SET TINGS m m INIUTIL SAVE SET option o C INIUTIL CON VERT SET TINGS INIUTIL BACKUP CONFIG|HIS Tory INIUTIL GET CONFIG|HIS TORY section name

Description The INIUTIL does the same thing as the REGUTIL com mand. See the descripti on of the REGUTIL com mand for a full descripti on of the operands involved.

(KEDIT for Windows now stores its config u ra ti on inform ati on in the Windows regis - try, but KEDIT for Windows 1.5 and earli er stored this inform ati on in the KEDITW.INI file. So REGUTIL is the newer name for this com mand, but for com pati - bil ity rea sons INIUTIL remains available.)

See also HISTUTIL, REGUTIL, SET REGSAVE

INIUTIL 81 INPUT

Format Input [text]

Description The INPUT comm and causes the line of text that you specify to be added to your file after the focus line. The newly-added line becomes the new focus line.

If no text is speci fie d (the com mand line consis ts only of the word ‘‘INPUT’ ’), KEDIT adds a blank line to your file after the focus line, and makes the blank line become the new focus line. What KEDIT does then depends on the set ting of INPUTMODE. With INPUTMODE OFF, the default, the cursor is positi oned in the left mar gin col umn of the newly-added line. With INPUTMODE LINE or INPUTMODE FULL, KEDIT enters Input Mode, as discusse d in the descripti on of SET INPUTMODE. You leave Input Mode by press ing the Home key.

See also REPLACE, SET INPUTMODE

Examples I Hello there. A line consis ting of ‘‘Hello there.’’ is added to your file, becom ing the new focus line.

INPUT A blank line is added to your file. This line becomes the focus line. Depending on the set ting of INPUTMODE, you may enter KEDIT’s Input Mode.

JOIN

Format Join [ALigned]

Description The JOIN com mand joins two lines together into a single line. The JOIN com mand is usuall y issued from a macro assigned to a key. (It is assigned to Alt+J by default.) Text from the line below the focus line is joined to the focus line starting at the focus colum n, overlay ing any text at or to the right of the focus colum n. When you issue the JOIN com mand with no operands, text starting at colum n one of the line below the focus line is joined to the focus line. JOIN ALIGNED (which Alt+J norm ally uses) adjusts for the fact that the two lines involved may be indented from col- umn one, and that you usuall y want the JOIN opera ti on to ignore leading blanks that are present solely because of indenta ti on. JOIN ALIGNED therefore looks at how many leading blanks the focus line has, and ignores up to that many leading blanks in the line below the focus line. (See the exam ple below for an illustra tion of the dif ference between JOIN and JOIN ALIGNED.)

If the line that results from the join opera ti on would be too long (that is, if the line would extend beyond the trunca ti on colum n), KEDIT issues an error message and does not carry out the join.

82 Chapter 3. KEDIT Commands The JOIN com mand does not affect the positi on of the focus line or focus colum n.

See also SPLIT, SPLTJOIN

Examples Assume that the focus line and the line below it have the fol lowing content s, with the first nonblank charac ter of each line in colum n 5 and the cursor posi tioned at the aster isk:

VVVVFirst line’s textV* VVVVNext line’s text JOIN would join all of the second line, including the leading blanks, yielding

VVVVFirst line’s textVVV VVNext line’s text Since the first line is indented by four col umns, JOIN ALIGNED would ignore the four blanks at the start of the sec ond line, result ing in

VVVVFirst line’s textVNext line’s text

KEDIT

Format Kedit [fileid ...] [(options [)]]

Description Use the KEDIT com mand to begin editing one or more addi tional files. (A com mand called XEDIT, which per forms exactly the same func tions as the KEDIT comm and, is also avail able.)

You will usu ally spec ify the fileid of the file you want to edit. If your fileid contai ns s both a drive and path speci fi ca ti on, KEDIT looks only there for the file. If no path is d n

spec ifie d, KEDIT looks in the current directory of the spec ifie d drive. If both drive and a

path are omit ted, KEDIT looks in the default directory of the current drive, then does a m

path search control led by the SET PATH option. Then it looks in the “KEDIT Mac ros” m subdi rec tory of your Windows Docu m ents or My Docu m ents folder, in the directory o C from which KEDIT was loaded, and in the USER and SAM PLES subdi rec tori es of that direc tory. The short cuts for spec i fy ing a fileid that are discusse d in connec ti on with the SET FILEID com mand can also be used with the KEDIT command.

If a file with the spec ified fileid is already being edited (that is, it is already in the ring of files being edited), that file becomes the cur rent file. If there is no file with the spec i - fied fileid in the ring, the file is read in from disk and made the current file. If no file with that fileid exists even on disk, KEDIT adds an empty file with the given fileid to the ring and makes it the current file.

Note that using the KEDIT com mand and speci fy ing a fileid is very simi lar to using the File Open dialog box to begin edit ing a file.

You can add more than one file to the ring at a time by spec ify ing more than one fileid operand or by using wildcard charac ter s in the fileid spec i fi ca tion. Asterisks ("*") and questi on marks ("?") in a fileid act as wild card char acters, just as they do when you

KEDIT 83 issue DIR com mands in KEDIT or from the Windows com mand prompt. Note that you are lim ited to a maxi m um of 500 files in the ring, and that since KEDIT loads all of the files you are edit ing into mem ory, loading a large num ber of files at once may be time consum ing and may use up a signif i cant amount of mem ory. If KEDIT is loading a set of files and encounter s an error while loading one of those files, the KEDIT com mand is aborted and the remaining files are not processed.

If you issue the KEDIT com mand with no fileid operand, but you do specify the UNTITLED option

KEDIT (UNTI TLED

KEDIT adds a new untitl ed file (UNTITLED. n) to the ring. This is equiva lent to using the File New menu item.

If you issue the KEDIT com mand with no operands at all (this is the default def ini ti on for Shift+F4), the next file in the ring becomes the current file. If there is only one file in the ring, the KEDIT com mand issued with no operands has no effect. (You can use the QUERY RING command to see a list of all files in the ring.)

If you issue the KEDIT com mand with a minus sign (‘‘-’’) as an operand

KEDIT -

the preced ing file in the ring will become the current file.

You can also use the mouse to cycle through the ring of files you are editing. You can use the Next File button on the toolbar to move to the next file in the ring, and the Pre vi- ous File but ton to move to the previ ous file in the ring.

When you issue the KEDIT com mand with the fileid operand to add a file to the ring, you can specify the PROFILE, NOPROFILE, PROFDEBUG, LOCK, NOLOCK, NOREG, NOINI, NOMSG, NEW, NODEFEXT, UNTITLED, and NOFILEMENU options for the com mand in the same way as discusse d in Chapter 2, “Invoking KEDIT”.

See also Section 2.4, “Editing Additional Files”, User’s Guide Section 3.5, “Editing Multiple Files”, SET FILEID

Examples Assume you are cur rently edit ing two files, A:\ABC.DEF and A:\XYZ.XYZ, and that A:\ABC.DEF is the cur rent file.

KEDIT

This would make A:\XYZ.XYZ, the next file in the ring, become the current file.

KEDIT

This would cause KEDIT to wrap around to the beginning of the ring again, making A:\ABC.DEF become the cur rent file.

84 Chapter 3. KEDIT Commands KEDIT C:\HELLO.TXT Since C:\HELLO.TXT is not cur rently in the ring, KEDIT will read it in from disk, adding it to the ring and making it the current file. If C:\HELLO.TXT does not exist, KEDIT adds an empty file with that fileid to the ring.

KEDIT A:\ABC.DEF This makes A:\ABC.DEF, which is already in the ring, become the cur rent file.

KEDIT D:\FIT NESS\WALK.TXT D:\FITNESS\RUN.TXT KEDIT adds the files D:\FITNESS\ WALK.TXT and D:\FITNESS\ RUN.TXT to the ring.

KEDIT "D:\FIT NESS\Go for a swim.TXT" KEDIT adds the file ‘‘D:\FITNESS\ Go for a swim.TXT’’ to the ring. Note that fileids that contai n blanks must be enclosed in double quotes.

KEDIT D:\FIT NESS\*.TXT KEDIT adds to the ring all files in the D:\FIT NESS direc tory that have a file exten sion of TXT.

KEDIT \\SERVER\DISKC\BICY CLE.TXT KEDIT adds the file \\SERVER\DISKC\BICY CLE.TXT to the ring. This example uses a UNC (Uni versal Nam ing Conven ti on) name to specify a file located on a net- work server.

KHELP s d n Format KHELP [topic] a m m

Description Use the KHELP com mand to display the KEDIT for Windows Help file. The KHELP o com mand does the same thing as the HELP com mand; it is included in KEDIT for Win- C dows mainly for com pati bil ity with earli er versions of KEDIT. See the descripti on of the HELP com mand for further details.

See also HELP

KHELP 85 LEFT

Format LEft [n|HALF]

Description The LEFT com mand scrolls your view of the file n colum ns to the left. The LEFT com - mand does not affect the content s of your file; it only affects which colum ns of your file are display ed in the docu m ent window .

LEFT with no operands scrolls one colum n to the left. LEFT HALF scrolls half the width of the docu m ent window to the left.

For exam ple, assume that you have issued the com mand

SET VER IFY 40 *

so that col umns 40 through 119 of your file are visi ble in a window 80 col umns wide. Using the LEFT and RIGHT com mands, you can scroll left or right.

LEFT 10

would scroll 10 colum ns to the left, showing you colum ns 30 through 109 of your file.

LEFT 20

would then scroll an addi tional 20 colum ns to the left, showing you colum ns 10 through 89 of your file. (If you go far enough to the left, it is pos sible to have ‘‘imagi - nary’’ colum ns to the left of colum n 1 display ed. This is gener all y not useful, and is allowed only because it lets KEDIT handle certai n sit ua ti ons involving multi ple pairs of VERIFY colum ns consistently.)

The LEFT and RIGHT com mands affect the value of VERSHIFT. VERSHIFT is a num ber that repre sent s the num ber of col umns that your view has been scrolled to the left or right of the col umns spec ifie d by the VER IFY set ting. For exam ple, after the com mands LEFT 10 and LEFT 20, VERSHIFT will be -30, since you have scrolled a total of 30 colum ns to the left. If you then issued a RIGHT 65 com mand, VERSHIFT would be set to 35 (that is, -30 + 65). (You can QUERY VERSHIFT, but you cannot directly set it. Its value is control led by the LEFT and RIGHT com mands, and by the RGTLEFT command. KEDIT’s AUTOSCROLL facil ity also adjusts the value of VERSHIFT.) The comm ands LEFT 0 and RIGHT 0 are spe cial cases. They reset the value of VERSHIFT to 0. It is also reset to 0 whenever you issue a SET VERIFY command.

You can also scroll left and right in your file by using the mouse to manipu lat e the hori - zon tal scroll bar.

See also RGTLEFT, RIGHT, SET VERIFY

86 Chapter 3. KEDIT Commands LEFTADJUST

Format LEFTAdjust [target ]

Description Text in the tar get area is left-adjusted, with the leftmost nonblank char acter of each line moved to the left mar gin col umn.

You can use LEFTADJUST BLOCK, or the Leftadjust Block button on the bottom toolbar, to left-adjust line blocks, box blocks, and one-line stream blocks. Box blocks and one-line stream blocks are given spe cial handli ng: KEDIT left-adjusts the text within the block boundari es, and text outside the block is not affected. You cannot left-adjust a multi-line stream block.

See also CENTER , RIGHTADJUST, SET MAR GINS

Examples LEFTADJUST The focus line is left-adjusted. This is the default assign ment for Ctrl+L.

LEFTA 12 KEDIT left-adjusts the text in the focus line and the eleven lines fol lowing it, for a total of twelve lines.

LESS s d n

Format LESS target a LESS TAG target m m o C Description After you use the ALL com mand or the Edit Selec tive Editing dialog box to select a subset of the lines in your file for display , you may decide that you want to work with a smaller subset of your file. The first form of the LESS com mand, LESS tar get, lets you do this, removing from display all lines matching the speci fie d target.

Sim ilar ly, after you use the TAG com mand to highli ght a subset of the lines in your file, you can use the second form of the LESS com mand, LESS TAG tar get, to turn off high- lighting for all lines that match the spec ified target.

A com panion com mand to the LESS com mand is the MORE com mand, which lets you select or high light more lines rather than fewer lines.

The LESS com mand works by manipu lat ing the selec tion levels or tag bits of the lines in your file. Here are some of the details, which can be ignored by most users of the LESS com mand.

LESS 87 LESS tar get checks whether either of DISPLA Y 0 1 or DISPLA Y 1 1 is in effect. If so, it assumes that you have pre viously issued the ALL com mand to set the selec tion level of some lines to 1, and it resets the selec tion level of all lines match ing the spec ified tar - get to 0. Oth er wise, LESS puts DIS PLAY 1 1 into effect, sets the selec tion level of all lines that match the tar get to 0, and sets the selec tion level of all other lines to 1.

LESS TAG tar get checks whether HIGHLIGHT TAGGED is in effect. If so, it assumes that you have already used the TAG com mand to highli ght some of the lines in your file, and turns the tag bit off for all lines that match the spec ified tar get. If HIGH LIGHT TAGGED is not in effect, LESS puts it into effect, turns off the tag bit for all lines that match the tar get, and turns it on for all other lines.

See also User’s Guide Chapter 8, “Selective Line Editing and Highlighting”, ALL, TAG, MORE

Examples ALL /ABC/ LESS /DEF/ In this exam ple, you first issue the ALL com mand to display only the lines in your file that con tain the string ‘‘ABC’’. If it then turns out that many of the lines with ‘‘ABC’’ also contai n ‘‘DEF’’, and that these lines are not really of interest to you, you can use the LESS com mand in the exam ple to remove them from display .

TAG /ABC/ LESS TAG /DEF/ In this exam ple, you first issue the TAG com mand to highli ght the lines in your file contai ning ‘‘ABC’’. If many of the highli ghted lines also contai n ‘‘DEF’’, and these lines are not of interest to you, you can use the LESS com mand to turn off their high light ing.

LOCATE

Format [Locate] target

Description Use the LOCATE comm and to make the speci fied tar get line become the new focus line. Tar gets are fully described in User’s Guide Chapter 6, “Targets”, and are summ a - rized below. You can also search for text by using the Edit Find dialog box.

The word ‘‘LOCA TE’’ is optional in most cases, and you can norm ally specify tar gets without actuall y entering ‘‘LOCA TE’’. So the fol lowing pairs of com mands are equiv a lent:

/Fred/ LO CATE /Fred/ Both of these look for the next line contai ning “Fred”.

88 Chapter 3. KEDIT Commands :20 L :20 Both of these move to line 20 of your file.

10 LO CATE 10 Both of these move down 10 lines in your file.

An excep tion comes with tar gets that begin with an alpha betic char acter . For example, to locate the next altered line, you can use ‘‘LOCATE ALTERED’’ or can abbrevi ate it to ‘‘L ALTERED’’, but cannot use sim ply ‘‘AL TERED’’.

When using the LOCATE com mand (with or without actuall y using the word LOCATE), you can immedi ately follow the target spec ifi ca tion with another KEDIT comm and that is to be car ried out after the tar get line has been made the focus line. For example,

LO CATE :4 DE LETE 3 This tells KEDIT to make line 4 of your file the focus line and then delete three lines (lines 4 through 6). A more com pli cated exam ple would be

-* /abc/ -2 add This tells KEDIT to make the top-of-file line the focus line, then search from there for the string ‘‘abc’’, then go up two lines and then add a blank line to the file.

Opera ti on of the LOCATE com mand is affected by the setti ngs of ZONE, CASE, ARBCHAR, VARBLANK, HEX, WRAP, and STAY. If THIGHLIGHT ON is in effect, as it is by default, KEDIT will highli ght strings found by LOCATE on your dis play. s d n If you issue the LOCATE com mand with no operands, KEDIT re-exe cutes the last a LOCATE com mand that you issued from the com mand line. By default, Shift+F1 is set m m

to issue a LOCATE com mand with no operands. This allows you to, for exam ple, o locate the line contai ning some string, make some changes to the line, and then press C Shift+F1 to locate the next occurrence of the string.

See also User’s Guide Chapter 6, “Targets”, CLOCATE, FIND, TFIND, SET THIGHLIGHT

Examples /abc/ LOCATE /abc/ These two com mands are equiva lent . Both tell KEDIT to move the focus line pointer to the next line contai ning ‘‘abc’’.

:4 LOCATE :4 These two com mands are equiva lent . Both tell KEDIT to move the focus line pointer to line 4 of the file.

LOCATE 89 LOCATE ,abc/def, ,abc/def, These two are also equiv a lent. Both tell KEDIT to make the next line in the file con tain - ing the string ‘‘abc/def’’ become the focus line. Since the string tar get contai ns a slash (‘‘/’’), which is the usual string delim iter, you have to use some other specia l charac ter as the delimiter (in this case, a comma).

LO CATE WORD /Fred/ Locates the next line contai ning the word ‘‘Fred’’. The word ‘‘LOCA TE’’ is not optional since the tar get spec ifi cation begins with an alpha betic char acter .

Target Here is a sum mary of the types of targets avail able for use with LOCATE and with summary other KEDIT comm ands that take tar gets as operands. See User’s Guide Chapter 6, “Targets”, for more discus sion of KEDIT tar gets.

· Ab so lute line num ber tar gets use a num ber precede d by a colon (‘‘:’’) and give the line num ber of the tar get line.

:10 :30 :999

· Rel a tive line num ber tar gets use a num ber, opti onall y pre ceded by a minus sign (‘‘-’’), and specify the num ber of lines below or above the focus line of the tar get line. ‘‘*’’ and ‘‘-*’’ can be used to refer to the end-of-file line and the top-of-file line. 18 -72 *

· Named line tar gets use a line name pre ceded by a pe riod (‘‘.’’) to refer to lines given a name via the SET POINT com mand or the Acti ons Bookm ark di alog.

.a .xyz2

· String tar gets refer to a line by spec ify ing some porti on of the text contai ned in the line. They can opti onall y be precede d by a minus sign (‘‘-’’) to indi cat e that KEDIT is to look backward in the file for the speci fie d string.

/this week/ -/tomor row/ String targets can be pre ceded by a tilde (‘‘~’’) to in di cate a neg ative string search—a search for a line that does not contai n the speci fie d string.

~/yes ter day/ -~/1776/ You can use logi cal oper a tors to com bine string tar gets. Use am persands (‘‘&’’) to look for a line that contai ns each of two or more strings, and use verti cal bars (‘‘|’’) to look for a line that contai ns any of two or more strings.

/now/ & /never/ /easy/ | /hard/ You can pre cede a string tar get with WORD (which can be abbre vi ate d to ‘‘W’’) to indi cat e that the string must be gin and end on a word boundary . PRE FIX means that the string must start on a word boundary and SUFFIX means that it must end on a word boundary ; these can be abbre vi ate d to ‘‘P’’ and ‘‘S’’.

90 Chapter 3. KEDIT Commands word /the/ prefix /un/ String target searches can be affected by the settings of ZONE, CASE, ARBCHAR, VARBLANK, HEX, WRAP, and STAY.

You can pre cede a string tar get with REGEXP (which can be abbre vi ate d to ‘‘R’’) to in dicat e that the string tar get in volved is spec ifie d using a regu lar expres sion. Reg u lar ex pres sions are summarized below. regexp /[a-z]+./ · Line class tar gets refer to lines accord ing to whether they are blank (BLAnk), ac - cord ing to their se lec tion level (SE Lect n [m]), or accord ing to their flag bits (NEW, CHAnged, TAGged, AL Tered). blank se lect 3 al tered Line class tar gets can be used with nega ti on and with logi cal oper a tors, and can be com bined with string tar gets. ~blank al tered | /ti tle/ · Group tar gets refer to a group of lines, ei ther ALL lines in the file, the current ly marked BLOCK, or all lines in the focus PARAgraph. s d n a m m o C

LOCATE 91 Regular Here is a sum mary of the com ponents of regu lar expres sions: expression summary Item Meaning ? Wildcard character – matches any single character ^ Matches the beginning of a line $ Matches the end of a line [class] Definition of a character class – matches any character in class Definition of a character unclass – matches characters not in [~class] class Parenthetical expressions – groups expressions together for (X) other operations Minimal closure – matches shortest possible string of zero or X* more occurrences of X Minimal plus – matches shortest possible string of one or more X+ occurrences of X Maximal closure – matches longest possible string of zero or X@ more occurrences of X Maximal plus – matches longest possible string of one or more X# occurrences of X X^n Power function – matches exactly n occurrences of X ~X Not function – succeeds only if X isn’t matched Alternation – matches X1 or, if X1 doesn’t match, matches X2, (X1|X2|...) etc. :letter Predefined expression \x Escape sequence \c Set cursor position/current column after Edit Find or CLOCATE Tagged expression – when X is matched the value is saved for {X} later reference &n Reference to value of nth tagged expression

92 Chapter 3. KEDIT Commands LOCK

Format LOCK

Description Use the LOCK com mand to prevent other users on your network, or other proces ses on your own com puter, from accessing the disk copy of a file that you are current ly edit ing.

The LOCK com mand causes KEDIT to lock the current file. That is, KEDIT opens the disk copy of the current file and keeps it open until the file is removed from the ring or until the UNLOCK com mand is issued for the file.

Attempt ing to LOCK a file that is already locked causes an error message. If the cur - rent file is locked, KEDIT dis plays ‘‘Locked’’ on the sta tus line. Addition ally, if the cur rent file is locked and IDLINE ON is in effect, its fileid will be pre ceded on the idline with an aster isk.

See also User’s Guide Chapter 12, “File Processing”, LOCK and NOLOCK initial iza tion options, UNLOCK, SET LOCKING , SET SHARING

LOWERCASE

Format LOWer case [target ]

Description Use the LOW ERCASE comm and to con vert upper case char acters in a spec ified por - tion of your file to low er case char acters. s d n

If you give no operands, the LOWER CASE com mand convert s the focus line to lower - a

case. Oth er wise, all text within the spec ified tar get area that falls within the cur rent m

ZONE colum ns is convert ed. If the tar get area is a box block, its entire content s are m con verted, regard less of the ZONE set tings. If STAY OFF is in effect, the last line o C lowercased becomes the focus line. Other wise , the focus line locati on does not change.

With the default of INTER NA TIONAL NOCASE in effect, LOW ERCASE treats only the 26 let ters from ‘‘A’’ to ‘‘Z’’ and from ‘‘a’’ to ‘‘z’’ as alpha betic. With INTERNATIONAL CASE in effect the char acters to be treated as alpha betic, and what their uppercas e equiva lent s are, are determ ined by your Windows language drivers.

Note that you can use Shift+F6, the Actions Low er case menu item, or the Low er case Block button on the bottom toolbar to lower cas e a block of text.

See also UPPER CASE, SET INTER NA TIONAL

Examples LOWER CASE All upper case char acters in the focus line are con verted to low er case.

LOWERCASE 93 LOWER CASE 6 All uppercas e charac ter s in the focus line and in the five lines follow ing it, for a total of six lines, are con verted to low er case.

LPREFIX

Format LPrefix [text]

Description The LPREFIX comm and places the text that you specify into the prefix area of the focus line and then proces ses all pending pre fix com mands.

The LPREFIX com mand is equiva lent to your moving the cursor to the prefix area of the focus line, typing the text into the prefix area, and exe cuting the SOS DOPREFIX com mand (which is part of the defi ni ti on of the F12 key under INTERF ACE CUA and of the Home key under INTER FACE CLASSIC). LPREFIX is use ful from within mac- ros that need to exe cute prefix com mands. It also provides a way to enter and execute prefix com mands when the prefix area is turned off.

See also User’s Guide Chapter 9, “Tailoring KEDIT”, SET PREFIX

Examples LPREFIX X KEDIT places ‘‘X’’ into the prefix area of the focus line, and then exe cutes this com - mand, along with any other pending pre fix com mands. The X prefix com mand uses KEDIT’s selec tive line edit ing facil ities to exclude the focus line from the display.

LPREFIX KEDIT places ‘‘DD’’ into the prefix area of the focus line, and then exe cutes all pend- ing pre fix com mands. If a matching DD pre fix com mand is already pending, the speci - fied block of lines will be deleted. Other wise , the newly-entered DD com mand will remain pending.

94 Chapter 3. KEDIT Commands MACRO

Format MACRO macroname [text]

Description The MACRO com mand causes KEDIT to run the KEXX language macro speci fie d by macroname. Any text after the macroname is passed to the macro as an argu ment.

If IMPMACRO ON is in effect, as it is by default, you do not usuall y need to issue the MACRO com mand. Whenever KEDIT sees a com mand that it does not recog nize it will auto mati cally look for a macro by that name. This ‘‘implied macro’’ facil ity works only for macros whose names con sist entirely of alphabetic characters.

KEDIT keeps in mem ory the macros involved in the default key and mousebar assign- ments, along with any macros that you have defined or loaded via the DEFINE com - mand. If macroname spec ifies an in-mem ory macro, KEDIT can immedi ately run the macro.

If the macro is not in mem ory, KEDIT reads the macro in from a disk file and runs it, removing it from mem ory after it has com pleted exe cuti on. If macroname does not include a file extension, KEDIT assumes that the macro is in a file with an extension of .KEX. If macroname contai ns a DOS drive or path speci fi ca ti on, KEDIT reads the macro from the speci fied drive or direc tory. Other wise , KEDIT looks for the macro in your current directory . If this fails, KEDIT looks in any directo rie s that you have speci - fied via SET MACROPATH. Finally, it looks in the “KEDIT Mac ros” sub di rec tory of your Windows Docu m ents or My Docu m ents folder, in the directory from which KEDIT was loaded, and in the USER and SAM PLES subdi rec tori es of that directory . If the macro still can not be located, an error mes sage is issued and the MACRO command fails. s d

As dis cussed in User’s Guide Section 10.2.3, “Storing Your Macros”, we nor mally rec- n a

om mend that macros that you create be kept in the “KEDIT Mac ros” subdi rec tory of m

your Windows Docu m ents folder (which is someti mes known as the My Docu m ents m folder). o C

See also User’s Guide Chapter 10, “Using Macros”, MACROPATH ini tial iza tion option, DEBUG, DEFINE, IMMEDI A TE, SET IMPMACRO, SET MACROPATH

Examples MACRO RE VERT Hello KEDIT tries to run an in-mem ory macro named REVERT. If none is found, KEDIT looks on disk for REVERT.KEX. When the macro is run, ‘‘Hello’’ is passed to it as an argum ent, which can be accessed via the ARG() functi on or PARSE ARG instruc tion.

MACRO F3 KEDIT tries to run an in-mem ory macro named F3. Since F3 is the name of a key, F3 will be found in mem ory. Issuing the com mand MACRO F3 is equiva lent to pressing the F3 key.

MACRO 95 MACRO D:\TEST KEDIT runs the macro stored on disk in the file D:\TEST.KEX.

MACROS

Format MACROS [ALL|CHANGED] MACROS macroname1 [macroname2 ...]

Description The MACROS com mand places the defi ni ti ons of one or more of your in-mem ory macros into a file named MACROS.KM L, so that you can view the defi ni ti ons, modify them, and possi bly save them to disk for future use.

Macro def ini tions are placed in MAC ROS.KML in the KEDIT Macro Library for mat nor mally used with .KML files. If MAC ROS.KML is already in the ring of files you are edit ing, the MAC ROS command replaces its con tents. Oth er wise, MAC ROS.KML is added to the ring. The file is cre ated only in mem ory; use the FILE or SAVE com mands if you want to save it to disk. MAC ROS ALL MAC ROS MAC ROS ALL (or MAC ROS with no operands) places the defi ni ti ons of all in-mem ory macros into MACROS.KM L. (Default macro as signm ents for certai n keys with ‘‘un in ter est ing’’ def ini tions, like the 3 key if it simply en ters a ‘‘3’’, are not included.) MAC ROS CHANGED Places the defi ni ti ons of all macros that you have de fined via the DEFINE com - mand into MAC ROS.KML, but does not include KEDIT’s built-in defaul t macro def i ni tions. MAC ROS macroname1 [macroname2 ...] Places the def i ni tions of the spec i fied in-mem ory macro s into MAC ROS.KML.

Since the MAC ROS comm and can cause a file (MAC ROS.KML) to be added to the ring, the PROFILE, NOPROFILE, PROFDEBUG, NOREG, NOINI, and NOMSG options, as discusse d in Chapter 2, “Invoking KEDIT”, can also be used with the MACROS comm and.

You can use QUERY MACRO macroname (or DEFINE macroname with no addi- tional operands) to display the defi ni ti on of a sin gle macro in the message area. You can use MODIFY MACRO macroname to place the defi ni ti on of a sin gle macro, which must have a one line defi ni ti on, on the com mand line for easy modification.

See also DEFINE

Examples MACROS Places the def i ni tions of all in-mem ory macro s into MAC ROS.KML.

96 Chapter 3. KEDIT Commands MAC ROS F1 F2 F3 F4 Places the defi ni ti ons of F1, F2, F3, and F4 into MACROS.KM L.

MARK

Format MARK Line|Box|Stream [PERSIS Tent|SE Lec tion] [An chor|Word] [RE SET] MARK CMDline [SE Lec tion] An chor|Word [RE SET] MARK Line [PERSIS Tent|SE Lec tion] [Anchor] ALL MARK REANCHOR line [col] MARK PERSISTent

Description The MARK com mand, used prim aril y within macros, marks the boundari es of a line, box, or stream block. KEDIT has a num ber of com mands that can operate on the resulting marked block, allowing you to upper case it, delete it, copy it to the clipboard, etc. MARK Line|Box|Stream Marks the focus line as one edge of a line block, or marks the focus colum n as one corner of a box or stream block.

You can only have one block marked at a time. If a block is marked in some file other than the current file when you issue the MARK com mand, that block is reset .

By de fault, Alt+L is sues the command MARK LINE, Alt+B is sues the command MARK BOX, and Alt+Z issues the com mand MARK STREAM. Since no other s

operands are speci fie d, these com mands mark persis tent, unan chored line, box, or d

stream blocks. n a

PER SIS Tent|SE Lec tion m m

There are two types of blocks: persis tent blocks and non-persis tent blocks. Persis - o

tent blocks rem ain marked unti l you expli cit ly unmark them. Non-persis tent C blocks, which are usuall y re ferred to as ‘‘selec tions’’, are unm arked as soon as the cur sor is re po si tioned. Use the PER SIS TENT|SE LEC TION op er and of the MARK com mand to specify whether a persis tent block or a se lec tion is to be marked; PERSIS TENT is the de fault. Se lections are available only when INTERFACE CUA is in effect, and the SE LEC TION op er and is in valid if INTERFACE CLASSIC is in effect. An chor The ANCHOR oper and deter mines how an exist ing block changes size when a new boundary is marked. For an unan chored block, the block will extend from the focus line or colum n to the most distant exist ing boundary of the block. For an an - chored block, the block extends from the focus line or colum n to a fixed ‘‘anchor ’’ posi ti on. Persis tent blocks are by defaul t unan chored but you can use the ANCHOR oper and to mark persis tent anchored blocks. Selec tions are alway s an- chored, so the ANCHOR opti on can be used for selections but is not necessary.

MARK 97 You can use the ANCHOR oper and when you begin to mark a new block to indi - cate that the ini tial boundary of the block is to be the block’s anchor .

You can then use the ANCHOR oper and when you change the size of the block to indi cat e that the block should extend from the focus line or colum n to the anchor . If you use the ANCHOR oper and when extend ing an exist ing block that does not have an anchor , the begin ning of the block becom es the anchor.

By de fault, blocks marked with the mouse or (if IN TER FACE CUA is in effect) with Shift+cursor -pad keys are anchored blocks while blocks marked with Alt+L, Alt+B, and Alt+Z are unan chored blocks. Word The WORD oper and is valid only with stream blocks and causes the MARK com - mand to mark or extend blocks on a per-word basis . If the focus colum n contai ns a nonblank charac ter , the focus word and any trail ing blanks are marked. If the focus colum n contai ns a blank, the inter-word spaces are marked. Using the WORD op- erand also causes the behav ior asso ci ate d with the ANCHOR operand to occur. RE SET Causes any exist ing block to be reset , as if you had issued the RE SET BLOCK com mand, so that the MARK com mand will mark a new block.

Four addi tional forms of the MARK com mand are available : MARK CMDline [SELec tion] Anchor|Word [RESET] MARK CMDLINE, avail able only when IN TER FACE CUA is in effect, marks a com mand line se lec tion. The SELEC TION oper and is opti onal but has no ef fect, since persis tent com mand line blocks are not avail able. Com mand line se lec tions are alway s anchored, and ei ther the ANCHOR or WORD oper and is require d. If no com mand line se lec tion current ly exist s, or if the RESET oper and is used, the cursor posi ti on on the com mand line is marked as the start of a com mand line se - lec tion. Other wise , the exist ing com mand line selection is extended to the cursor position. MARK Line [PER SIS Tent|SE Lec tion] [An chor] ALL This form of the MARK command marks the en tire file as a per sis tent line block (the de fault) or as a line se lection. If you use it to mark the file as a line selec tion when the cur sor is not al ready in the file area, the cur sor is moved to the file area. MARK REANCHOR line [col] MARK REANCHOR extends an exist ing se lec tion or persis tent block to the line and (for box and stream blocks) col umn of the file that you spec ify, and then makes the block an anchored block, with the line and colum n to which the block was ex - tended as the anchor. MARK PER SIS Tent MARK PER SISTENT changes a se lec tion into a persis tent block; it is used by the macro that han dles the Edit Make Per sis tent menu item.

Notes · The MARK com mand is rarely issued from the com mand line, but is inste ad most often issued from within macros. In fact, most of the MARK com mand’s operands exist only to help KEDIT’s defaul t mouse and key board macros work smoothly. If

98 Chapter 3. KEDIT Commands you are making changes to KEDIT’s defaul t behav ior in this area, you may need to use some of these operands. In more ‘‘run-of-the-mill’’ macros that need to mark and then oper ate on some porti on of a file, it is usuall y easi est to stick to MARK LINE, MARK BOX, and MARK STREAM, issued with no other operands so that they mark persis tent, unanchored blocks,

· KEDIT will norm ally not let you have a zero-length selec tion, and consid ers a zero-length selec tion as equiva lent to having no se lec tion at all. A com mand like MARK STREAM SE LECTION RESET would ap pear to create a selec tion ex - tending from the cursor posi ti on to the cursor posi ti on, which would therefore be zero bytes in size, but KEDIT inter nally unmarks such a selec tion as soon as it is cre ated. That is, af ter MARK STREAM SE LEC TION RE SET, EX TRACT /BLOCK/ will in di cate that there is no block marked, and not that there is a zero-length selec tion. An excep ti on to this com es during the proces sing of mouse clicks (that is, during the proces sing of BUTTON1DOWN, etc.), where it is useful to create a zero-length se lec tion that can then be extende d by dragging the mouse. Zero-length selec tions are, therefore, allowed during the proces sing of mouse ac- tiv ity, but if a zero-length se lec tion ex ists after the mouse button is released, it is automatically reset.

See also EXTEND, RESET, QUERY BLOCK, SET DRAG

Examples MARK BOX Mark the focus colum n as one corner of a box block. If there is no existing block in the current file, you will have a one-charac ter box block. If there is an exist ing block, the block will extend from the focus colum n to the farthes t existing cor ner of the block.

MARK LINE AN CHOR RE SET s

Reset any exist ing block, mark the focus line as a one-line line block, and make that the d n

anchor for changes to the block. a m m o

MERGE C

Format MErge target1 target2 [col]

Description The MERGE com mand takes one group of lines, from the current line up to (but not including) the line speci fie d by target1, and merges it with another group of lines, beginning at the line speci fie d by target2.

Each line in the first group is merged into the corre spond ing line in the second group, with colum n 1 of the line from the first group positi oned in the col umn spec ifie d by the col operand, which defaults to colum n 1. Nonblank text from the first line replaces the corre spond ing text from the second line; where there is a blank col umn in the first line, the corre spond ing posi tion in the second line is left unchanged. So, for exam ple, merging the line

MERGE 99 AVAV

with the line

VVBB

would produce

AVAB

After the merge opera ti on is com plete, the first group of lines (whose content s have been merged with the second group) is deleted.

Examples Assume that a file con tains the follow ing six lines, and that line 1 is the focus line:

Ann Pat cy cling h ppy Fred and Jim went swimming Jane and Bob went jogging Edna and Sam were sad

The com mand ‘‘MERGE 3 :4 10’’ would result in:

Fred and Ann went swimming Jane and Pat went cycling Edna and Sam were happy

with the first group of lines, lines 1 through 3, merged with the second group of lines, starting in colum n 10 of line 4, and deleted from their origi nal positi on in the file.

MODIFY

Format MODify option MODify MACRO macroname

Description The MODIFY com mand dis plays the current value of one of the options that you can SET. The value is dis played on the com mand line in the form of a SET com mand for the option, allowing you to change the value by typing over it and then re-entering the modi fie d value of the SET option. The MODIFY com mand takes one operand, the name of the option whose value you want to change. (The name of the option can be abbrevi ate d using the same mini m al trunca ti ons that the corre spond ing SET command allows.)

For com pati bil ity with earli er versions of KEDIT, you can also use the MODIFY com - mand with options that you can QUERY but cannot SET. For exam ple, KEDIT allows you to use MODIFY TIME, even though the SET TIME com mand that is placed on the command line as a result is invalid.

100 Chapter 3. KEDIT Commands You can use a second form of the com mand, MODIFY MACRO macroname, to get the defi ni ti on of an in-mem ory macro, whose defi ni ti on can only be one line long, in a DEFINE com mand on the com mand line for easy modi fi ca ti on.

See also STA TUS, Chapter 4, “The SET Command”, Chapter 5, “QUERY and EXTRACT”

Examples MODIFY BOUNDMARK KEDIT will dis play cur rent BOUNDMARK set tings on the command line. You can then overtype or other wise edit these setti ngs and enter the modi fie d values.

MODIFY DIREC TORY KEDIT display s the current directory on the com mand line. As an excepti on to the usual behavior for the MODIFY com mand the current directory is pre ceded on the comm and line by “CHDIR” and not “SET DIRECT ORY”, because the CHDIR com- mand is KEDIT’s closest equiva lent to the non-existent SET DIREC TORY command.

MOD IFY MACRO XYZ KEDIT will display the current defi ni ti on of XYZ, which must be a one-line in-mem - ory macro, on the com mand line. You can then overtype or other wise edit the def i ni tion.

MORE

Format MORE target

MORE TAG target s d n a

Description After you use the ALL com mand or the Edit Selec tive Editing dialog box to select a m

subset of the lines in your file for display , you may decide that you want to work with a m larger subset of your file. The first form of the MORE com mand, MORE tar get, lets o C you do this, add ing all lines that match the spec ified tar get to the set of selected lines.

Sim ilar ly, after you use the TAG com mand to highli ght a subset of the lines in your file, you can use the second form of the MORE com mand, MORE TAG tar get, to turn on high lighting for all lines that match the spec ified target.

A com panion com mand to the MORE com mand is the LESS com mand, which lets you select or high light fewer lines rather than more lines.

The MORE com mand works by manipu lat ing the selec tion levels or tag bits of the lines in your file. Here are some of the details, which can be ignored by most users.

MORE tar get checks whether either of DISPLA Y 0 1 or DISPLA Y 1 1 is in effect. If so, MORE assumes that you have pre viously used the ALL com mand to select a subset of the lines in your file, and MORE sets the selec tion lev els of all lines that match the

MORE 101 spec i fied tar get to 1. Oth er wise, issu ing MORE tar get is equiva lent to issuing ALL tar get.

MORE TAG tar get checks whether HIGHLIGHT TAGGED is in effect. If so, it assumes that you have already used the TAG com mand to highli ght some of the lines in your file, and turns the tag bit on for all lines that match the speci fie d tar get. If HIGH- LIGHT TAGGED is not in effect, issuing MORE TAG tar get is equiv a lent to issu ing TAG target .

See also User’s Guide Chapter 8, “Selective Line Editing and Highlighting”, ALL, TAG, LESS

Examples ALL /ABC/ MORE /DEF/ In this exam ple, you first issue the ALL com mand to display only the lines in your file that con tain the string ‘‘ABC’’. If it then turns out that you also want to see any lines that contai n ‘‘DEF’’, you can use the MORE com mand in the exam ple to add them to the display .

TAG /ABC/ MORE TAG /DEF/ In this exam ple, you first issue the TAG com mand to highli ght the lines in your file contai ning ‘‘ABC’’. If you then decide that you would like to highli ght lines with ‘‘DEF’’ as well, you can use the MORE com mand in the exam ple to highli ght them.

MOVE

Format MOve target1 target2 MOve BLOCK

Description Use the MOVE com mand to move text from one locati on to another.

There are two forms of the com mand: MOve target1 target2 All text in the target area spec ified by target1 is moved, with the moved text placed im me di ately af ter the line spec i fied by target2. With this form of the com mand, the tar get area spec i fied by target1 cannot be a box or stream block. Text can only be moved within the current file, and not from one file in the ring to another. MOve BLOCK This form of the MOVE com mand moves all text in the current ly marked block. The block can be in the current file or in another file, al lowing you to move text from one file to another . If the block is a line block, text is moved after the focus line. If the block is a box or stream block, text is moved to the left of the text at the focus colum n posi ti on. The block rem ains marked in its new position.

102 Chapter 3. KEDIT Commands MOVE BLOCK is as signed by de fault to Alt+M, which uses the RE SET com- mand to unmark the block after the move is com plete.

You can also move blocks by us ing the Move button on the bottom toolbar, by us - ing mouse but ton 1 to drag and drop the block, or by us ing the Edit menu to cut the block to the clipboard and then paste it back at a new loca ti on.

See also COPY

Examples In the follow ing exam ples, assume that line 6 is the focus line.

MOVE :12 /ABC/

Lines 6 through 11 are moved fol lowing the next line contai ning ‘‘ABC’’.

MOVE 4 :88

Lines 6 through 9 (a total of four lines) of the current file are moved fol lowing line 88 of the current file.

MOVE BLOCK -*

All lines in the current ly marked block, which must be a line block in the current file for this form of the com mand, are moved fol lowing the top-of-file line.

MOVE BLOCK

If the current ly marked block is a line block, KEDIT moves its content s follow ing line 6 of the file. If the block is a box or stream block, KEDIT moves the block to the left of the text at the focus colum n positi on. s d n a m

MSG m o C

Format MSG [text]

Description The MSG (‘‘message’ ’) com mand, dis plays the spec ified text on the message line.

More com monly used in macros than the MSG com mand is the SAY instructi on, which also display s text on the KEDIT message line.

See also CMSG, DIALOG , DMSG, EMSG, WMSG, SET MSGLINE, KEXX SAY instruction

Examples MSG Func tion com plete KEDIT display s ‘‘Functi on com plete’’ on the message line.

MSG 103 NEXT

Format Next [n]

Description The line n lines below the focus line becomes the new focus line. If n is not spec ified , the line that is one line below the focus line becomes the focus line.

The DOWN com mand and the LOCATE com mand with a rela ti ve line num ber tar get perform the same functi on as the NEXT com mand.

See also UP

Examples NEXT The line one line below the focus line becomes the new focus line.

NEXT 8 The line eight lines below the focus line becomes the new focus line.

NFIND, NFINDUP, NFUP

Format NFind text NFINDUp text NFUp text

Description The NFIND com mand searches forward through your file for a line that does not start (in colum n 1) with the text that you spec ify. That line becomes the new focus line. The search starts with the line below the focus line and conti nues until the desired line is found or the end-of-file line is reached (wrapping to the top of the file if WRAP is ON).

NFINDUP (which can also be given as NFUP) does the same thing as the NFIND com - mand, except that KEDIT searches upward for the desired line, beginning with the line above the focus line.

These com mands are included in KEDIT mainly for com pati bil ity with XEDIT. The TFIND com mand is a more general com mand that is prefer a ble in most sit ua ti ons.

KEDIT remem bers the last operand used whenever the FIND, FINDUP, NFIND, or NFINDUP com mands are issued from the com mand line and, if you later issue one of these com mands with no operands, this ’’rem em bered operand’ ’ is reused.

If CASE IGNORE is in effect, an alphabetic char acter in the search text will match either its upper case or low er case equiv alent. Blanks in the search text act as wild card char acters, matching any sin gle char acter in your file. Under score (‘‘_’’) char acters in the search text match blanks in your file.

104 Chapter 3. KEDIT Commands See also FIND, FINDUP, TFIND

Examples NFIND ABC The next line that does not begin with ‘‘ABC’’ becomes the focus line.

NFINDUP ABC

The first line above the focus line that does not begin with ‘‘ABC’’ becomes the new focus line.

NFIND ABC DEF

This com mand searches for a line that does not contai n ‘‘ABC’’ in col umns 1 through 3 and ‘‘DEF’’ in col umns 5 through 7.

NFIND ABC_DEF

This searches for a line that does not have ‘‘ABC DEF’’ in col umns 1 through 7.

NOMSG

Format NOMSG command

Description NOMSG, used mainly in macros, takes as its operand the text of a com mand that you would like KEDIT to exe cute with MSGMODE OFF in effect. KEDIT preserves the

MSGMODE setti ng, execute s the spec ifie d com mand but does not display any mes- s sages gener ate d by the com mand, and then restores the set ting of MSGMODE. (Mes- d n

sages gener ate d by the com mand, while not display ed, do affect the value returned by a

QUERY LASTMSG.) m m o

NOMSG is often useful within macros, since macros often need to issue com mands C that may gen er ate irrel evant messages. For exam ple, you may need to issue a CHANGE com mand from within a macro, but may not want KEDIT to display the message giving the num ber of occurrence s changed. Without the NOMSG com mand, you would often need to save and restore the status of MSGMODE within macros, which can cause prob lems if a macro that turned MSGMODE OFF ter minates unex - pect edly before turning MSGMODE back ON.

See also NOMSG ini tial iza tion option, SET MSGMODE

Examples NOMSG LO CATE /1234/ KEDIT execute s the com mand LOCATE /1234/, but does not display any error mes- sage if 1234 is not found. A macro that issues this com mand could then exam ine the return code to deter mine if the comm and was suc cess ful.

NOMSG 105 OEMTOANSI

Format OEMTOANSI [target ]

Description Use the OEMTOANSI com mand to convert text in a speci fie d porti on of your file from the OEM char acter set to the ANSI char acter set.

All text within the spec ified tar get area that falls within the cur rent ZONE col umns is con verted. If the target area is a box block, its entire con tents are con verted, regard less of the ZONE set tings.

See also ANSITOOEM, User’s Guide Section 3.7, “Character Sets”

Examples OEMTOANSI ALL Con vert all lines of the file from OEM to ANSI.

OVERLAY

Format Overlay text

Description The OVERLA Y com mand overlay s the text in the focus line, start ing in colum n 1, with the text that you spec ify.

All text that you enter, starting with the char ac ter after the first blank fol low ing the OVERLA Y com mand, is taken as ’’overlay text’’ that will over lay data in the focus line. Wherever there is a blank in the overlay text, the corre spond ing charac ter in the focus line is not changed. Wherever there is an underscore charac ter (‘‘_’’) in the over- lay text, the corre spond ing charac ter in the focus line is replaced by a blank. All other char acters in the over lay text replace the cor re spond ing characters in the focus line.

There is no way to put under score charac ter s (‘‘_’’) into the overlay text without having them convert ed to blanks in the focus line.

The COVERLAY com mand does the same thing as the OVER LAY com mand, except that OVER LAY over lays text start ing in column 1, while the COVERLAY command overlay s text start ing at the focus column.

See also COVERLAY, REPLACE

106 Chapter 3. KEDIT Commands OVERLAYBOX

Format OVERLAYBox

Description The OVERLAYBOX com mand, norm ally assigned to Shift+Ctrl+O, overlay s a por- tion of your file with the text in a block. OVERLAYBOX operate s on line blocks, box blocks, and one-line stream blocks; it does not oper ate on multi-line stream blocks. The name OVERLAYBOX exists for histor ical rea sons, since in ear lier ver sions OVERLAYBOX could only operate on box blocks.

If OVERLAYBOX is issued when a box block or one-line stream block is marked, a copy of the text in the block overlay s the lines of your file beginning at the focus line.

POPUP

Format POPUP [MOUSE|TEXT|CEN TER] /item1/[item2/ ...]

Description Use the POPUP comm and from within a macro, nor mally a macro asso ciated with a mouse action, to display a pop-up menu to the user of the macro. The user of the macro then uses the mouse or keyboard to make a choice from the menu, and this choice is returned to your macro.

The first, optional, operand determ ines where the pop-up menu appears. If MOUSE is

spec ifie d, or if the operand is omit ted, the upper left corner of the menu is positi oned at s d

the mouse pointer loca tion. With TEXT, the upper left corner is posi tioned at the text n

cursor locati on, and with CENTER the upper left corner is posi tioned at the center of a KEDIT’s frame window. m m o

The POPUP com mand takes as its remaining operands a delim ited list of the menu C items involved. The delim iters are nor mally slash char acters (‘‘/’’), but can be any spe - cial char acter not con tained in any of the menu items. Some spe cial rules:

· If a menu item be gins with a tilde (‘‘~’’), that menu item will be grayed out and can not be selected by the user.

· If a menu item consis ts solely of a minus sign (‘‘-’’), that menu item is display ed as a sepa ra tor line within the menu.

· If a menu item contai ns an am persand (‘‘&’’), the am persand is not display ed but the charac ter follow ing the am persand is under li ned and the user of the macro can type that char acter to choose that menu item. To have an amper sand displayed as part of a menu item, use two consec uti ve am persands. POPUP returns its re sults through macro variable s, much as the EXTRACT command does.

POPUP 107 On com pleti on of the POPUP com mand, two macro variable s are set:

popup.0 1

popup.1 The content s of the menu item selec ted by the user. This value is re- turned exact ly as you spec ifie d it, and include s any am persands pres- ent in your origi nal string. If no item was selec ted (becaus e the user pressed the Escape key or clicked outside of the menu), this variable is set to the null string.

See also DIA LOG, READV

Examples 'popup /Add/Delete/~Re place/-/Up load/Down load/' if popup.1 = ’’ then call no_selec tion else if popup.1 = 'Add' then call adder else if popup.1 = 'Delete' then call deleter ... In this porti on of a macro, a pop-up menu with the items Add, Delete, Replace (grayed-out and not selectable), a sepa ra tor line, Upload, and Download is dis played. After the POPUP com mand com pletes, the vari able POPUP.1 is set to the null string if no item was selected, and oth er wise it is set equal to the text of the item that was chosen.

PRESERVE

Format PREServe

Description The PRE SERVE comm and, used mainly in macros, causes KEDIT to save the cur rent values of most SET options so that you can tem porari ly change them, execute some com mands with the new setti ngs, and then restore their val ues with the RESTORE command.

The setti ngs of ARBCHAR, ARROW, AUTOINDENT, AUTOSAVE, AUTOSCROLL, BACKUP, BOUNDMARK, CASE, CMDLINE, COLMARK, COLOR, COLOR ING , CURLINE, CURRBOX, DISPLA Y, ECOLOR, EOFIN, EOFOUT, EOLIN, EOLOUT, FORMA T, HEX, HIGHLIGHT , IDLINE, IMPMACRO, INPUTMODE, INTER NA TIONAL, LINEND, LRECL, MAR GINS, MSGLINE, MSGMODE, NEWLINES, NUMBER , PCOLOR, PREFIX, PREFIXWIDTH, RECFM, SCALE, SCOPE, SCROLLBAR, SHADOW, STAY, STREAM, SYNONYM, TABLINE, TABS, TABSAVE, TABSIN, TABSOUT, THIGHLIGHT, TIMECHECK, TOFEOF, TRAIL ING, TRANSLATEIN, TRANSLATEOUT, TRUNC, UNDOING , VARBLANK, VERIFY , VERSHIFT, WORD, WORDWRAP, WRAP, and ZONE are preserved.

See also RESTORE

108 Chapter 3. KEDIT Commands PRINT

Format PRint [target [n]] PRint LINE [text] PRint STRING text PRint FORM feed PRint CLOSE

Description Use the PRINT com mand to send data to your printer.

Print output norm ally is handled by Windows, and you can use the File Print Setup and File Print dialog boxes to determ ine which printer, printer driver, printer font, and printer mar gins to use. You can also use the SET PRINTER com mand to specify that printer out put is to bypass Windows and go directly to a specif ic printer port.

KEDIT’s focus is on text editing , and its printing abil ities are very limited. KEDIT does not autom ati cal ly positi on your paper in the printer, print headings, footings, or page num bers, handle boldface or itali ciz ed output, or use multi ple fonts or propor ti onal fonts.

If your printer uses device-specific escape sequences to con trol bold face, etc., you can imbed these sequences in your file or in macros and use the PRINT com mand to send them to your printer, but this requires that you use the SET PRINTER com mand to route output directly to a specif ic printer port (such as LPT1:, LPT2:, etc.). With the default of PRINTER WIN DOWS printer output goes through Windows device-inde- pendent printer handli ng, and escape sequences are not properl y processed. s d

There are sev eral dif fer ent forms of the PRINT comm and: n a

PRint [tar get [n]] m KEDIT sends all text in the tar get area to your printer. The tar get area can specify m o

lines within your file, or can be any kind of marked block. PRINT with no C operands prints the focus line. KEDIT follows each line sent to your printer with a car riage re turn-line feed pair. The n oper and of the PRINT com mand tells KEDIT to start a new page af ter ev ery n lines have been printed, al lowing you to print n lines per page. If n is not spec ifie d (or is 0), KEDIT will print conti nu ously , and will not force any page ejects af ter a set number of lines.

When print ing has com pleted, the last line printed becom es the new focus line if STAY OFF is in effect; if STAY ON (the de fault) is in ef fect, the fo cus line lo ca tion is unchange d. PRint LINE [text] This sends the speci fie d text to the printer, followed by a carria ge return-l inefeed. If HEX ON is in ef fect, you can specify the text us ing hex a dec i mal or dec i mal no - tati on. If no text is spec ified, KEDIT sends only a car riage re turn-line feed to the printer.

PRINT 109 PRint STRING text This sends the speci fie d text to the printer but, unli ke PRINT LINE, does not fol - low it with a car riage re turn-line feed. If HEX ON is in effect, you can spec ify the text us ing hex a dec i mal or dec i mal notation. PRint FORMfeed Tells the printer to do a page eject, so that any addi ti onal out put will begin on a new page. PRint CLOSE If you are using a print spooler, or your printer is acces sed through a net work, your sys tem software may hold your printer out put and not send it to the printer unti l you tell the system that you are ready by ‘‘closing’ ’ your printer. By defaul t, SET PRINTER’s CLOSE|NOCLOSE value is set to CLOSE, and KEDIT closes your printer after each use of the PRINT com mand. If SET PRINTER’s CLOSE|NOCLOSE value is set to NOCLOSE, so that the printer is not closed automatically af ter each use of the PRINT comm and, you can use the PRINT CLOSE com mand at any time during a KEDIT session to tell KEDIT to close your printer. Re gard less of SET PRINTER’s CLOSE|NOCLOSE setting , KEDIT closes your printer auto m ati cal ly when you leave KEDIT, when you switch from KEDIT to another appli cati on, and when you use the SET PRINTER com mand to switch to a different printer.

In addi tion to showing the text in color on your display , KEDIT will print syn- tax-colored text in color when you print to a color printer and PRINTER WINDOWS and PRINTCOLING ON are in ef fect.

Notes · KEDIT will print syntax- colored text in color when you print to a color printer with PRINTER WIN DOWS and PRINTCOLING ON in ef fect.

· When you want to print ei ther the content s of the current ly-marked block or the content s of the enti re file, you can use the Print File button on the defaul t toolbar, or the File Print di alog box.

· If you are using multi ple PRINT com mands to print data on a single page (for ex - am ple, by issu ing multi ple PRINT LINE com mands from within a macro), you will prob a bly want to change the SET PRINTER’s CLOSE|NOCLOSE setting from its default of CLOSE to NOCLOSE. This will prevent KEDIT from auto m at- ically closing the printer, which nor mally also in volves a page eject, af ter each of your PRINT com mands. You can then use PRINT CLOSE when you are ready to close the printer.

See also SET PRINTER, User’s Guide Section 3.10, “Printing”

Examples PRINT BLOCK All text in the current ly marked block is printed.

PRINT ALL The entire file is printed.

110 Chapter 3. KEDIT Commands PRINT KEDIT prints the focus line.

PRINT * 60 All lines from the focus line through the end of the file are printed, with a form feed char acter sent to the printer every 60 lines.

PRINT LINE Hello there. KEDIT sends ‘‘Hello there.’’ to your printer, followed by a carria ge return-linefeed.

PRINT CLOSE KEDIT closes your printer device.

PURGE

Format PURge macroname1 [macroname2 ...]

Description Use the PURGE com mand to remove in-mem ory macros (put into mem ory via the DEFINE com mand) from mem ory. This allows you to free up the mem ory occupied by in-mem ory macros that you have finishe d using.

If you purge a macro assigned to a key that by default enters a char acter (such as the A or SHIFT+A macros), the key will revert to its default def ini ti on. If you purge a macro assigned to any other key, the key will then do nothing when you press it. Purging a macro assigned to these keys is equiva lent to issuing the command

DEFINE keyname nop s d n

If you purge any other in-mem ory macro, and then attempt to execute the macro, a KEDIT will see that the macro is not in mem ory and will then search for it on disk. m m o

If you attempt to purge a macro that is not in fact in mem ory, KEDIT takes no action. C

Examples PURGE F1 RE TRY KEDIT purges the defi ni ti on of the F1 key; F1 will then be ignored if you press it. KEDIT also purges the defi ni ti on of RETRY. Since this is not the name of a key, if you later try to run a macro called RETRY, KEDIT will look for RETRY.KEX on disk.

PURGE 111 PUT, PUTD

Format PUT [target [fileid]] PUT LINE fileid [text] PUTD [target [fileid]]

Description The PUT com mand copies the content s of the spec ifie d tar get area of your file to the disk file spec ified by fileid. Text writ ten to disk by the PUT com mand is not deleted from the file you are editing.

A sec ond form of the PUT com mand lets you directly specify , as part of the PUT com - mand, a line of text to be appended to the speci fie d disk file.

The PUTD com mand does exactly the same thing as the first form of the PUT com - mand except that, after text has been suc cess fully writ ten to disk, it is deleted from the file you are edit ing.

If you specify a fileid with no drive or directory , KEDIT uses the current drive and direc tory. The short cuts for spec i fy ing a fileid that are discusse d in connec ti on with the SET FILEID com mand can also be used with the PUT and PUTD commands.

The text in the tar get area is appended to the speci fie d disk file. If the file does not exist, it is cre ated.

If no fileid is given, KEDIT cre ates a tem po rary file to hold the text. (If the tem po rary file already exists as a result of previ ous PUT or PUTD com mands, it is com pletely replaced, and not appended to as would happen if you gave a fileid when issuing the PUT or PUTD com mand.) This tem porary file can then be read back by issuing the GET com mand with no operands. If no tar get is given, the focus line is writ ten to the temporary file.

PUT and PUTD do not create backup copies of the files you append to, regardles s of the setting of BACKUP. The text writ ten out will be affected by the set tings of LRECL, RECFM, EOFOUT, EOLOUT, TRAIL ING, TABSOUT, and TRANSLATEOUT. To append to a file, KEDIT looks at the last byte of the file. If the last byte of the file is the DOS end-of-file char acter (char acter code 26), text is writ ten start ing at this last char - ac ter of the file, over writ ing the end-of-file char ac ter; oth er wise, text is writ ten after the last char acter of the file.

If STAY OFF is in effect, the line after the last line writ ten to disk becomes the focus line when the PUT or PUTD com mand com pletes. If STAY ON is in effect, the focus line locati on does not change.

See also GET

112 Chapter 3. KEDIT Commands Examples PUT 10 ABC.C The focus line and the nine lines fol lowing it, for a total of ten lines, are appended to the file ABC.C. (If ABC.C does not yet exist, it is cre ated.)

PUT 10

The focus line and the nine lines fol lowing it are placed into a tem porary file that can later be retrieved by issuing the GET com mand with no operands.

PUT LINE ABC.C Hello there.

KEDIT adds the line ‘‘Hello there.’’ to end of the file ABC.C, cre at ing the file if it did not already exist.

QUERY

Format Query option

Description The QUERY com mand allows you to determ ine the current value of any of the options that can be set via the SET com mand. You can also QUERY a num ber of val ues that cannot be directly set, such as the names of all files in the ring and the current time.

The QUERY com mand takes one operand, the name of the option whose value you want to see. The name of the option can be abbrevi ate d using the same mini m al truncations as the corre spond ing SET com mand allows. The value of the option is then s

display ed on the message line. d n a

For a full discus sion of all the options that you can QUERY, see Chapter 5, “QUERY m

and EXTRACT”. m o C

See also MOD IFY, STA TUS, Chapter 4, “The SET Command”, Chapter 5, “QUERY and EXTRACT”

Examples QUERY TIME The date and time are dis played in the message area.

QUERY MACRO F1

The defi ni ti on of the macro assigned to the F1 key is dis played in the message area.

QUERY ZONE

The cur rent ZONE set tings are displayed in the message area.

QUERY 113 QUIT, QQUIT

Format QUIT QQuit

Description Use the QUIT com mand when you have finishe d working with the current file and have made no changes to it. KEDIT removes the file from mem ory and, if you are edit - ing multi ple files, makes the pre vi ous file in the ring become the cur rent file. The file is not writ ten to disk.

You will fre quently use KEDIT to sim ply look at a file, with no intenti on of making changes to it. When you are finishe d with such a file, it is not neces sary to write it back to your disk with the FILE com mand, since an unchanged copy of your file is already on disk. Instead, it makes sense in this sit ua ti on to use the QUIT com mand to save time.

The QUIT com mand is assigned by default to functi on key F3. You can also use the File Close menu item to remove an unmodi fie d file from the ring. (If you use File Close on a file that has been modi fie d, KEDIT will ask you if you want to save the file before removing it from mem ory.)

If you have made changes to your file, you usuall y wouldn’ t want to use the QUIT com - mand, since your changes would not be written to disk. So that acciden tal use of the QUIT com mand cannot cause you to lose valuable work, the QUIT com mand will work only if the file has not been changed since you began edit ing it or last used the SAVE com mand to save the file to disk. (KEDIT checks whether the count it maintai ns of alter ations since the last SAVE is greater than 0.) If you try to QUIT from a file that has been changed, KEDIT will not QUIT but will instead give you an error message . If you really do want to QUIT from a file that has been changed, you can use the QQUIT com mand. QQUIT does the same thing as QUIT, except that it will exit from your file even if changes have been made.

See also CAN CEL, FILE, SAVE

READV

Format READV Cmdline [initial ] READV EDITfield [initial ] READV KEY [Ignoremouse|NOIgnoremouse]

Description The READV com mand, valid only if issued from a macro, causes KEDIT to read infor- mati on from the user of the macro. The results are passed back through assignm ents to macro vari ables, in much the same way as the results of the EXTRACT comm and are passed back to a macro.

114 Chapter 3. KEDIT Commands READV READV CMDLINE lets your macro obtain a line of input from the user. READV CMDLINE CMDLINE allows optional spec ifi ca tion of ini tial con tents of the line to be read in. KEDIT reads a line of input from the com mand line, which is then passed back to your macro.

You can set the ini tial content s of the line to be read in by speci fy ing the optional ini tial text.

READV CMDLINE sets these vari ables:

readv.0 1

readv.1 Text read from the di alog box

READV READV EDITFIELD is like READV CMDLINE, except that input is read from an edit EDITFIELD field that is dis played within a dia log box, and not from the com mand line.

READV KEY READV KEY reads a single keystroke from the keyboard, wait ing if neces sary until a key stroke has been entered. Your macro can then deter mine the key that was pressed and act accord ingly.

READV KEY has options that let you control the effect of mouse events that occur while waiting for a keystroke . With IGNOREMOUSE, the default, mouse events are ignored (except that, if MOUSEBEEP ON is in effect, the speaker beeps). With NOIGNOREMOUSE, mouse events cause READV KEY to term inate with a return code of 2, but they remain queued up for proces sing after the macro that issued READV KEY term inate s.

READV KEY gives you the name of the key that is entered (as described in Chapter 7,

“Built-in Macro Handling”), the char acter asso ciated with the key (or a null string for s

functi on keys and other keys without assigned charac ter s), the scan code (a dec im al d n

num ber from 0 to 255) of the key, and the Shift Status at the time KEDIT reads the key. a m

When a key is entered, READV KEY sets these variables: m o C readv.0 5 under Windows XP/2000/Vista; 4 under Windows 98/Me

readv.1 Key name (in upper case , with possi ble ‘‘C-’’, ‘‘S-’’, ‘‘A-’’, ‘‘S-C-’’, or ‘‘A-C-’’ prefix); ‘‘-’’ is always used in the prefix rather than ‘‘+’’ for com pat i bil ity with ear lier ver sions of KEDIT.

readv.2 Char ac ter value (or null)

readv.3 Scan code (in dec im al)

readv.4 Shift Sta tus (see be low)

readv.5 Extende d Shift Status (see be low; not set under Windows 98/Me)

READV 115 Shift Status is an eight char acter string of 0's and 1's where char acters are set to 1 as fol - lows: Po si tion Set to 1 if 1 INSERTMODE ON 2 CapsLock ON 3 NumLock ON 4 ScrollLock ON 5 Ei ther Alt key down 6 Ei ther Ctrl key down 7 Left Shift key down (XP/2000/Vista); either Shift key down (Windows 98/Me) 8 Right Shift key down (XP/2000/Vista); either Shift key down (Windows 98/Me)

For exam ple, if INSERTMODE ON is in ef fect and a Ctrl key is down, READV.4 will be set to ‘‘10000100’’.

Extended Shift Status, not avail able under Windows 98/Me, is also an eight charac ter string of 0's and 1's. Charac ter s are set to 1 as follows: Po si tion Set to 1 if 1 Al ways 0 (SysReq key sta tus is not avail able) 2 CapsLock key down 3 NumLock key down 4 ScrollLock key down 5 Right Alt key down 6 Right Ctrl key down 7 Left Alt key down 8 Left Ctrl key down

Notes · Key com bina ti ons involv ing Alt, Ctrl, and a charac ter key (that is, A-C-x) are ig - nored except when a macro for the key com bina ti on involved has been defined.

· For keys nor mally pro cessed by the ASCII macro (that is, special char acters found on non-U.S. keyboards but not on U.S. keyboards, digit s enter ed via the num eric pad, and charac ter s enter ed via the Alt key-num eric pad method), READV.1 is set to ‘‘ASCII ddd’’, where ddd is the dec im al value of the char acter code in volved. The scan code in READV.3 is 0 for digit s enter ed via the num eric pad, 56 (the scan code of the Alt key) for Alt key-num eric pad input, and the scan code of the key in- volved for specia l charac ter s on non-U.S. keyboards.

See also DIA LOG, KEXX PULL and PARSE PULL instructions

116 Chapter 3. KEDIT Commands RECOVER

Format RECover [n|*]

Description The RECOVER com mand, norm ally assigned to Alt+R, allows you to recover lines of text that you have deleted or changed. KEDIT tries to save the last 100 deleted or changed lines in an internal buffer.

Note that the UNDO com mand provides a more power ful facil ity for undoing the effects of changes to your file. RECOVER is avail able mainly for compat ibil ity with XEDIT and with earlie r versions of KEDIT.

If you issue the RECOVER com mand and give a num ber as an operand, KEDIT tries to recover that many lines. The most recently deleted or changed line is inserted above the focus line, the next most recently deleted or changed line is inserted above that, etc. The last line recov ered becomes the new focus line.

If you issue the RECOVER com mand with no oper and, KEDIT tries to recover the last line deleted or changed. Issuing the RECOVER com mand again causes KEDIT to try to recover the line before that, etc. Issu ing

RECOVER * causes KEDIT to recover all the changed or deleted lines that it can.

See also UNDO

Examples RECOVER

KEDIT tries to recover the last changed or deleted line of text. s d n

RECOVER 4 a m

KEDIT tries to recover the last four changed or deleted lines of text. m o C

RECOVER 117 REDO

Format REDO

Description Use the REDO com mand, norm ally assigned to Ctrl+Bksp and to Ctrl+Y, if you have used the UNDO com mand to undo some changes to your file and then decide to redo those changes, reversing the effect of the UNDO com mand. If you have used the UNDO com mand repeatedly to undo multi ple levels of changes, you can use the REDO com mand repeatedly to redo those changes. REDO will work only if no changes have been made to the current file since the corre spond ing UNDO com mand. After an UNDO com mand you can move around in the current file, can save it to disk, and can make changes to other files in the ring, and you can still use the REDO com - mand. But REDO is not avail able once you make any further changes to the content s of the current file, change the selecti on levels of any line (for exam ple, by using the ALL com mand), change the lineflags of any line (for exam ple, by using the TAG com mand), add or delete any line names (for exam ple, by using the SET POINT com mand). You can also REDO the last UNDO action using the Edit Redo menu item or using the Redo button on the toolbar.

When ever it is possi ble to REDO previ ous UNDO com mands, the avail able undo level count (the third num ber fol lowing ‘‘Alt=’’ on the status line) will be followe d by an aster isk (‘‘*’’).

See also User’s Guide Chapter 3, “Using KEDIT for Windows”, UNDO, SET UNDOING

REFRESH

Format REFRESH

Description Use the REFRESH comm and to cause KEDIT to update the dis play while a macro is active. Norm ally, KEDIT doesn’ t redisplay its windows after every com mand issued from within a macro. The windows are only updated when the macro finishe s or when it needs keyboard input. The REFRESH com mand allows you to have the windows redisplayed at addi tional times during the exe cuti on of your macro. You might, for exam ple, wish to refresh the windows to indicat e to the user the progress of a long-run- ning macro. Note, however , that fre quent refreshes can slow your macro down significantly.

118 Chapter 3. KEDIT Commands REGUTIL

Format REGUTIL SAVE|CLEAR STATE|HIS Tory|SET TINGS REGUTIL SAVE SET option REGUTIL CON VERT SET TINGS REGUTIL BACKUP CONFIG|HIS Tory REGUTIL GET CONFIG|HIS TORY section name

Description Use the REGUTIL com mand to help manage the content s of the inform ati on saved by KEDIT in the Windows regis try . Most KEDIT users will not need to use the REGUTIL com mand, since the regis try is norm ally updated autom ati cal ly by KEDIT at the appro- pri ate times. REGUTIL SAVE|CLEAR STATE KEDIT norm ally saves certai n infor m ati on about the STATE of your KEDIT ses- sion, such as the posi ti on of your frame win dow, whether it is maxi m ized, and the screen and printer fonts you are us ing, in the Windows regis try at the end of each session, and refers to this infor m ati on at the start of the next KEDIT session. With REGUTIL SAVE STATE, KEDIT im medi ately saves the cur rent state of a ses sion, even though the session has not ended. With REGUTIL CLEAR STATE, KEDIT rem oves this state infor m ati on from the regis try ; if no state infor m ati on is found in the reg is try at the start of the next KEDIT ses sion, KEDIT will use in ter nal de - faults for your frame window position, fonts, etc. REGUTIL SAVE|CLEAR HISTory Simi larly , KEDIT nor mally saves cer tain HIS TORY in for mation in the Win dows regis try at the end of each session. This include s infor m ati on about com mands you

have re cently issued from the com mand line, files you have recent ly edit ed, strings s d

you have recent ly worked with in the Edit Find di alog box, etc. REGUTIL SAVE n HIS TORY will im me di ately up date the his tory in for ma tion in the reg is try. a REGUTIL CLEAR HIST ORY will clear out all of the KEDIT history information m m

in the registry. o C REGUTIL SAVE|CLEAR SETTINGS KEDIT also saves the values of most SET opti ons in the Windows regis try . This is not done auto m ati cal ly at the end of a KEDIT session, but is inste ad done when you use Opti ons Save Set tings to save the value of all such opti ons or when you use the Save Setti ng button in the Opti ons SET Com mand dia log box to update the value of an indi vid ual setti ng in the regis try . REGUTIL SAVE SET TINGS update s the value of all savable opti ons in the regis try , just as Opti ons Save Set tings does. REGUTIL CLEAR SET TINGS re moves all saved set tings from the reg is try; if no saved set tings are pres ent at the start of a KEDIT ses sion, KEDIT will use de fault values for all of your SET options. REGUTIL SAVE SET op tion This com mand lets you update the value of an indi vid ual SET opti on in the Win- dows regis try , and is equiva lent to using the Save Set ting button in the Opti ons SET Com mand dia log box to save an indi vid ual setting.

REGUTIL 119 REGUTIL CONVERT SETTINGS This com mand adds a new file, REGSET.KEX, to the ring of files that you are edit - ing. KEDIT takes each of the setti ngs saved in the Windows regis try , convert s it into the equiva lent KEDIT SET com mand, puts quotes around the SET com mand to ensure that the com mand is valid from within a KEDIT macro, and adds it to REGSET.KEX. REGSET.KEX is there fore a valid KEDIT macro contai n ing SET com mands corre spond ing to each of the set tings saved in the registry. REGUTIL BACKUP CONFIG|HISTory REGUTIL BACKUP adds a file called KEDIT.CONFIG.REG or KEDIT.HIST ORY.REG to the KEDIT ring, contai n ing a copy (for CONFIG) of the KEDIT config u ration settings saved in the reg istry or (for HIST ORY) of recent comm and lines, files ed ited, etc. from the registry.

You can use these files to transfer your KEDIT config u ra ti on set tings and/or his- tory to a new machine . Save the .REG file to disk, copy it to your new machine , and double- click on it to insta ll it in the regis try of the new machine. REGUTIL GET CONFIG|HISTORY sec tion name REGUTIL GET is valid only within macros. It reads a value from KEDIT's sec tion of the regis try , return ing infor m ati on in these macro variable s::

regutil.0 0 if the request ed infor m ati on was not found in the regis try or there was a problem reading it in, other wise 1.

regutil.1 Not set when REGUTIL.0 is 0. Oth er wise, it con tains the value of the in for mation read from the reg istry entry . (KEDIT uses es- cape se quences to store cer tain spe cial char acters in the reg istry; in REGUTIL.1 these es cape se quences have been re placed by the ac tual spe cial characters involved)

For exam ple, “REGUTIL GET CONFIG STATE32 PrinterFaceName” might re - turn:

regutil.0 1

regutil.1 “Courie r New” (quotes aren’t part of the value returne d)

Notes · The exact detai ls of how KEDIT stores config u ra ti on and his tory infor m ati on in the regis try are undoc u m ented and are more likely than most other as pects of KEDIT to be subject to incom pati ble changes betwee n versions of KEDIT. You should not use REGUTIL GET, or the abil ity to edit the content s of the KEDIT.CONFIG.REG or KEDIT.HIST ORY.REG files un less you are aware of and are comfo rt able with this possibility.

· With the de fault of REGSAVE STATE HIS TORY in effect, KEDIT will au to mati - cally update the state and history infor m ati on in the Windows regis try at the end of your KEDIT session, overrid ing the changes made to the regis try by any REGUTIL SAVE|CLEAR STATE|HIS TORY com mands earlie r in the session. If you want to avoid this, you can put REGSAVE NOSTATE NOHISTORY into effect.

120 Chapter 3. KEDIT Commands · The Windows regis try does not contai n values for all of the KEDIT SET opti ons that can be saved. Inste ad, it only con tains val ues that dif fer from KEDIT’s de- faults. There fore the REGSET.KEX file cre ated by the REGUTIL CONVER T SETTINGS com mand will only contai n SET com mands corre spond ing to saved set tings whose values dif fer from KEDIT’s defaults.

· For his tori cal reasons the INIUTIL com mand, which does the same thing as the REGUTIL comm and, is also avail able.

See also HISTUTIL, SET REGSAVE

RENAME

Format REName fileid1 fileid2

Description Use KEDIT’s RENAME com mand to change the name of a file on disk. Fileid1 spec i- fies the disk file to be renamed and fileid2 spec ifies the file’s new name.

Both fileids can contai n path speci fi ca ti ons; if the path speci fi ca ti on for the sec ond file is differ ent from the path spec ifi ca tion for the first file, the RENAME command will move the file from one directory to another. You cannot use RENAME to move a file from one drive to another.

The KEDIT RENAME com mand changes the name of a file on disk. It does not affect the fileid asso ci ated with any of the files cur rently being edited. Use the SET FILEID comm and to change the fileid asso ciated a file cur rently being edited. s

Unlike the DOS RENAME com mand, KEDIT’s RENAME com mand does not allow d

wild card char acters in either fileid. You can use KEDIT’s DOS com mand to issue the n a

‘‘real’’ DOS RENAME com mand. m m o

See also DIR, DOS, ERASE, SET FILEID C

Examples RE NAME ABC.TXT DEF.TXT The file ABC.TXT in the cur rent direc tory is renamed to DEF.TXT.

REPEAT

Format REPEat [target ]

Description Use the REPEAT com mand to cause the com mand in the equal buffer (which is normally the most recently com pleted com mand issued from the com mand line) to be repeatedly execute d, affect ing addi tional lines in your file.

REPEAT 121 When you issue the REPEAT com mand with no operands, KEDIT moves the focus line pointer down one line in your file and then repeats the last com mand entered (that is, the last com mand entered prior to the REPEAT com mand). REPEAT with no operands is equiv a lent to

=DOWN 1 (The ‘‘=’’ comm and causes KEDIT to re-execute the comm and in the equal buffer.)

When you specify a tar get with REPEAT, KEDIT determ ines the num ber of lines n from the focus line to the tar get line. KEDIT then repeatedly moves down a line and re-exe cutes the com mand in the equal buffer, conti nu ing until it has either done this n times, or the com mand in the equal buffer gives a nonzero return code. For exam ple, if you enter

CAPPEND X KEDIT will place an ‘‘X’’ at the end of the focus line. If you then enter

REPEAT 3 KEDIT will, three times, move down one line and repeat the CAPPEND X com mand. So,

CAPPEND X REPEAT 3 is equiv a lent to

CAPPEND X =DOWN 1 =DOWN 1 =DOWN 1 Both of these sequences are also equiv alent to

CAPPEND X DOWN 1 CAPPEND X DOWN 1 CAPPEND X DOWN 1 CAPPEND X All three of the above sequences have the same effect: the focus line and the three lines follow ing it have an ‘‘X’’ appended to them.

If the target that you specify is located above the focus line, KEDIT moves repeat edly up one line, towards the tar get line, before repeat ing the last com mand.

Using REPEAT The com mand re-execute d by the REPEAT com mand is the com mand in the equal in a macro buffer. This is norm ally the most recently com pleted com mand issued from the com - mand line. The equal buffer is not autom ati cal ly updated by com mands issued from macros, but you can use the SET = com mand from within a macro to directly set the

122 Chapter 3. KEDIT Commands content s of the equal buffer. So to use REPEAT in a macro, you will proba bly precede it with

'SET = command ' where com mand is the com mand you want to REPEAT.

Examples REPEAT * KEDIT moves down one line and reissues the last com mand, repeat ing this proces s through the end of the file.

REPEAT -1 KEDIT moves up one line and reissues the last com mand.

REPLACE

Format Replace [text]

Description The REPLACE com mand causes the text that you specify to replace the focus line in your file.

If no text is speci fie d (the com mand line consis ts only of the word ‘‘REPLAC E’’), KEDIT replaces the focus line with a blank line and the blank line becomes the new focus line. With INPUTMODE OFF, the default, the cursor then moves to the left mar - gin col umn of the focus line. With INPUTM ODE LINE or INPUTM ODE FULL, you enter KEDIT’s Input Mode. s

See also INPUT, SET INPUTMODE d n a

Examples R Hello there. m m A line consis ting of ‘‘Hello there.’’ is put in your file, replac ing the focus line. o C

REPLACE The focus line is replaced with a blank line. This line becomes the focus line, and KEDIT then acts according to the current INPUTMODE setti ng.

RESET

Format RESet [Block|CMDSEL|FIELD|Prefix|THIGHlight|UNDO]

Description The RESET com mand lets you reset var ious aspects of KEDIT’s status. By default, Alt+U issues the RESET BLOCK and RESET THIGHLIGHT com mands and the Esc key issues the RESET FIELD com mand.

RESET 123 RE Set Block KEDIT unmarks any current ly marked block. RE Set CMDSEL KEDIT unmarks any current ly marked com mand line se lec tion. RE Set FIELD Reset s the content s of the cursor field to what it was when the cursor enter ed the field. RE Set Pre fix Reset s the prefix area. All text in the prefix area is ’’blanked out’’, as if you had typed blanks over all pending pre fix com mands. RE Set THIGHlight Dis plays the cur rently high lighted target in its nor mal color. RE Set UNDO Forces KEDIT to start a new undo level from within a macro. If, for exam ple, you run a macro that changes 10 lines, KEDIT norm ally groups all 10 changes togethe r into a single undo level that can only be undone as a unit. If your macro changed 5 lines, then is sued the RE SET UNDO com mand, and then changed 5 more lines, KEDIT would create 2 undo levels , and you could undo the second group of changes sepa rat ely from the first group. RE Set RESET with no operands reset s marked blocks and prefix com mands, and is equiv a lent to is su ing RE SET BLOCK and RE SET PREFIX.

RESTORE

Format RESTore

Description The RESTORE com mand is used only in connec ti on with the PRESER VE com mand. PRE SERVE saves the current values of most SET options so that you can tem porari ly change them, execute some com mands with the new setti ngs, and then restore their val - ues with the RESTORE command.

RESTORE restores the set tings most recently preserve d for the current view of the cur- rent file. If you issue the RESTORE com mand without having first issued the PRE- SERVE com mand, you will get an error message . If you issue the RESTORE com mand twice in a row without an inter vening PRESER VE com mand, you will also get an error message ; the preserve d set tings are saved only until the next RESTORE.

See also PRE SERVE

124 Chapter 3. KEDIT Commands RGTLEFT

Format RGTLEFT [n]

Description Use the RGTLEFT com mand, most useful when assigned to a key, to work with text that is a bit too wide to be com pletely display ed within a window . Issuing RGTLEFT repeat edly will alter nate between scroll ing text in the win dow to the right and then to the left, allowing you to view text that won’t fit into the window , and then to return to your norm al view of the text.

Text scrolls n colum ns to the right or left. If n is not spec ified , text scrolls by three quarters of the num ber of col umns dis played in the window . (If you have used the SET VERIFY com mand to display multi ple sets of col umns in the win dow, text scrolls by three quarter s of the width of the first set of columns.)

The RGTLEFT com mand scrolls the window to the right if the current VERSHIFT value is less than or equal to 0; other wise , the RGTLEFT com mand scrolls the window to the left. RGTLEFT works by adjust ing the value of VERSHIFT.

You can also scroll right and left in your file by using the mouse to manipu lat e the hori - zon tal scroll bar.

See also LEFT, RIGHT

RIGHT s d n

Format RIght [n|HALF] a m m

Description The RIGHT com mand scrolls your view of the file n colum ns to the right. The RIGHT o com mand does not affect the content s of your file; it only affects which colum ns of C your file are display ed in the docu m ent window .

RIGHT with no operands scrolls one colum n to the right. RIGHT HALF scrolls one half the width of the docu m ent window to the right.

For exam ple, assume that you have issued the com mand

SET VER IFY 40 * so that col umns 40 through 119 of your file are visi ble in a window 80 col umns wide. Using the RIGHT and LEFT com mands, you can scroll the window right or left.

RIGHT 10 would scroll 10 colum ns to the right, showing you colum ns 50 through 129 of your file.

RIGHT 125 RIGHT 20

would then scroll an addi tional 20 colum ns to the right, showing you colum ns 70 through 149 of your file.

The RIGHT and LEFT com mands affect the value of VERSHIFT. VERSHIFT is a num ber that repre sent s the num ber of col umns that the dis play window has been scrolled to the right or left of the col umns spec ifie d by the VER IFY set ting. For example, after the com mands RIGHT 10 and RIGHT 20, VERSHIFT will be 30, since the window has been scrolled a total of 30 col umns to the right. If you then issued a LEFT 65 com mand, VERSHIFT would be set to -35 (that is, 30 - 65). (You can QUERY VERSHIFT but can not directly set it. Its value is con trolled by the RIGHT and LEFT com mands, and by the RGTLEFT com mand. KEDIT’s AUTOSCROLL facilit y also works by adjust ing the value of VERSHIFT.) The com mands RIGHT 0 and LEFT 0 are special cases. They reset the value of VERSHIFT to 0. VERSHIFT is also reset to 0 whenever you issue a SET VERIFY command.

You can also scroll right and left in your file by using the mouse to manipu lat e the hori - zon tal scroll bar.

See also LEFT, RGTLEFT, SET VER IFY

RIGHTADJUST

Format RIGHTAdjust [target ]

Description Text in the tar get area is right-adjusted, with the text of each line shifted so that the last nonblank charac ter within each line is in the right mar gin col umn.

You can use RIGHTADJUST BLOCK, or the Rightadjust Block but ton on the bottom toolbar, to right-adjust line blocks, box blocks, and one-line stream blocks. Box blocks and one-line stream blocks are given spe cial handli ng: KEDIT right-adjusts the text within the block boundari es, and text outside the block is not affected. You cannot right-adjust a multi-line stream block.

See also CEN TER, LEFTADJUST

Examples RIGHTADJUST The focus line is right-adjusted. This com mand is assigned by default to Ctrl+R.

RIGHTA 6

The focus line and the five lines fol lowing it, for a total of six lines, are right-adjusted according to the current mar gin setti ngs.

126 Chapter 3. KEDIT Commands SAVE, SSAVE

Format SAVE [fileid] SSave [fileid]

Description The SAVE com mand causes KEDIT to write the current file to disk. Unlike the FILE com mand, which writes the file to disk and then removes it from mem ory, the SAVE com mand writes the file to disk but does not remove it from mem ory, and you can con - tinue to edit it.

Any changes you have made to the file are saved and you can conti nue to edit the copy of the file in the PC’s mem ory. If you then mistak enly delete important parts of your file, or the PC’s mem ory is wiped out by a power fail ure, all of your work through the last SAVE will have been safely written to disk.

You will norm ally issue the SAVE com mand without speci fy ing the optional fileid operand. In this case, the file will be writ ten to disk under its current fileid. The current fileid is dis played in the title bar of the docu m ent window and, unless you have changed it with a com mand like SET FILEID, is the fileid you origi nall y used when you began editing the file. You can use the optional fileid oper and to write the file to disk under a dif ferent fileid; the current in-mem ory fileid does not change. When spec i- fy ing the fileid operand, you can make use of the short cuts discusse d in connec ti on with the SET FILEID command.

You can also save your file using the File Save menu item and the Save button from the toolbar. You can use the File Save As menu item to set a new fileid for the current file

and save the file under that fileid. s d n Like the SAVE com mand, the SSAVE com mand also writes the current file to disk. The a m

dif ference between the com mands is that there are condi ti ons under which the SAVE m

com mand will give you an error, to warn you that you may be inadver tent ly overwrit ing o some data, while the SSAVE com mand will write your file to disk regardles s of the pos- C sible problem . The FILE and FFILE com mands have the same relati onship to each other as the SAVE and SSAVE com mands; see the descripti on of the FILE and FFILE com mands for a discus sion of the situ a ti ons where these possi ble problems can arise.

See also FILE, FFILE, QUIT, QQUIT, SET AUTOSAVE, SET BACKUP

Examples SAVE Saves the current file on disk under its current fileid.

SAVE A:SAMP1.PAS

Saves the file on disk under the name A:SAMP1.PAS.

SAVE, SSAVE 127 SAVE C:\TEST\ Saves the cur rent file in the \TEST direc tory of the C: drive (which must already exist), using the file’s current name and extension.

SCHANGE

Format SCHange /string1/string2/ [target ] [n] [m]

Description The SCHANGE (‘‘se lective change’’) com mand is simi lar to the CHANGE com mand, but it allows you to make changes selecti vely. To understa nd this descripti on of the SCHANGE com mand, you should first read the descripti on of the CHANGE command.

Note that the func tion of the Edit Replace dia log box is simi lar to that of the SCHANGE com mand. The Edit Replace dialog box is more frequentl y used and in many sit u a tions is more con ve nient.

Where the CHANGE com mand simply changes all occur rences of string1 into string2 in the spec ified area of the file, SCHANGE high lights each occur rence of string1 and asks you if you want to make the change. You have three choices:

· You can press func tion key F6. This causes the change to be made. SCHANGE then gives you a chance to undo the change by press ing F6 again be fore moving to the next occur rence of string1.

· Your sec ond choice is to press func tion key F5. This causes SCHANGE to move on to the next occur rence of string1.

· Your third choice is to press the Esc key. This cancel s the SCHANGE com mand im me di ately. The cur rent oc cur rence of string1 is not changed, and SCHANGE doesn’ t look for any further occur rence s of string1.

The operands to SCHANGE are the same as the operands for the CHANGE com mand and have the same mean ings. The only dif fer ences are that if you issue the comm and with out giv ing a target line, CHANGE will only affect the first occur rence of string1 in the focus line, while SCHANGE will ask you about all occurrence s of string1 in all lines from the focus line through the bottom of the file. If you issue the com mand with a tar get but without saying how many occurrence s in each line are to be proces sed, the CHANGE comm and will only affect the first occur rence in each line, while the SCHANGE com mand will ask you about all occurrences.

The last line scanned becomes the new focus line after the SCHANGE comm and fin ishes.

If you enter the SCHANGE com mand with no operands, KEDIT re-exe cutes the last SCHANGE com mand that you issued from the com mand line.

128 Chapter 3. KEDIT Commands When issued from a macro, the SCHANGE comm and sets the macro vari able SCHANGE.0 to 3, returns the num ber of occurrence s changed in SCHANGE.1, returns the num ber of lines changed in SCHANGE.2, and returns the num ber of lines truncat ed (because the changed text would have extended beyond the trunca ti on column) in SCHANGE.3.

See also CHANGE

SET

Format [Set] option value

Description The SET com mand allows you to control how KEDIT carrie s out many of its functi ons. You can decide, for exam ple, whether the wordwrap fea ture is enabled, what the left and right mar gins should be, and what colors to use when display ing text on your screen.

You can use the Options SET Options dia log box to set the values of most of the SET options.

The SET com mand is fully described in Chapter 4, “The SET Command”.

See also EXTRACT, MODIFY , PRE SERVE, RESTORE, QUERY, STA TUS

SHIFT s d n a

Format m

SHift Left|Right [n [target ]] m o C Description The SHIFT com mand moves the text in all lines in the tar get area LEFT or RIGHT n colum ns. If no tar get is spec ified , only the text in the focus line shifts. If n is not spec i- fied either, KEDIT shifts the text in the focus line one colum n to the left or right.

If STAY ON (the default) is in effect, the focus line locati on is unchanged after the shift. If STAY OFF is in effect, the last line shifted becomes the new focus line.

The SHIFT com mand affects text from the left zone colum n through the trunca ti on col- umn. Text that would be shifted left beyond the left zone col umn is lost, as is text that would be shifted right beyond the trunca ti on colum n.

You can use the SHIFT com mand with line blocks, box blocks, and one-line stream blocks. Box blocks and one-line stream blocks get specia l handli ng: text from the left boundary of the box block through the trunca ti on colum n shifts; the right boundary of the block is ignored. The SHIFT com mand cannot handle multi-line stream blocks.

SHIFT 129 Note that you can use Shift+F7 and Shift+F8 to shift the current ly marked block left or right by one charac ter , and you can use the Shift Block Left and Shift Block Right but - tons on the bottom toolbar for the same purpose.

Do not confuse the SHIFT com mand, which changes your file by moving text to the left or right, with the LEFT and RIGHT com mands, which affect which colum ns of your file are display ed, but do not change the content s of your file.

Examples SHIFT RIGHT 4 ALL All text in your file is shifted four col umns to the right.

SHIFT LEFT Text in the focus line is shifted one col umn to the left.

SHIFT RIGHT 1 4 Text in the focus line and the three lines follow ing it, for a total of four lines, is shifted one col umn to the right.

SHOWDLG

Format SHOWDLG dia log

Description The SHOWDLG com mand dis plays and proces ses one of KEDIT for Windows’ built-in dialog boxes. It is used mainly by the menu-handli ng macros that are acti vated when you select an item from one of KEDIT’s menus. For exam ple, when you use File Print, KEDIT runs the macro MENU_FILE_PRINT, and this macro uses the command

SHOWDLG PRINT to show KEDIT’s Print dialog box.

The dialog boxes control led by SHOWDLG, all of which take their name from the KEDIT menu item involved, are:

ABOUTKEDITFORWINDOWS ARRANGE BOOK MARK DIREC TORY FILL FIND GOTO INTER FACE OPEN [defaultdir] PRINT PRINTSETUP REPLACE

130 Chapter 3. KEDIT Commands SAVE SAVEAS SAVESETTINGS SCREENFONT SELECTIVEEDITING SETCOMMAND [option] SORT STA TUS

Notes · SHOWDLG OPEN takes an opti onal oper and speci fy ing the direc tory that you would like the File Open dia log box to display when it opens. For example: SHOWDLG OPEN "C:\My Direc tory" · SHOWDLG SETCOMMAND takes an opti onal oper and speci fy ing which SET opti on should initi ally be selec ted when the SET Com mand dia log box is dis - played. For exam ple: SHOWDLG SETCOMMAND WRAP · SHOWDLG SAVE is used in the proces sing of File Save, and usuall y does not ac- tu ally dis play a dia log box; un less an Un titled file is in volved, it imme di ately saves your file to disk under its current name. It is handled by the SHOWDLG com mand be cause its pro cess ing is simi lar to that of SHOWDLG SAVEAS.

SORT

Format SORT target [[Ascend ing|De scend ing] n1 m1] ... s d

Description The SORT com mand sorts the text of the spec ifie d tar get area. n a

KEDIT decides what order to put lines in by com paring charac ter s in the col umns spec - m m

ifie d by your sort fields. Each sort field is expressed as a pair of num bers giving the o

leftmost and rightmost colum ns of the field. (You can use an asterisk (‘‘*’’) instead of C the second num ber; in that case, KEDIT will use the right zone colum n as the rightmost colum n.) There can be up to ten sort fields. If you don’t specify any sort fields at all, KEDIT uses the current ZONE setti ngs to deter mine a sort field, except that if the tar get area is a box block, KEDIT uses the leftmost and rightmost colum ns of the block. You can precede a sort field speci fi ca ti on with ASCENDING or DESCENDING , which tells KEDIT to sort that field (and all fol low ing fields until you spec ify oth er - wise) in ascending or descending order. By default, KEDIT sorts all fields in ascending order. Unlike most other KEDIT com mands, the SORT com mand proces ses all lines in the tar get area, regard less of their selection level, so that even excluded lines are sorted. You can also access KEDIT’s sort facilit y by using the Actions Sort dialog box.

SORT 131 If STAY ON is in effect, the focus line pointer does not move after the sort is com plete. With STAY OFF, the sorted line that ends up clos est to the top of your file becomes the focus line.

If the SORT|NOSORT oper and of SET INTER NA TIONAL has the default value of NOSORT, KEDIT orders text accord ing to the char ac ter codes of the char ac ters involved. If the first IGNORE|RESPECT oper and of SET CASE is set to IGNORE, upper case and low er case ver - sions of the same letter (for example, ‘‘c’’ and ‘‘C’’) are treated as if they were both low ercase. Only the 26 letters from ‘‘A’’ to ‘‘Z’’ and from ‘‘a’’ to ‘‘z’’ are treated as alphabetic. With CASE RESPECT in effect, upper case and lower case versions of the same letter are treated as different characters.

If the SORT|NOSORT oper and of SET INTER NA TIONAL has the value SORT, the sort order used by KEDIT is deter mined by your Win dows lan guage driver. If the first IGNORE|RESPECT oper and of SET CASE is set to IGNORE, upper case and low er case ver sions of the same let ter (for example, ‘‘c’’ and ‘‘C’’) are treated as if they were both low ercase, with lowercasing also deter mined by your Win dows lan guage driver. With CASE RESPECT in effect, upper case and lower case versions of the same letter are treated as different characters.

The SORT comm and's han dling of inter na tional char acters (that is, alpha betic char ac - ters other than the 26 letter s of the Engli sh alphabet, such as the accented let ters found in many European languages ) is discusse d in connec ti on with the SET INTER NA - TIONAL com mand.

See Also SET INTER NA TIONAL

Examples SORT ALL D Sort all lines in the file into descending order, using the current zone setti ngs to define the sort field.

SORT 6 4 5 1 3 This tells KEDIT to sort six lines, beginning with the focus line, in ascending order according to the data in colum ns 4 through 5 (the first sort field) and then colum ns 1 through 3 (the second sort field). If the lines to be sorted looked like this:

ABCDE ABCED ABCDF ABEDE AABBC ZZZBC KEDIT would sort them into the follow ing or der:

AABBC ZZZBC ABCDE ABEDE ABCDF ABCED

132 Chapter 3. KEDIT Commands SORT 48 1 12 D 14 30 34 56 A 62 84 Sort the focus line and the 47 lines fol lowing it in ascending order based on colum ns 1 through 12, descending order based on colum ns 14 through 30 and 34 through 56, and ascending order based on colum ns 62 through 84.

SOS

Format SOS action1 [action2 ...]

Description The SOS (‘‘screen opera ti on sim ula ti on’’) com mand, used prim aril y in macros, han- dles a num ber of spe cialize d edit ing actions.

Many of these actions involve cursor placem ent and edit ing of text within the field con - tain ing the cur sor. For example, the SOS comm and lets you delete the char acter at the cursor posi tion, move the cursor to the next tab positi on, or move the cursor to the last nonblank charac ter of the field.

SOS also handles a num ber of miscel laneous actions, such as execut ing pending pre fix com mands and beeping the PC's speaker, that aren't handled else where in KEDIT. SOS ADDline Adds a blank line after the focus line. KEDIT posi ti ons the line in the docu m ent window accord ing to the NEWLINES setti ng. The cursor is moved to the newly-added line. SOS Alarm

SOS BEEP s The speaker beeps. d n a

SOS BLANKDown m SOS BLANKUp m

KEDIT searches for the next blank line. KEDIT searches up (SOS BLANKUP) or o down (SOS BLANKDOWN) from the focus line. The search conti nues unti l a C blank line (that is, a line with no nonblank charac ter s at or to the left of the trunca - tion colum n), or the top-of-file or end-of-file line, is encoun ter ed.

If the cursor is on the com mand line, the blank line becom es the current line. Oth - erwise , the cursor moves to the blank line. This line becom es the focus line. SOS BLOCKEnd SOS BLOCKStart If the cursor is on the com mand line, the first line of the marked block (with SOS BLOCKSTART) or the last line of the marked block (with SOS BLOCKEND) be- comes the cur rent line.

Other wise , the cursor moves to the first or last line of the marked block, with the cursor repo si ti oned to the start ing or ending col umn of a box block or stream block. An error occurs if there is no marked block in the current file.

SOS 133 SOS BOTTOMEdge The cursor moves to the bot tom most line of the file area. If this is below the end-of-file line, the cursor moves to the end-of-file line. SOS CDn SOS CLeft SOS CRight SOS CUp The cursor moves one colum n down, left, right, or up, accord ing to the rules used by the CUR SOR ESCREEN command. SOS CHECK SOS CHECK dis plays a message giv ing a checksum for all char acters in the cur sor line and for all charac ter s in the cursor line up to the cursor col umn. It also re ports on mism atched quotes and pa renthe ses in the cursor line. SOS CHECK is provided mainly to help Mansfield Software Group verify correct data entry while provid - ing tele phone support for KEDIT. SOS CURRent The cursor moves to the current line. SOS CURSORAdj Text in the cursor field is adjuste d so that the first nonblank charac ter of the text is locat ed at the cursor posi ti on. The cursor does not move. SOS DELBAck The cur sor moves one char acter to the left and then de letes the char acter at the new cur sor po si tion. SOS DELBEGin All text in the cursor field from colum n 1 up to (but not includ ing) the cursor col - umn is de leted, with text starting at the cursor col umn shift ing to colum n 1 to fill the gap. The cursor ’s posi ti on is unchanged. SOS DELChar The char acter at the cur sor po sition is de leted. SOS DELEnd All text in the cursor field, from the charac ter at the cursor posi ti on through the end of the field, is de leted. SOS DELLine The focus line is delet ed, with the line below it becom ing the new focus line. SOS DELSEL If DELSEL() is true (that is, INTER F ACE CUA is in ef fect, there is an anchored block or com mand line se lec tion, and the cursor has not moved and the file has not changed since the block or selec tion was marked), KEDIT delet es the block or se- lec tion. SOS DELSEL is used in the defaul t def ini ti ons of Del and Bksp when IN- TER FACE CUA is in effect to de lete a block or se lec tion that you have just marked. SOS DELWord The ‘‘word’’ (as de fined with the SET WORD com mand) at, or to the right of, the cur sor po si tion is de leted.

134 Chapter 3. KEDIT Commands SOS DOPREfix KEDIT exe cute s any prefix com mands pending for the current file. SOS ENDChar The cursor moves to the blank charac ter follow ing the last nonblank (or signif i cant trail ing blank) charac ter in the cursor line.

If the cursor line is empty, the cursor moves to the first colum n of the line. SOS ENDWord The cursor moves to the last charac ter of the current ‘‘word’’ (as de fined with the SET WORD com mand).

If the cursor is not in a word, it moves to the end of the next word; if there are no more words in the field, it moves to the end of the last word in the field; if the field is blank the cursor does not move. SOS ERRORBEEP If BEEP ON is in effect, the speaker beeps. SOS EX e cute The cursor moves to the com mand line, and KEDIT exe cute s any com mand on the com mand line. SOS FIRSTCHar The cursor moves to the first nonblank charac ter of the cursor line.

If the cursor line is blank, the cursor moves to the first colum n of the line. SOS FIRSTCOl The cursor moves to the first colum n of the cursor line. SOS INSTAB s

KEDIT insert s blanks into the current field from the cursor posi ti on to the next tab d n

posi ti on. The cursor moves to the next tab posi ti on. a SOS LEFTEdge m m

If the cursor is on the com mand line, it moves to colum n 1 of the com mand line. o Oth er wise, it moves to the leftmost col umn of the file area. C SOS LINEAdd Same as SOS ADDLINE. Adds a line below the fo cus line. SOS LINEDel Same as SOS DELLINE. De letes the fo cus line. SOS MAKECURR If the cursor is on the com mand line, nothing happens. Other wise , the cursor line be comes the cur rent line. SOS MARGINL The cursor moves to the left mar gin col umn of the cursor line. SOS MARGINR The cursor moves to the right mar gin col umn of the cursor line.

SOS 135 SOS MOUSEBEEP If MOUSEBEEP ON is in effect, the speaker beeps. SOS PARINDent The cursor moves to the paragraph indent colum n of the cursor line. SOS PREfix If the cursor line has a prefix area, the cursor moves to the first colum n of the prefix area. SOS QCmnd KEDIT moves the cursor to the first colum n of the com mand line and clears the content s of the com mand line. SOS QUICKFINDACT KEDIT ac tivates the Quick Find toolbar item, so that you can edit the string that it con tains. SOS QUICKFINDB SOS QUICKFINDf KEDIT searches forward (SOS QUICKFINDF) or back ward (SOS QUICK - FINDB) in your file for the Quick Find string. That is, KEDIT searches forward or backward for the string current ly display ed in the Quick Find toolbar item. SOS RESTORE SOS RESTORECol SOS RESTORELine KEDIT restore s the cursor posi ti on to the loca ti on it had in the current window when the posi ti on was last saved with SOS SAVE, SOS SAVECOL, or SOS SAVELINE. If no cursor posi ti on had previ ously been saved, KEDIT restore s the cursor to the first colum n of the command line.

With SOS REST ORE, both the line and colum n posi ti on within the window of the cursor are re stored.

With SOS RESTORECOL, the col umn posi ti on is re stored, but the cursor rem ains on the same line of the docu m ent window .

With SOS RESTORELINE, the line po si tion is re stored, but the cur sor stays in the same column. SOS RETRIEVEb SOS RETRIEVEF KEDIT cycle s backward or forward through lines of text previ ously enter ed on the com mand line, and redisplays them on the com mand line. If the com mand line is empty, then all previ ous com mands will be dis played. If you have enter ed any text on the com mand line, then only com mands be ginning with that text will be displayed. SOS RIGHTEdge If the cursor is on the com mand line, it moves to the rightmost colum n of the com - mand line. Other wise , it moves to the rightmost colum n of the file area.

136 Chapter 3. KEDIT Commands SOS SAVE SOS SAVECol SOS SAVELine KEDIT saves the cursor posi ti on within the current window so that SOS RESTORE can later be used to re store the cursor posi ti on.

SOS SAVE saves both the line and colum n posi ti on of the cursor .

SOS SAVECOL saves only the colum n posi ti on, without changing any previ ously saved line posi ti on.

SOS SAVELINE saves only the line posi ti on, without changing any previ ously saved col umn po si tion. SOS SETCOLPtr If the cursor is in the prefix area, no acti on is taken. Other wise , the colum n pointer is set to point to the cursor col umn. SOS SETLeftm If the cursor is in the prefix area, no acti on is taken. Other wise , the left mar gin col - umn is set to the cursor col umn. SOS SETTAB If the cursor is in the prefix area, no acti on is taken. Other wise , the cursor col umn is added to the list of tab col umns. SOS STARTWord The cursor moves to the first charac ter of the current ‘‘word’’ (as de fined with the SET WORD com mand). If the cursor is not in a word, it moves to the start of the preced ing word; if there are no preced ing words, it moves to the start of the first word on the line; if the line is blank the cursor does not move. s

SOS TABB d The cursor moves to the nearest tab posi ti on to the left of its current loca ti on. n a

If the cursor is on the com mand line and there are no preced ing tab posi ti ons, the m

cursor moves to colum n 1 of the com mand line. Other wise , if there are no tab m o

positions to the left of the cursor col umn, the cursor moves to the last tab posi ti on C on the line of the file above the cursor line. SOS TABCmd The cursor moves to the first colum n of the com mand line of the current window . SOS TABCMDB SOS TABCMDF The cursor moves to the previ ous or next docu m ent window , to the first colum n of the new window’ s com mand line. SOS TABf The cursor moves to the next tab posi ti on to the right of its current loca ti on. If the cursor is on the com mand line and there are no more tab posi ti ons, the cursor moves to the end of the com mand line. Other wise , if there are no tab posi ti ons to the right of the cursor col umn, the cursor moves to the first tab posi ti on on the line of the file below the cursor line.

SOS 137 SOS TABFIELDB The cur sor moves to the first char acter of the cur rent field. If the cur sor is al ready in the first char acter of the cur rent field, it moves to the first charac ter of the previ ous field, wrapping from the first field of the docu m ent win- dow to the last field of the doc um ent window if necessary. SOS TABFIELDf The cursor moves to the first charac ter of the next field, wrapping from the last field of the window to the first field of the doc um ent window if neces sary . SOS TABWORDB The cursor moves to the be ginning of the first ‘‘word’’ (as de fined with the SET WORD com mand) to the left of its current posi ti on. If there are no words to the left of the cursor , the cursor moves to the first colum n of the line. SOS TABWORDf The cursor moves to the be ginning of the first ‘‘word’’ (as de fined with the SET WORD com mand) to the right of its current posi ti on. If there are no words to the right of the cursor , the cursor does not move. SOS TOPEdge The cursor moves to the topm ost line of the file area. If this is above the top-of-file line, the cursor moves to the top-of-file line.

See also CUR SOR, TEXT

Examples SOS BEEP KEDIT beeps the PC’s speaker.

SOS CDN DELCHAR TAB The cursor moves down one line, and the charac ter at which the cursor is then posi- tioned is deleted. The cursor then moves to the next tab col umn.

SPLIT

Format SPlit [ALigned]

Description The SPLIT com mand splits a line into two lines. The SPLIT com mand is usuall y issued from a macro assigned to a key. (It is assigned to Alt+S by default.) Text to the left of the focus colum n remains in the focus line, while text in and to the right of the focus colum n is split off to form a new line.

SPLIT with no operands positi ons the split-off text to begin in colum n one of the new line. SPLIT ALIGNED (which Alt+S norm ally uses) adds as many leading blanks to the new line as there are in the focus line. This is useful when you are working with

138 Chapter 3. KEDIT Commands indented text, and you would like the text in the new line to be indented to the same col - umn as the focus line.

The SPLIT com mand does not affect the positi on of the focus line or focus colum n.

See also JOIN, SPLTJOIN

Examples Assume that the focus line looks like the follow ing, with the first nonblank charac ter of the focus line in colum n 5 and the cursor posi tioned at the ‘‘S’’ of the word ‘‘Split’’:

VVVVThis is the text to Split into two Press ing a key to which SPLIT is assigned would start the split-off text in colum n one, yield ing

VVVVThis is the text to Split into two A key with SPLIT ALIGNED, on the other hand, would pre serve the exist ing indenta - tion, giving

VVVVThis is the text to VVVVSplit into two

SPLTJOIN

Format SPLTJOIN

Description The SPLTJOIN com mand does either a SPLIT ALIGNED or a JOIN ALIGNED, s d

depending on the cursor posi tion. SPLTJOIN must be issued from a macro with the n cursor posi tioned in the file area; it is not valid if issued from the com mand line. a SPLITJOIN is assigned to functi on key F11 by default. If you issue the SPLTJOIN m m

com mand with the cursor at or to the left of the end of a line, SPLTJOIN splits the line o into two lines. When the cursor is past the last nonblank charac ter of a line, SPLTJOIN C joins together the content s of that line and the line below it.

When SPLTJOIN splits a line, it splits it at the cur sor posi tion, as if you had issued a SPLIT ALIGNED com mand. When SPLTJOIN joins a line with the line below it, it joins at the cursor col umn, as if you had issued a JOIN ALIGNED com mand.

See also JOIN, SPLIT

SPLTJOIN 139 STATUS

Format STATus

Description Using the STA TUS com mand is equiva lent to using the Options Status menu item: KEDIT display s a dialog box with the current values of most SET options.

See also Chapter 4, “The SET Command”, Chapter 5, “QUERY and EXTRACT”

SYNEX

Format SYNEX command

Description KEDIT usuall y checks each com mand issued from the com mand line to see if you have used the SET SYNONYM com mand to redefine its behavior . If so, KEDIT proces ses the com mand as spec ifie d in the synonym defi ni ti on. This synonym proces sing is nor- mally bypassed for com mands issued from macros. The SYNEX (‘‘synonym exe- cute’’) com mand specif ically requests that (unless SYN ONYM OFF is in effect) synonym proces sing apply to a com mand, even when it is issued from a macro.

SYNEX is useful only when issued from a macro, because synonym proces sing applies by default to com mands issued from the com mand line.

See also COM MAND, SET SYNONYM

Examples SYNEX DE LETE 3 KEDIT checks to see if you have defined a synonym for the DELETE com mand. If so, KEDIT pro cesses the syn onym. Other wise , KEDIT deletes three lines from your file.

TAG

Format TAG [target ]

Description The TAG com mand lets you highli ght all lines in your file that match a speci fie d tar get.

The TAG com mand sets the tag bit of all lines matching a speci fied tar get, clears the tag bit of lines that do not match the tar get, and then puts HIGHLIGHT TAGGED into effect so that the matching lines are highli ghted on your display .

Issuing the TAG com mand with no operands clears the tag bits of all lines in the file.

140 Chapter 3. KEDIT Commands See also User’s Guide Chapter 8, “Selective Line Editing and Highlighting”, LESS, MORE, SET HIGHLIGHT

Examples TAG /yester day/ Tags and highli ghts all lines in your file that contai n the string ‘‘yester day’’.

TAG BLANK Tags and highli ghts all blank lines in your file.

TAG Turns off the tag bits of all lines in your file, so that no lines are highli ghted.

TEXT

Format TEXT text

Description The TEXT com mand allows you, norm ally from within a macro, to sim ulat e typing the spec i fied text at the cursor posi tion. KEDIT proces ses the text just as if you had entered it from the keyboard, with the handli ng of the text affected by the cursor posi tion, the set tings of INSERTMODE and WORDWRAP, etc.

In fact, whenever you type text into KEDIT from the keyboard, the text is actuall y being passed to KEDIT by the TEXT com mand. For exam ple, the macro norm ally assigned to the A key is ‘‘text a’’, which enters a low er case ‘‘a’’ at the cur sor posi tion. The default macro for Shift+A is ‘‘text A’’, which enters an upper case ‘‘A’’ at the cur sor position. s d

If HEX ON is in effect, you can specify the text using hex a dec i mal or dec i mal nota tion, n as discusse d in the descripti on of SET HEX. a m m

Examples TEXT abcd o C The text ‘‘abcd’’ is proces sed by KEDIT as if you had typed the text at the cursor posi tion.

TEXT x'61626364' Assuming HEX ON is in effect, this example also causes KEDIT to pro cess the text ‘‘abcd’’ (spec ified by giv ing the char acter codes for the char acters in hex adec im al).

TEXT 141 TFIND

Format TFind [target ]

Description The TFIND com mand (‘‘tar get find’’) makes the line referred to by the spec ified tar get become the new focus line. If the tar get is a string tar get, however , the string must start in the left zone col umn of the line.

The TFIND com mand is used when you want to look for a string that starts in a parti cu - lar colum n. Since the left zone colum n is usuall y set to colum n 1, TFIND is most often used to search for a string that starts in colum n 1 of a line. This can be useful, for exam - ple, when working with assem bler language program s, where labels are norm ally defined beginning in colum n 1 of a line.

You can specify any type of tar get with the TFIND com mand, but for tar gets other than string tar gets, the TFIND com mand works exactly like the LOCATE com mand. With a string tar get, the TFIND com mand only finds occurrence s of the string starting in the left zone column, while the LOCATE comm and will locate occur rences anywher e between the left zone and right zone columns.

If you issue the TFIND com mand with no operands, KEDIT will re-execute the last TFIND com mand you issued, looking again for the same tar get.

The action of the TFIND com mand is affected by the setti ngs of HEX, WRAP, STAY, VARBLANK, ARBCHAR, CASE, ZONE, and THIGHLIGHT.

See also FIND, LOCATE

Examples TFIND /ABC/ The next line that has, beginning in the left zone colum n, ‘‘ABC’’, becomes the focus line.

LOCATE /ABC/

The next line that contai ns an ‘‘ABC’’ anywhere within the current zone becomes the focus line.

TFIND ~/9/

The next line that does not have a ‘‘9’’ in the left zone col umn becomes the focus line.

LOCATE ~/9/

The next line that does not contai n, any where within the current zone, a ‘‘9’’ becomes the focus line.

142 Chapter 3. KEDIT Commands TOP

Format TOP

Description The TOP com mand makes the top-of-file line become the focus line. With INTER - FACE CUA in effect, you can also press Ctrl+Home to get to the top of your file. With INTER FACE CLAS SIC you can instead press Ctrl+Page Up.

See also BOT TOM

UNDO

Format UNDO

Description The UNDO com mand, norm ally assigned to Alt+Bksp and to Ctrl+Z, will undo one level of changes to the cur rent file. You can issue the UNDO com mand repeat edly to undo additi onal changes.

You can also undo an action using the Edit Undo menu item or using the Undo but ton on the toolbar.

When ever it is possi ble to UNDO previ ous actions, the avail able undo level count (the third num ber fol lowing ‘‘Alt=’’ on the status line) will be nonzero.

See also User’s Guide Chapter 3, “Using KEDIT for Windows”, REDO, RESET, SET

UNDO ING s d n a m

UNLOCK m o C Format UNLOCK

Description Use the UNLOCK com mand to allow other users to access the disk copy of a locked file that you are editing .

The UNLOCK com mand causes KEDIT to unlock the current file. That is, KEDIT closes the file handle associ ate d with the disk copy of the current file.

Attempt ing to UNLOCK a file that is not locked causes an error mes sage. If the cur rent file is locked, KEDIT dis plays ‘‘Locked’’ to the right of the sta tus line. Addition ally, if the cur rent file is locked and IDLINE ON is in effect, its fileid will be pre ceded on the idline with an aster isk.

See also User’s Guide Chapter 12, “File Processing”, LOCK, SET LOCKING

UNLOCK 143 UP

Format Up [n]

Description The line n lines above the focus line becomes the new focus line. If n is not spec ified , the line above the focus line becomes the focus line.

See also DOWN

Examples UP The line above the focus line becomes the new focus line.

UP 4 The line four lines above the focus line becomes the new focus line.

UPPERCASE

Format UPPer case [target ]

Description Use the UPPER CASE comm and to con vert low er case char acters in a spec ified por tion of your file to upper case char acters.

If you give no operands, the UPPERCASE com mand convert s the focus line to uppercase. Oth er wise, all text within the spec ified tar get area that falls within the current ZONE colum ns is convert ed. If the tar get area is a box block, its entire content s are con verted, regard less of the ZONE set tings. If STAY OFF is in effect, the last line uppercased becomes the focus line. Other wise , the focus line locati on does not change.

With the default of INTER NA TIONAL NOCASE in effect, LOW ERCASE treats only the 26 let ters from ‘‘A’’ to ‘‘Z’’ and from ‘‘a’’ to ‘‘z’’ as alpha betic. With INTERNATIONAL CASE in effect the char acters to be treated as alpha betic, and what their lower cas e equiva lent s are, are determ ined by your Windows language drivers.

Note that you can use the default def ini ti on of Shift+F5, the Actions Uppercas e menu item, or the Uppercas e Block button on the bottom toolbar to uppercas e a block of text.

See also LOW ER CASE, SET INTER NA TIONAL

Examples UPPER CASE All low er case char acters in the focus line are con verted to upper case.

144 Chapter 3. KEDIT Commands UPPER -4 All low er case char acters in the focus line and in the three lines above it, for a total of four lines, are convert ed to uppercas e.

WINDOW

Format WINdow MINimize|MAXimize|RESTORE [DOCument|FRAME] WINdow CASCADE WINdow TILE [Horizontally|Vertically] WINdow ARRANGE [Horizontally|Vertically] WINdow CLOSE [DOCument|FRAME|FILE] WINdow NEWwindow WINdow NEXTwindow|PREVwindow WINdow ARRANGEIcons WINdow MENUmode [menuname]

Description The WINDOW com mand perform s assorted opera ti ons related to the sizing and posi- tioning of KEDIT’s frame win dow or of your doc um ent windows. The WIN DOW com mand is most often used in macros and is not usuall y issued directly from the com - mand line. For exam ple, the macro that handles the Window Cas cade menu item issues the WINDOW CASCADE com mand to tell KEDIT to cascade your document windows. WIN dow MIN i mize|MAX i mize|RE STORE [DOC u ment|FRAME] KEDIT mini m izes a window , maxi m izes a window , or restore s a window to the nor mal (non-min i mized, non-max i mized) state. The op er a tion can af fect the cur- rent DOC U MENT win dow (this is the de fault) or it can affect the FRAME window. s

WIN dow CAS CADE d n

KEDIT cas cades its docu m ent windows. This is equiva lent to using the Window a Cascade menu item. m m

WIN dow TILE [Hor i zon tally|Ver ti cally] o KEDIT tiles its doc u ment win dows ei ther HOR I ZON TALLY (this is the de fault) C or VER TICALL Y, as it does when you use the Window Tile Hori zon tal ly or Win- dow Tile Ver tically menu items. WIN dow AR RANGE [Hor i zon tally|Ver ti cally] KEDIT arranges its docu ment win dows either HOR IZON T ALLY (this is the de- fault) or VER TICALL Y, as it does when you use the Window Arrange. .. menu item. WIN dow CLOSE [DOC u ment|FRAME|FILE] KEDIT closes ei ther the current DOC U MENT window (this is the de fault), the FRAME window , or the current FILE. Closing the docu m ent window is equiva - lent to se lecting Close from the doc um ent window’ s system menu. Closing the frame window is equiva lent to se lecting Close from the frame win dow’s system menu, or to us ing File Exit. Clos ing the file is equiv a lent to us ing the File Close menu item.

WINDOW 145 WIN dow NEWwindow KEDIT create s a new docu m ent window , giving you an addi ti onal view of the cur- rent file. This is equiva lent to using the Window New Window menu item. WIN dow NEXTwindow|PREVwindow KEDIT makes the next or pre vious docu m ent window becom e the current docu - ment window . This is the de fault behav ior of Ctrl+F6 (which moves to the next docu m ent window) or Shift+Ctrl+F6 (which moves to the previ ous docu m ent window). WIN dow ARRANGEIcons KEDIT rear ranges any mini m ized docu m ent windows so that they are lined up neatly near the bottom of the frame window; this is equiva lent to using the Win- dow Arrange Icons menu item. WINdow MENUmode [menuname] KEDIT acti vates its menu bar. To dis play and ac tivate a spe cific menu, you can spec ify menuname, which can be File, Edit, Ac tions, Opti ons, Window , Help, DOCu m ent (to ac ti vate the doc um ent window’ s system menu), or FRAME (to ac - tivate the frame win dow’s system menu).

WINEXEC

Format WINEXEC [WAIT|NOWAIT] [NORMal|MAXimize|MINimize] command

Description Use the WINEXEC com mand to run an external Windows or DOS program .

Spec ify the com mand involved in the same way as you would when using the Run option from the Windows Start Menu: give the name of the module involved (possi bly including a drive and/or path specifier) followed by any com mand line param eter s that you want to pass to the module.

You can pre cede the com mand with an option speci fy ing either WAIT (this is the default) or NOWAIT. With the WAIT option, KEDIT is inacti ve and can accept no fur- ther mouse or keyboard input until the exter nal com mand com pletes. With the NOWAIT option, KEDIT remains active after the exter nal comm and starts and you can interact with KEDIT without wait ing for the external com mand to complete.

You can also pre cede the com mand with an option that speci fie s whether the program that you execute should start out with a NOR MAL window (that is non-maxi m ized, non-mini m ized window; this is the default), a MAXI MIZE D window , or a MINI - MIZED window.

Notes · While you can run both Windows and text mode Com mand Prompt-style pro- grams via the WINEXEC com mand, it is usuall y prefer a ble to run text mode pro- grams via KEDIT’s DOS com mand or the re lated DOSNOWAIT or DOSQUIET com mands, and to use the WINEXEC com mand for running Windows program s. This is be cause the DOS comm and will auto mati cally han dle comm ands that are inter nal to CMD.EXE, will insure that the text mode program ’s output re mains on

146 Chapter 3. KEDIT Commands the screen unti l you have had a chance to see it, and will rem ove KEDIT for Win- dows from the screen while waiting for your text mode program to com plete, while the WINEXEC command does none of these.

· When issued from a macro WINEXEC WAIT (but not WINEXEC NOWAIT) re- turns infor m ati on about the exit code set by the com mand that was exe cute d. De- tails on this are given in the dis cussion of the DOS command.

See also DOS

Examples WINEXEC NOTE PAD Starts the Windows Note pad program . Since WAIT and NOR MAL are in effect by default, Notepad starts up with its default window size and KEDIT is inacti ve until Notepad has finishe d running.

WINEXEC NOWAIT NOTEPAD C:\AUTOEXEC.BAT Starts the Windows Note pad program , with its default window size, and tells it to edit the file C:\AUTOEXEC.BAT. Because the NOWAIT option is spec ified , KEDIT does not wait for Note pad to finish execu ti on. Both program s are active at once and you can switch between the two program s and do work in either of them.

WINHELP

Format WINHELP fileid [topic] s d

Description Use the WINHELP com mand to invoke the Windows Help program so that you can n view a Windows Help file. a m m

The WINHELP com mand is available mainly for com pati bil ity with pre vious versions o

of KEDIT. It is useful only with older, Windows 3.1-style, .HLP Help files and does not C work with the .CHM HTML Help files more com monly used by current Windows appli cati ons. In parti cu lar , it does not work with the current KEDIT for Windows Help file, which uses the newer HTML Help format.

Spec ify the fileid of the Help file that you want to view. You should include the .HLP file extension and (unless the Help file is in the current directory , in the Windows direc- tory, or in your PATH), the drive and path specifier for the Help file.

You can optionall y supply a topic to search for in the Help file. The Windows Help pro- gram will then jump to that topic in the Help file or, if there are either no matching top - ics or more than one matching topic, will display its Search dialog box. If you do not spec ify a topic, Win dows Help will dis play the Help file’s Con tents page.

See also HELP

WINHELP 147 Examples WINHELP C:\SDK31\WIN31WH.HLP ShowCaret Assuming that the Help file WIN31WH.HLP is installed in your C:\SDK31 direc tory, this com mand would tell Windows Help to display that Help file and to search for help on the topic ShowCaret.

WMSG

Format WMSG com mand

Description WMSG, used mainly in macros, exe cutes a comm and and dis plays any error message that the com mand gener ate s in a Windows message box instead of on the message line.

See also CMSG, DMSG, EMSG, MSG

Examples WMSG LOCATE /Tomor row/ This exam ple, which would be in quotes if it were included in a macro, looks for the string ‘‘Tom orrow’ ’. If the string is found, KEDIT makes the line that contai ns the string become the focus line, in the norm al way. But if an error is encounter ed, the error message is not display ed within the doc um ent window , on the message line, but is instead display ed in a pop-up Windows message box.

XEDIT

Format Xedit [fileid ...] [(options [)]]

Description Use the XEDIT com mand to begin editing one or more addi tional files. See the description of the KEDIT com mand for details on the XEDIT com mand. The XEDIT com mand perform s exactly the same functi ons as the KEDIT com mand.

See also KEDIT

&

Format &commandline

Description When you precede a com mand line with an ampersand (‘‘&’’), KEDIT handles all the com mands on the com mand line in the norm al way and then redisplays the com mands (precede d by an ‘‘&’’) on the com mand line. This allows you to easil y re-execute the com mand line repeatedly , and lets you make changes to the com mand before re-enter- ing it.

148 Chapter 3. KEDIT Commands Examples &LOCATE /12.4/ KEDIT locates the next line contai ning ‘‘12.4’’, then redisplays

&LOCATE /12.4/

on the com mand line.

?

Format ?[+]

Description The ? com mand, norm ally assigned to func tion key F6, causes KEDIT to redisplay on the com mand line the last com mand entered on the com mand line. You can then edit the com mand and re-enter it.

You can issue the ? com mand repeatedly to get back the second-to-t he-last com mand entered, then the third-to-the-last, etc., even tu ally cycling back to the most recent com- mand. KEDIT saves the last 40 com mand lines entered. As a shortcut, you can enter multi ple questi on marks on the same com mand line. If you enter two consec uti ve ques - tion marks on the same com mand line, KEDIT shows you the second-to-t he-last com - mand entered. Three questi on marks give you the third-to-the-last, etc.

KEDIT norm ally moves backward through the set of saved com mand lines, from the most recent to the least recent. If you enter one or more ques tion marks fol lowed by a plus sign (for exam ple, ‘‘?+’’), KEDIT will cycle forward through the saved com mand s

lines, from least recent to most recent. d n a

Any text on the com mand line fol lowing the ques tion marks (and possi ble plus sign) is m ignored. m o C

See also SOS RETRIEVEB, SOS RETRIEVEF

Examples DELATE 4 ? In this exam ple, you want to issue the com mand DELETE 4 but you have spelled the word ‘‘DELETE ’’ wrong. Instead of retyping the entire com mand line, you can sim ply issue the ? com mand (either by typing it in or by pressing F6). KEDIT will then redisplay ‘ ‘DELATE 4’’ on the com mand line, and you can sim ply change the ‘‘A’’ in DELATE to an ‘‘E’’ and press Enter.

??

KEDIT redisplays the second-to-t he-last com mand line entered.

? 149 =

Format = [com mand]

Description The = com mand, assigned by default to functi on key F9, causes KEDIT to re-execute the com mand in the equal buffer, which is norm ally the most recently com pleted com - mand issued from the com mand line. For exam ple, if you type in

DOWN 3 to cause KEDIT to move down three lines in the file and you then enter

= KEDIT will move down three more lines.

You can enter sev eral ‘‘=’’s in a row to cause KEDIT to re-execute a comm and sev eral times.

=== would cause the last com mand to be re-executed three times.

The ‘‘=’’ can optionall y be followe d by a com mand that you want KEDIT to proces s before the last comm and is re-exe cuted. For exam ple, assume that you enter these com mands:

DOWN 3 =TOP DOWN 3 causes KEDIT to move down three lines in your file. =TOP tells KEDIT to re-exe cute the DOWN 3 com mand after first moving to the top of your file, so the net effect of this sequence is to make line 3 of your file become the focus line.

Com mands issued from macros, as opposed to the com mand line, are not autom ati cal ly put into the equal buffer and made avail able for the = com mand, but you can use the SET = com mand to set the content s of the equal buffer from within a macro.

Com mands issued via menu and toolbar opera ti ons do not affect the content s of the equal buffer.

See also REPEAT, SET =

150 Chapter 3. KEDIT Commands Chapter 4. The SET Command

The SET com mand lets you control how KEDIT carrie s out many of its functi ons. You can decide, for example, whether the wordwrap fea ture is enabled, what the left and right mar gins should be, and what colors to use to display text on your screen. The general form at of the SET com mand is

[Set] option value For exam ple,

SET MAR GINS 1 60 5 SET TABS 1 10 16 30 SET WRAP OFF You are allowed, however , to leave out the word ‘‘SET’’ and sim ply spec ify the option and its value. (SET ALT and SET = are excepti ons; SET must be spec ifie d for these options to avoid confu sion with the ALTER and = com mands.) So the previ ous examples could in fact have been entered like this:

MAR GINS 1 60 5 TABS 1 10 16 30 WRAP OFF

Format For each SET option, the discus sion involves:

· The form at of the corre spond ing SET com mand, includ ing the operands involved and the mini m al trunca ti ons that you can specify.

· The de fault value of the opti on.

· The level at which the op tion takes ef fect; this can be the Global, File, or View level, and is discusse d in more detai l below .

· The di alog box that you can use, as an al ter nati ve to issu ing the SET com mand from the com mand line, to control the value of the opti on. In most cases, this is the Opti ons SET Com mand dia log box. Some of the more spe cialize d opti ons do not have a corre spond ing di alog box and can only be changed via the SET command.

· Infor m ati on on whether the value of the SET opti on can be saved in the Windows reg is try so that it will take ef fect in fu ture KEDIT ses sions.

· The bulk of the docu m enta ti on for most SET opti ons consis ts of a descri pti on of s

the opti on and its operands, along with exam ples of their use. n o i t

Default value The fol lowing pages contai n a dis cussion of each of the options that can be set. Each p O option has a default value, which is in effect until you change it. There are several ways T

in which the default value of an option can be changed: E S · At the start of each session KEDIT proces ses the KEDIT sec tion of the Windows regis try . Among other things, KEDIT’s regis try sec tion contai ns set tings that you

151 changed in pre vious ses sions and then saved, using the Opti ons Save Set tings menu item or re lated fa cil ities, so that they would take effect in fu ture KEDIT sessions.

· At the start of each session KEDIT also proces ses your profil e macro, which is nor mally called WINPROF.KEX. Your pro file is pro cessed af ter the set tings in the regis try , and changes made to your setti ngs by SET com mands issued from your profil e override any changes made to those same setti ngs via the registry.

· Finall y, you can change the values of SET opti ons at any time during a KEDIT ses- sion by issu ing SET com mands from the com mand line or from macros, or by us- ing the Opti ons SET Com mand dialog box.

Level The descripti on of each SET option indi cates the ‘‘level’’ at which the option takes effect. Some SET options are at the Global level, affecting your entire KEDIT ses sion. Some options are at the File level, affect ing only the current file. Other options are at the View level, and can be dif fer ent for each view you have of a file that is displayed in mul ti ple windows.

At the Global level are options like STATUSLINE, which determ ines whether KEDIT display s a line of sta tus inform ati on at the bottom of its frame window , and MACROPATH, which control s which directo rie s KEDIT searches when looking for a macro. Most options at the File level affect how a file is read from or written to disk, such as LRECL and TABSOUT. This is because if you have several files in the ring, you might want them all to be written to disk with differ ent record lengths. But if the same file is dis played in mul tiple win dows, it is unlikely that you would want it to be writ ten to disk with dif ferent record lengths depending on which window the save opera ti on was initi ated from. The largest num ber of options are at the View level, since you might well want to have, for exam ple, dif ferent VERIFY set tings in dif ferent views of the same file. The largest num ber of options are at the View level, since you might well want to have, for exam ple, dif ferent VERIFY set tings in different views of the same file.

Saved settings The values of most SET options can be saved in KEDIT’s sec tion of the Windows reg- istry . These saved set tings are then put back into effect at the start of each future KEDIT ses sion.

The values of the fol lowing SET options can be saved: ARBCHAR, ARROW, AUTOEXIT, AUTOINDENT, AUTOSAVE, AUTOSCROLL, BACKUP, BEEP, BOUNDMARK, CASE, CLOCK, CMDLINE, COLMARK, COLOR, CURLINE, CURRBOX, CURSORSIZE, CURSORTYPE, DEFEXT, DEFPROFILE, DEFSORT, DIRFORMAT, DOCSIZING, ECOLOR, EOFIN, EOFOUT, EOLIN, EOLOUT, FCASE, FORMA T, HELPDIR, HEX, HEXDISPLAY, HIGHLIGHT , IDLINE, IMPMACRO, INITIALDIR, INITIALDOCSIZE, INITIALFRAMESIZE, INITIALINSERT, INITIALWIDTH, INPUTMODE, INTER FACE, INTERNATIONAL, KEYSTYLE, LINEND, LOCKING , MACROPATH, MARGINS, MARKSTYLE, MONI T OR, MOUSEBEEP, MSGLINE, NEWLINES, NOVALUE, NUM BER, OFPW, PATH, PCOLOR, PREFIX (but not PREFIX SYN- ONYM), PREFIXWIDTH, PRINTCOLORING, PRINTER, PRINTPROFILE, RECENTFILES, RIGHTCTRL, SCALE, SCROLLBAR, SHADOW, SHARING ,

152 Chapter 4. The SET Command STATUSLINE, STAY, STREAM, SYNONYM ON|OFF, TABLINE, TABS, TABSIN, TABSOUT, THIGHLIGHT , TIMECHECK, TOFEOF, TOOLBAR, TRAIL ING, UNDOING , VARBLANK, WINMARGIN, WORD, WORDWRAP, and WRAP.

You can use Edit Save Setti ngs or the com mand REGUTIL SAVE SET TINGS to update the values of all of these options in the Windows regis try . You can update indi- vidual values by using the Save Setti ng button within the Options SET Com mand dia - log box, or by using the REGUTIL SAVE SET option com mand. Not all of these option values are actuall y written to the regis try ; to speed things up, KEDIT only writes out the options whose val ues dif fer from the built-in KEDIT default.

There is one specia l class of SET options whose values are auto mati cal ly updated in the Win dows reg istry when ever they are set. These are SET INSTANCE, SET INITIALDIR, SET INITIALDOCSIZE, SET INITIALFRAMESIZE, SET INITIALINSERT, and SET INITIALWIDTH, and what they have in com mon is that they have an effect only dur ing KEDIT ini tializa tion. They are auto mati cally saved because there is no point in setti ng these options unless the changes are reflected in Windows regis try so that they can affect future KEDIT sessions . Set ting these options has no effect on the current KEDIT session, because you don’t get a chance to set them until KEDIT has already been ini tialize d. But whenever you set one of these options, the new value is auto mati cally saved in the reg is try, and it will affect future KEDIT sessions.

Unsupported The fol lowing SET options, supporte d in earli er versions of KEDIT, are not used by SET options this version of KEDIT for Windows: BLINK, BOR DER, CURSORSHAPE, EAPRESERVE, FILEOPEN, KEYBOARD, LOGO, MOUSE, MOUSEBAR, PSCREEN, RETRACE, REXXIO, SHIFTSTATE, SWAP, SYSRC, and TOPVIEW. Any SET com mands issued from the com mand line for these options will yield an error message . SET com mands for these options issued from macros will yield a return code of 4 and will be other wise ignored; avoiding an error message in this sit ua ti on means that many exist ing macros that use these options will conti nue to work. Additi onall y, QUERY and MODIFY com mands for these options will yield an error message , while EXTRACT com mands and implied EXTRACT functi ons involving these options will return default information.

SET ATTRIBUTES is supporte d in KEDIT for Windows for com pati bil ity with earli er versions of KEDIT, but it is not doc um ented here because new users are encouraged to use SET COLOR, which is now the pre ferred alterna tive . QUERY, MODIFY , and EXTRACT ATTRIB UTES are also still available.

SET MOUSETEXT is supporte d in KEDIT for Windows for com pati bil ity with earli er versions of KEDIT, but it is not doc um ented here because new users are encouraged to s

use SET TOOLBUTTON and SET TOOLSET. QUERY, MODIFY , and EXTRACT n o

MOUSETEXT are not supporte d. KEDIT for Windows handles SET MOUSETEXT i t

com mands by internall y con vert ing them to the equiva lent SET TOOLSET BOTT OM p O

com mands, and your text mode mousebar text is dis played as on KEDIT’s bottom toolbar. The bot tom toolbar is not display ed by default, but can be control led via the T E

SET TOOLBAR command. S

153 See also EXTRACT, MOD IFY, PRE SERVE, RESTORE, STA TUS, Chapter 5, “QUERY and EXTRACT”

SET ALT

Format Set ALT n1 [n2]

KEDIT default: 0 0

Level: File

Dialog box: None

Save Set tings handli ng: Not savable

Description SET ALT, used mainly in macros, lets you change KEDIT’s alter ation counts. KEDIT keeps track of two types of ’’al ter ation count’’. The first is the num ber of changes since your file was last saved or autosaved. (Your file is saved when you issue the SAVE com mand or use the File Save or File Save As menu items.) The sec ond is the num ber of changes since the last save, regardles s of interven ing autosaves. Both alterati on counts are increm ented whenever you issue a com mand that changes the content s of your file. A single com mand may affect many lines of your file, but will only add 1 to the alter ation counts. A macro that issues a large num ber of comm ands may incre ment the alter ation counts many times.

The first alterati on count is used by the autosave facil ity. Whenever enough changes have been made to your file since the last save or autosave (you set the threshold for this with the SET AUTOSAVE com mand), KEDIT will autosave your file.

The second alterati on count is used by the QUIT com mand. If you try to quit from a file which has been altered since the last save (that is, its sec ond alteration count is not zero), KEDIT will not quit the file but will give you a message warning you that the file has been changed. The sec ond alterati on also affects, when you use File Close, whether or not KEDIT asks if you want to save the file.

After every suc cess ful autosave, the value of the first alter ation count is reset to zero. After every suc cess ful save, the val ues of both alter ation counts are reset to zero. The UNDO and REDO comm ands also affect the alter ation count.

KEDIT display s the alterati on counts on the status line as the first two num bers after ‘‘Alt=’’; the third num ber fol lowing ‘‘Alt=’’ indi cates how many levels of changes are avail able to KEDIT’s undo facil ity.

See also SET AUTOSAVE

154 Chapter 4. The SET Command Examples SET ALT 100 This sets the first alterati on count for your file to 100. The word ‘‘SET’’ is required for the ALT option to avoid confu sion with the ALTER com mand. If AUTOSAVE is set to some num ber less than 100 when this com mand is issued, an autosave will immedi ate ly take place and the alter ation count will be reset.

SET ALT 0 0 This sets both alterati on counts for the current file to 0. You could then QUIT from the file even if it had been changed, since the QUIT com mand is allowed if the sec ond alter ation count is zero.

SET ARBCHAR

Format [Set] ARBchar ON|OFF [char1] [char2]

KEDIT default: OFF $ ?

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description When ARBCHAR (‘‘arbi trary charac ter ’’) is ON, the charac ters char1 and char2 (known as the ARBCHAR charac ter s) have a spe cial meaning when used in string tar - gets, string col umn tar gets, with the CHANGE and SCHANGE com mands, and with the Edit Find, Edit Replace and Edit Selec tive Editing dialog boxes.

When ARBCHAR is on and KEDIT is looking for a string, the ARBCHAR charac ter s act as wild card char acters. The first ARBCHAR char acter , usuall y a dollar sign (‘‘$’’), will match any group of zero or more char acters. The second ARBCHAR char acter , usu ally a ques tion mark (‘‘?’’), will match any sin gle char acter . For example, assume that

ARBCHAR ON $ ? is in effect and you enter

/ab$c/ s

Then any of the fol lowing strings would be matched: n o i t

abc p

abbc O

abfgfghc T E

They would be matched because the search string you gave will match any string of S charac ter s contai ning an ‘‘a’’ followed immedi ate ly by a ‘‘b’’ followed by any group of zero or more charac ter s followe d by a ‘‘c’’. So in the first string above, the ‘‘$’’

SET ARBCHAR 155 matched the empty string. In the sec ond string above the ‘‘$’’ matched the sec ond ‘‘b’’. In the third string, the ‘‘$’’ matched ‘‘fgfgh’’.

If you enter

/ab?c/ then ‘‘?’’, the sec ond ARBCHAR char acter , will match any sin gle char acter . So, of the three strings above, ‘‘/ab?c/’’ will only match the second string, ‘‘abbc’’, since that is the only one consis ting of an ‘‘a’’, a ‘‘b’’, exactly one other charac ter , and then a ‘‘c’’.

You can use more than one arbitrary char acter in the same search string. For example, the tar get

/The$saw$boy./ would match

The man saw the small boy. Note that it would not match

The man the boy saw. When ARBCHAR is OFF, the ARBCHAR char ac ters have no spe cial mean ing, so they match only them selves.

When you use the first ARBCHAR char acter (usu ally a ‘‘$’’) as the first char acter in the string to be changed by a CHANGE or SCHANGE com mand, or with the Edit Replace dia log box, it will match all char ac ters start ing from the left zone column. If it is the last char ac ter, it will match all char ac ters through the right zone column. If it is the only char acter in the string to be changed, it will match all char acters from the left zone colum n through the right zone column.

Assume that ZONE 1 8 is in effect and that the focus line is

12345678 The comm and

C/$3/A/ would change the focus line to

A45678 The comm and

C/3$/A/ would give you

12A while

156 Chapter 4. The SET Command C/$/A/ would give you

A You can also use the first ARBCHAR charac ter , norm ally ‘‘$’’, on the right side of a CHANGE or SCHANGE com mand, or in the Edit Replace dialog box. The first ‘‘$’’ on the right side of a CHANGE comm and is replaced by all char acters matched by the first ‘‘$’’ on the left side, the sec ond ‘‘$’’ on the right is replaced by charac ter s matching the sec ond ‘‘$’’ on the left, etc. There must be at least as many ‘‘$’’s on the left as on the right. (The sec ond ARBCHAR char ac ter, nor mally ‘‘?’’, works similarly.)

Again, assume that ZONE 1 8 is in effect and the focus line contai ns

12345678 The comm and

C/1$8/A$Z/ gives

A234567Z With ZONE 1 8 still in effect and ‘‘12345678’’ on the focus line

C/$4$5$/$A$B$C/ gives

123AB678C

Examples ARB ON This sets ARBCHAR ON, so that the cur rent ARBCHAR char ac ters take on the spe cial meanings discusse d above when used in string searches. Unless you say other wise , ‘‘$’’ and ‘‘?’’ are the ARBCHAR char acters.

ARB OFF This sets ARBCHAR OFF, so that the ARBCHAR char ac ters have no spe cial mean ing in string searches.

ARB ON * + s n

This turns ARBCHAR ON and sets ‘‘*’’ up as the charac ter that matches any group of o i zero or more char acters and ‘‘+’’ as the char acter that matches any sin gle char acter . t p O

ARB ON [ T E

This turns ARBCHAR ON and sets ‘‘[’’ as the char acter that matches any group of zero S or more char acters. The char acter that matches any sin gle char acter is unchanged from the value already in effect.

SET ARBCHAR 157 SET ARROW

Format [Set] AR Row ON|OFF

KEDIT default: ON

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description With ARROW ON, the default, KEDIT display s an arrow (‘‘====>’’) at the beginning of the com mand line. This makes it eas ier for you to keep track of whether the cursor is on the com mand line or in the file area. With ARROW OFF, the arrow does not appear.

SET AUTOCOLOR

Format [Set] AUTOCOLOR .ext parser

KEDIT default: See the table below

Level: Global

Dialog box: None

Save Set tings handli ng: Not savable

Description Use SET AUTOCOLOR to determ ine the syntax color ing parser used for files with a spec i fied exten sion.

When the default of COL ORING ON AUTO is in effect for a file, KEDIT decides which parser to use for that file by exam ining the file’s extension. If SET AUTOCOLOR has been used to specify a parser for that extension, KEDIT uses that parser to control syntax color ing for the file. The NULL parser, which does no syntax color ing, is used whenever a file has an extension for which no parser has been specified.

For exam ple, the com mand

SET AUTOCOLOR .LNG LANG tells KEDIT to use the LANG parser (which must already have been defined via the SET PARSER com mand) for files with an extension of .LNG.

Pars ers referred to in SET AUTOCOLOR com mands must already be defined, either by being built into KEDIT or via the SET PARSER com mand.

158 Chapter 4. The SET Command SET AUTOCOLOR is autom ati cal ly put into effect for the follow ing extensions during KEDIT ini tial iza tion:

Extension Parser .BAS BASIC .FRM BASIC .C C .COB COBOL .COBOL COBOL .CBL COBOL .CPP C .CXX C .CS CSHARP .DLG RESOURCE .FOR FORTRAN .FORTRAN FORTRAN .F90 FORTRAN .F FORTRAN .H C .HPP C .HXX C .HTM HTML .HTML HTML .INI INI .JAV JAVA . JAVA JAVA .KEX REXX .KML REXX .REX REXX .KLD KLD s n

.PAS PASCAL o i t

.DPK PASCAL p O

.DPR PASCAL T E

.PRG XBASE S .RC RESOURCE

SET AUTOCOLOR 159 See also SET COLOR ING , SET ECOLOR, SET PARSER, Chapter 8, “KEDIT Language Definition Files”

SET AUTOEXIT

Format [Set] AUTOEXIT ON|OFF

KEDIT default: OFF

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET AUTOEXIT deter mines whether KEDIT auto mati cally exits when the last file in the ring is closed.

With the default of AUTOEXIT OFF, KEDIT keeps running even if there are no files in the ring and all of its docu m ent windows have been closed. You can then begin edit ing other files, or you can use File Exit to close KEDIT’s frame win dow and end your edit- ing session.

With AUTOEXIT ON, your edit ing session ends whenever the last file is removed from the ring. Some KEDIT users prefer this behavior , because it is more like the behavior of text mode KEDIT and because it saves the extra step of closing KEDIT’s frame win dow to exit KEDIT after clos ing the last file in the ring.

SET AUTOINDENT

Format [Set] AUTOIndent ON|OFF

KEDIT default: OFF

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET AUTOINDENT control s where the default F2 and (if INTER FACE CUA is in effect) Enter key defi ni ti ons posi tion the cur sor after they add a line to your file.

With the default of AUTOINDENT OFF, the cursor is positi oned in the left mar gin col - umn of the newly-added line.

160 Chapter 4. The SET Command With AUTOINDENT ON, the cur sor is lined up with the first charac ter of the line above the new line. If that line is blank, the cursor stays in the col umn that it was in.

AUTOINDENT ON is useful when you are entering text in a program ming language like C, where dif ferent por tions of the file are indented to dif ferent levels , but where you most often want each line indented to the same level as the line above it.

SET AUTOSAVE

Format [Set] AUtosave n|OFF

KEDIT default: OFF

Level: File

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description Use SET AUTOSAVE (‘‘au to matic save’’) to cause KEDIT to auto mati cally save your file to disk after a speci fie d num ber of changes have been made to it.

After a power fail ure, a sys tem crash, or inadver tent changes to your file during a KEDIT session, you may be able to use the autosaved version of your file to recover some of your work.

If AUTOSAVE is set to some num ber n, which must be greater than one, then whenever that many alterati ons have been made to your file (see SET ALT for a discus sion of KEDIT’s alter ation count), KEDIT will auto mati cally save your file to disk. While KEDIT is autosaving your file, you will see the message ‘‘***Autosave***’’. If no errors occur while sav ing the file, the first alter ation count will be reset to zero. If errors occur (such as drive not ready or disk full errors), you will get an error message and the PC’s speaker will beep.

When KEDIT writes a copy of your file to disk during an AUTOSAVE, it uses the same drive, directory , and name as the file you are edit ing, but it uses a file extension of .AUS (for ‘‘AUtoSave’’), as if you had issued the com mand ‘‘SAVE =.AUS’’. This causes the file to be autosaved under its own name, but with an extension of .AUS. The

‘‘real’’ version of your file on disk is not overwrit ten. KEDIT will not create a .BAK s

file during an autosave, regardles s of the set ting of BACKUP. Any exist ing .AUS file is n o i

sim ply overwrit ten when the autosave occurs. t p O When ever you succes sfull y write your file to disk by using the SAVE or FILE com - T

mands, or by using the File Save menu item, KEDIT erases the .AUS file to avoid clut - E ter ing up your disk. If you QQUIT your file, or your KEDIT session ends abnorm ally, S the .AUS file will remain on your disk for possi ble recovery of lost work. You can peri- odi cal ly clean up your disk by eras ing these .AUS files.

SET AUTOSAVE 161 If you use the File Close or File Exit menu items to close a file that has been mod ified , the .AUS file is erased if you tell KEDIT to save the mod ified file; it is not erased if you tell KEDIT not to save the mod ified file.

The DIR.DIR and MACROS.KM L files cre ated by the DIR and MACROS com mands are treated as special cases. Regard less of the setting of AUTOSAVE, they are never autosaved.

See also SET ALT, SET BACKUP

Examples AUTOSAVE 30 The cur rent file will be autosaved after every thirty alter ations to a file with an exten - sion of .AUS.

SET AUTOSCROLL

Format [Set] AUTOSCroll n|Half|OFF

KEDIT default: HALF

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description The AUTOSCROLL set ting con trols how far KEDIT will scroll when auto matic hor i - zontal scrolling is invoked.

Suppose, for exam ple, that your window is 80 colum ns wide and VER IFY 1 80 is in effect (so that col umns 1 through 80 of the file are display ed in the window) and that the cursor is in col umn 80. If you try to move the cursor 1 col umn to the right, KEDIT invokes autom atic hori zon tal scrolling to bring colum n 81 of the file into the window . With AUTOSCROLL HALF (the default) in effect, KEDIT scrolls by half the width of the doc um ent window , which is in this case 40 colum ns. So colum ns 41 through 120 of the file are display ed in the window , with the cursor in column 81 of the file.

Note that with PRE FIX ON, as dis cussed in User’s Guide Chapter 7, “The Prefix Area”, the cursor keys that norm ally invoke autom atic hori zon tal scrolling instead move the cursor in and out of the prefix area.

If AUTOSCROLL n is in effect, KEDIT autoscrolls n col umns at a time:

162 Chapter 4. The SET Command AUTOSCROLL 5 would cause KEDIT to autoscroll five col umns at a time. In the above exam ple, moving the cursor right from colum n 80 would cause colum ns 6 through 85 of your file to dis- play, with the cursor at colum n 81 of the file.

With AUTOSCROLL OFF, KEDIT does not do autom atic scroll ing. If you attempt to move the cursor beyond the left or right edge of the docu m ent window , KEDIT places the cursor at the left or right edge of the docu m ent window and cannot move to the intended colum n of your file.

KEDIT autoscrolls by adding or subtra cting the appropri ate num ber of col umns from the current VERSHIFT value, as if you had used the LEFT or RIGHT com mand to adjust the VERSHIFT value by that many colum ns.

See also LEFT, RIGHT, RGTLEFT, SET VER IFY

SET BACKUP

Format [Set] BACKup OFF|TEMP|KEEP

KEDIT default: OFF

Level: File

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET BACKUP control s whether KEDIT create s a backup copy of your file when it is writ ten to disk. It affects the FILE and SAVE com mands and the File Save menu item. It also has an effect when you use the File Close menu item with a modi fie d file that you then tell KEDIT to save.

The default is BACKUP OFF, but unless you have very lim ited disk space you will proba bly want to run with BACKUP KEEP in effect, to create an autom atic backup copy of files that you edit. You can period i cal ly clean up your disk by eras ing these .BAK files.

With BACKUP OFF, when a file that you are writing to disk will replace an exist ing s

file, KEDIT first erases the old version of the file and then writes out the new version. If n o i

somethi ng goes wrong while the file is being writ ten (such as a disk error or power t failure), you may end up with neither the old nor the new version of your file on the p O disk. T E

With BACKUP TEMP or BACKUP KEEP, when a file will replace an exist ing file, S KEDIT first renames the existing file to have the same name but an extension of .BAK (for ‘‘BAcKup’’). (If this .BAK file already exists, KEDIT erases it.) KEDIT then

SET BACKUP 163 writes the new version of the file out to disk. If there is a problem while the new version is being writ ten, you will at least still have the old ver sion of the file on your disk (with the .BAK exten sion). If BACKUP TEMP is in effect, the .BAK file is erased after the new version of the file has been succes sfull y written to disk. With BACKUP KEEP, the .BAK file is not erased, but is left on disk.

Note that if BACKUP is set to TEMP or KEEP, there must be enough room on your disk to hold both ver sions of your file: the new version that you are writing out and the old ver sion, which is being kept as a .BAK file. If BACKUP TEMP is in effect, this .BAK file may need to be there for only a few seconds, while your new version is being written to disk. Never the les s, there must still be enough room on your disk to hold both versions of your file or you will get disk full error message s.

See also SET AUTOSAVE

SET BEEP

Format [Set] BEEP ON|OFF

KEDIT default: OFF

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET BEEP con trols whether the speaker beeps when error messages are displayed, when SOS ERRORBEEP is issued, and when ALERT com mands are exe cuted.

See also SET MOUSEBEEP, SOS BEEP, SOS ERRORBEEP, SOS MOUSEBEEP

SET BOUNDMARK

Format [Set] BOUNDMark Zone|TRunc|MARgins|TABs|Verify|WINMARgin [Set] BOUNDMark OFF

KEDIT default: ZONE TRUNC

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

164 Chapter 4. The SET Command Description SET BOUNDMARK (‘‘bound ary mark’’) controls KEDIT’s drawing of verti cal lines in your docu m ent window that indicat e important colum n loca tions in your file.

With the default of BOUNDMARK ZONE TRUNC, KEDIT draws boundary marks at the beginning and end of the current zone colum ns, and after the trunca ti on colum n. For exam ple, if ZONE 20 30 and TRUNC 80 are in effect, KEDIT will draw a line between col umns 19 and 20 of your file, between colum ns 30 and 31 of your file, and between col umns 80 and 81 of your file.

With SET BOUNDMARK, you can specify one or more of the fol lowing operands: ZONE Markers are drawn be fore the left zone col umn and after the right zone colum n. TRUNC A marker is drawn after the trunca ti on colum n. MAR GINS A marker is drawn be fore the left mar gin col umn and after the right mar gin column. TABS A marker is drawn be fore each tab col umn. VER IFY A marker is drawn af ter each set of ver ify col umns. For ex am ple, if VERIFY 1 20 30 40 is in ef fect, KEDIT will display colum ns 1 through 20 of your file followed by colum ns 30 through 40, and boundary marks will appear be tween colum ns 20 and 30 and after column 40. WINMARGIN When WINMARGIN ON is in ef fect, a mar gin area (used for marking line blocks with the mouse) is dis played at the left of the docu m ent window . BOUNDMARK WINMARGIN tells KEDIT to draw a marker line at the right edge of this mar gin area, just be fore the first colum n of text.

Alter na tively, you can spec ify BOUNDMARK OFF, which turns off any exist ing boundary markers. Note that a sepa rat e set of verti cal lines, control led by the SET COLMARK command, may still be displayed.

Notes · You would norm ally only use one or two of the BOUNDMARK operands at a time, since a large num ber of ver tical lines could clutter your screen and be s

confusing. n o i · The lines drawn by SET BOUNDMARK are auto m ati cal ly adjuste d if one of the t p

set tings involved changes. For exam ple, if BOUNDMARK ZONE is in ef fect and O

you issue a SET ZONE com mand, the posi ti on of the zone markers will be T

updated. E S · You can use a re lated comm and, SET COLMARK, to draw marker lines at spe cific colum ns of your file, inde pend ent of the setti ngs of ZONE, TRUNC, etc.

SET BOUNDMARK 165 · The color of the boundary markers is deter mined by the foreground color that you specify for the SET COLOR BOUNDMARK; the background color for SET COLOR BOUNDMARK is ig nored. · To avoid drawing an extra line where there is already a clearly under stood bound- ary, boundary markers are not drawn for the left zone or left mar gin col umns when these are set to col umn 1 of your file.

See also SET COLMARK, SET MAR GINS, SET TABS, SET TRUNC, SET WINMARGIN, SET VER IFY, SET ZONE

Examples BOUNDMARK WINMARGIN MARGINS Draw boundary markers between the window mar gin area and the first colum n of the docu m ent window , before the left mar gin col umn, and after the right mar gin column.

BOUNDMARK OFF Turn off any boundary markers being display ed for the current view of your file. SET CASE

Format [Set] CASE Mixed|Upper [Respect|Ignore] [Respect|Ignore]

KEDIT default: MIXED IGNORE RESPECT

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description The CASE option control s how KEDIT handles uppercas e and lower cas e text.

If CASE UPPER is in effect, all low er case let ters input directly into the doc u ment win - dow are treated as if their upper case equiv alent had been entered. Note that only text entered directly into the doc um ent window is uppercased; CASE UPPER has no effect on text entered into dialog boxes.

For exam ple, suppose that CASE UPPER is in effect and you try to type on the com - mand line

INPUT abcABC123 The char acters will actu ally appear on the comm and line in upper case, and the com- mand will cause ‘‘ABCABC123’’, not ‘‘abcABC123’’, to be input to your file. If CASE MIXED, the default, is in effect, low er case letters are treated as low er case let- ters, and not as their uppercas e equiva lent s.

The first RESPECT or IGNORE setting affects how KEDIT searches for string tar gets and string column targets. If RESPECT is in effect, strings must match exactly. With

166 Chapter 4. The SET Command IGNORE, the default, strings con tain ing exactly the same letters, regard less of whether they are both upper case, both low er case, or of dif fer ent cases, will match. For example, with IGNORE,

/the/ would locate ‘‘the’’, ‘‘The’’, ‘‘THE’’, and several other vari ati ons of ‘‘the’’. With RESPECT, only the exactly matching ‘‘the’’ would be located.

IGNORE is useful since it allows you to search for words without worry ing about whether they are or are not cap ital ized. A word may, for example, be cap ital ized in some of its occur rences where it appears as the first word of a sen tence, but not in occur rences in the mid dle of sentences.

The first RESPECT or IGNORE set ting also affects com pari sons between uppercas e and low ercas e versions of the same letter during exe cuti on of the SORT command.

The second RESPECT or IGNORE control s com pari sons made by the CHANGE, SCHANGE, and COUNT commands. With RESPECT, the default, the string spec ified on the left side of a CHANGE or SCHANGE, and the single string spec ifie d with the COUNT com mand, must match exactly for a change to occur; with IGNORE, the strings can dif fer in case.

If you ignore case when searching for strings in a change opera ti on, KEDIT tries to determ ine the case of the result string placed back into your file in an intelli gent man- ner. For exam ple, with the second RESPECT|IGNORE operand set to IGNORE, the fol low ing command:

CHANGE /the/a/ 1 * will change the line

The boy saw the girl. into what you proba bly intended:

A boy saw a girl. while blindly substi tut ing lower cas e ‘‘a’’ for each occurrence of ‘‘the’’ found by a case-insensi ti ve search would have given

a boy saw a girl. KEDIT’s internal rules for handli ng cases will very often, but not always, give the s

‘‘right’’ result. However , if you want com plete control of exactly which strings are n o i

matched and what they are changed into, you will need to set the second CASE t RESPECT|IGNORE operand to RESPECT and specify the case of the strings involved p O exactly. T E

With INTERNA TIONAL NOCASE, the default, in effect, KEDIT treats only the 26 S letters from ‘‘A’’ to ‘‘Z’’ and ‘‘a’’ to ‘‘z’’ as alpha betic and does not treat accented char - acters as alphabeti c. With INTERNA TIONAL CASE in effect, KEDIT uses the

SET CASE 167 Windows language drivers installed on your sys tem to determ ine which charac ter s are consid ered alphabeti c and how to uppercas e, lower cas e, and compare them.

See also SET INTER NA TIONAL

Examples CASE M R This sets CASE to MIXED RESPECT, leav ing the value of the sec ond RESPECT|IGNORE setti ng unchanged.

CASE U This sets CASE UPPER and leaves the RESPECT|IGNORE set tings unchanged.

SET CLOCK

Format [Set] CLOCK ON|OFF

KEDIT default: ON

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description With CLOCK ON, the default, KEDIT dis plays a time-of-day clock on the sta tus line. With CLOCK OFF, the clock is not dis played.

See also SET STATUSLINE

SET CMDLINE

Format [Set] CMDline ON|OFF|Top|Bot tom

KEDIT default: BOTT OM

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET CMDLINE control s the display of KEDIT’s com mand line.

168 Chapter 4. The SET Command [Set] CMDline Bottom [Set] CMDline ON The com mand line is display ed at the bot tom of the edit ing window . [Set] CMDline Top The com mand line is display ed at the top of the edit ing window . [Set] CMDline OFF Turns off the display of KEDIT’s com mand line. It is norm ally im portant to have the comm and line available, since many as pects of KEDIT are con trolled from the com mand line. CMDLINE OFF is provided mainly for use in specia lize d macros where this is not an issue. CMDLINE OFF is not recom mended for general use.

SET COLMARK

Format [Set] COLMark n1 [n2 n3 ...] [Set] COLMARK OFF

KEDIT default: OFF

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET COLMARK (‘‘colum n mark’’) controls KEDIT’s drawing of verti cal lines that indi cate col umn loca tions in your file.

With COLMARK OFF, the default, no colum n markers are drawn. Note that a sepa rat e set of ver tical lines, con trolled by the SET BOUNDMARK command, may still be dis played.

But if you give a list of one or more columns, KEDIT will draw a ver tical line to the left of where each speci fie d colum n of your file appears in the docu m ent window . The color of the verti cal lines is determ ined by the foreground color of the SET COLOR COLMARK setti ng; any background color spec ifie d for COLOR COLMARK is s

ignored. You can specify a maxi m um of 20 columns. n o i t SET COLMARK draws lines at fixed col umn positi ons in your file. A related com - p O

mand, SET BOUNDMARK, lets you draw lines whose locati ons vary depending on T

the boundari es of your zone colum ns, your mar gin col umns, etc. E S

See also SET BOUNDMARK

SET COLMARK 169 Examples COLMARK 81 This tells KEDIT to draw a verti cal line preced ing col umn 81 of each line of your file. This can be very useful, since on many display s you can have windows much wider than 80 colum ns and you can mistak enly enter more text on a line than you intend to.

COLMARK 10 20 30 40 This gives you verti cal lines pre ceding col umns 10, 20, 30, and 40 of your file.

SET COLOR

Format [Set] COLOR field fore ground [ON background ] [Set] COLOR field DE FAULT

KEDIT de fault: See the ta ble be low Level: File Dia log box: Opti ons SET Com mand Save Set tings handli ng: Savable

Description SET COLOR allows you to control the colors and highli ghting that KEDIT uses on your display . You can individ u all y control the color used by KEDIT for each of the dif - ferent types of inform ati on display ed by KEDIT by speci fy ing the type of field involved and the color to use for it.

Color Defaults Here is a list of the fields whose col ors you can control , along with the color KEDIT uses by default for each field, and a descripti on of each field:

Field Default Description Arrow blue on white command line arrow Block white on black text within marked block ZONE markers, etc. controlled by SET BOUNDMark gray on white BOUNDMARK Cmdline black on white command line column markers controlled by SET COLMark gray on white COLMARK CURRBox gray on white box drawn around current line Filearea black on white file area HIghlight black on yellow lines highlighted by SET HIGHLIGHT Idline blue on white ID line Msgline red on white message lines Pending dark red on white pending prefix commands

170 Chapter 4. The SET Command Field Default Description PRefix dark blue on white prefix area Scale dark blue on white scale line SHadow dark blue on white shadow lines Tabline dark blue on white tab line THIghlight black on green highlighted target TOfeof dark blue on white top-of-file and end-of-file lines pop-up toolbar help (no longer has any TOOLtip black on yellow effect - system tooltip color is used instead)

Available You can choose from the follow ing sixtee n colors, although not all will display prop- colors erly on all adapt ers. For exam ple, on a gray scale display , the colors would map into shades of gray.

BLAck White BLUe DARK BLUe Cyan DARK Cyan GRAy DARK GRay Green DARK Green Magenta DARK Magenta Red DARK Red Yel low DARK Yellow

Specifying The color to use for a field can be speci fie d in two ways: colors [Set] COLOR field foreground [ON back ground] Specify the name of the field involved, followed by the foreground color for the s

field and, opti onall y, the background color for the field. If you do not specify a n o i

background color, a background of white is used. You can use an aster isk (‘‘*’’) for t

the field name to in di cate that you want to set all fields to the same color. p O

T E S

SET COLOR 171 [Set] COLOR field DEFAULT If you have made changes to the color of a field, you can tell KEDIT for Windows to switch back to us ing its de fault color for the field. A table of KEDIT for Win- dows’ defaul t col ors is given above.

Notes · SET COLOR is only used to control colors used within a doc um ent window . It is not used for scrollbars, dia log boxes, window ti tle bars and borders, etc. These col - ors are control led via the Windows Control Panel.

· For BOUNDMARK, COLMARK, and CURRBOX, KEDIT draws lines on the screen using the foreground color involved, and the background color spec ifie d for these items has no ef fect.

· When COLOR ING ON is in ef fect and you are us ing KEDIT’s syntax color ing fa - cil ity to show keywords, com ments, etc. in your text in dif ferent colors, SET ECOLOR deter mines the colors involved.

· If MONI T OR COLOR and MON IT OR MONO, settings supplie d for com pati bil - ity with text mode KEDIT, are in effect, SET COLOR works as it does in text mode KEDIT, and not as de scribed here.

See also SET ECOLOR, SET MONI T OR, SET PCOLOR

Examples SET COLOR FILEAREA BLUE ON YELLOW The file area of the docu ment win dow will be dis played as blue char acters on a yellow back ground.

COLOR * DE FAULT All fields are reset to their default col ors.

SET COLORING

Format [Set] COL OR ING ON|OFF AUTO|parser

KEDIT default: ON AUTO

Level: File

Dialog box: Options SET Com mand

Save Set tings handli ng: Not savable

Description Use SET COLOR ING to enable or disable KEDIT’s syntax color ing facil ity and to determ ine which parser KEDIT will use to handle the syntax color ing.

172 Chapter 4. The SET Command When syntax color ing is active, KEDIT uses dif ferent colors to highli ght dif ferent types of text. Syntax color ing is control led by a language-s pecif ic parser. The parser scans the text in your file, decides which char acters are parts of keywords, comm ents, strings, etc., and display s the text in the appropri ate color; the spe cific colors used are determ ined by the SET ECOLOR command.

Syntax color ing parsers for several languages are built into KEDIT, and you can use KEDIT Language Defi ni ti on files in connec ti on with the SET PARSER com mand to load your own parser defi ni ti ons.

The first operand to SET COLOR ING turns syntax color ing ON or OFF for the current file. When COL OR ING OFF is in effect, your file is dis played with out syn tax color ing. When COLOR ING ON is in effect, your file is dis played using the colors determ ined by the parser that you specify.

The second operand to SET COLOR ING determ ines the parser to use for the current file: AUTO With the AUTO oper and, KEDIT uses a parser that is deter mined by the exten sion of the file you are edit ing. The parser that is used for a given exten sion is control led via the SET AUTOCOLOR com mand. By defaul t, the fol lowing exten sions are handled:

Extension Parser .BAS BASIC .FRM BASIC .C C .COB COBOL .COBOL COBOL .CBL COBOL .CPP C .CS CSHARP .CXX C .DLG RESOURCE .FOR FORTRAN .FORTRAN FORTRAN s n

.F90 FORTRAN o i t

.F FORTRAN p O

.H C T E

.HPP C S .HXX C

SET COLORING 173 Extension Parser .HTM HTML .HTML HTML .INI INI .JAV JAVA . JAVA JAVA .KEX REXX .KML REXX .REX REXX .KLD KLD .PAS PASCAL .DPK PASCAL .DPR PASCAL .PRG XBASE .RC RESOURCE If no parser is de fined for a par ticu lar exten sion, KEDIT uses the NULL parser, which is a specia l dummy parser that doesn’ t ac tuall y apply any syntax coloring. parser The parser oper and gives the name of the language-s pecif ic parser to use. You can choose one of the pars ers that is built into KEDIT or you can use a parser of your own that you have loaded via the SET PARSER com mand. Here are the parsers that are built into KEDIT:

Parser Used With C C and C++ programs CSHARP C# programs REXX KEXX and REXX programs HTML HTML documents JAVA Java programs COBOL COBOL programs FORTRAN FORTRAN programs PASCAL Pascal and Delphi programs the KEDIT Language Definition files described in KLD Chapter 8, “KEDIT Language Definition Files” INI INI files BASIC BASIC programs

174 Chapter 4. The SET Command Parser Used With XBASE xBase programs the RC and DLG files used in Windows program RESOURCE development dummy parser that doesn’t actually apply syntax NULL coloring

Notes · It is im portant to under sta nd that the parsers that handle syntax color ing are not as com plete as the parsers built into a typi cal com piler. Syntax color ing oper ate s very quickly, proces sing text in a fairly sim ple-minded way, without building sym bol tables , proces sing header files, or checking for errors in your text. The goal is to be as ef fi cient as pos si ble, han dling all nor mal sit u a tions cor rectly, but ac cept ing that in some un usual cases, es pe cially in files that con tain syn tax errors, text may be colored incorrectly.

· Most KEDIT users will be able to leave the default of COLOR ING ON AUTO un- changed. Files with the exten sions used in several com mon languages will auto - mati cally get syn tax color ing, and other files will not.

See also SET AUTOCOLOR, SET ECOLOR, SET PCOLOR, SET PARSER, Chapter 8, “KEDIT Language Definition Files”

SET CURLINE

Format [Set] CURLine line

KEDIT default: M (Middle of the doc um ent window)

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description Use SET CURLINE to con trol the line of the docu m ent window in which KEDIT dis- s n

plays the cur rent line. o i t You can specify the line in three ways: rel ati ve to the top of the doc um ent window , rel a- p O

tive to the middle of the doc um ent window , and rela ti ve to the bottom of the docu m ent T

window. E S [Set] CURLine n|+n This tells KEDIT to use line n of the docu m ent window .

SET CURLINE 175 [Set] CURLine M This tells KEDIT to use the middle line of the doc um ent window . In a doc um ent window that is 24 lines high, KEDIT would use line 12. (In a docu m ent window that is 25 lines high, KEDIT would round up and use line 13.) [Set] CURLine M+n|M-n This tells KEDIT to use the line n lines above or below the middle line of the doc u - ment window . [Set] CURLine -n This tells KEDIT to use the line n lines from the bot tom of the docu m ent window , where the last line of the doc um ent window is line -1.

See also SET CURRBOX

Examples CURLINE 2 Display the current line in the second line of the docu m ent window .

CURLINE -2

Display the current line in the second line from the bot tom of the docu m ent window .

CURLINE M+2

Display the current line in the line two lines below the middle of the window .

SET CURRBOX

Format [Set] CURRBox ON|OFF [ON|OFF]

KEDIT default: ON OFF

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET CURRBOX determ ines whether KEDIT draws a box around the current line to make that line stand out.

The first operand determ ines whether the box is drawn when the cursor is on the com - mand line. This is ON by default, since most com mands issued from the com mand line act rel a tive to the cur rent line, and it is use ful to be sure which line this is.

176 Chapter 4. The SET Command The second operand determ ines whether the box is drawn when the cursor is in the file area. This is OFF by default, because the cur rent line is usu ally of less inter est when you are not working from the com mand line.

The box’s color is deter mined by the foreground color of the SET COLOR CURRBOX set ting; any background color spec ifie d for COLOR CURRBOX is ignored.

SET CURSORSIZE

Format [Set] CURSORSIze vovr vins hovr hins

KEDIT default: 10 25 15 30

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET CURSORSIZE con trols the size of KEDIT’s text cur sor.

If CURSORTYPE VER TICAL is in effect, or if CURSORTYPE INTERF ACE and INTER FACE CUA are in effect, KEDIT uses a ver tical cur sor. The first and sec ond operands for SET CURSORSIZE control the width of this verti cal cursor: the first operand control s the width of the cursor in Overtype Mode, and the second operand control s the width in Insert Mode.

If CURSORTYPE HOR IZON T AL is in effect, or if CURSORTYPE INTERF ACE and INTERF ACE CLASSIC are in effect, KEDIT uses a hori zon tal cursor . The third and fourth operands for SET CURSORSIZE control the height of this hori zon tal cursor: the third operand control s the height of the cursor in Overtype Mode, and the fourth oper- and control s the height in Insert Mode.

The val ues used with SET CURSORSIZE are expressed as a per cent age of the width of a charac ter , and can range from 1 to 100. For exam ple, with the default setti ngs in effect, a ver tical cur sor in Overtype Mode is 10% of the width of a char acter in the cur - rent font.

Examples SET CURSORSIZE 20 40 20 40

This exam ple makes the cursor sizes somewhat thicker than the default setti ngs. For s n o

exam ple, the verti cal cursor is 20% of the charac ter width in Overtype Mode instead of i t

the default of 10%. p O

SET CURSORSIZE 25 10 30 15 T E

This exam ple makes the Insert Mode cursor thinner than the Overtype Mode cursor , S revers ing KEDIT’s norm al conven ti on of using a thicker cursor to indicat e Insert Mode.

SET CURSORSIZE 177 SET CURSORTYPE

Format [Set] CURSORType Verti cal|Hor i zon tal|In ter face

KEDIT default: INTER FACE Level: Global Dialog box: Options SET Com mand Save Set tings handli ng: Savable

Description SET CURSORTYPE determ ines the shape of KEDIT’s text cursor .

With CURSORTYPE VER TI CAL, KEDIT uses a ver tical cur sor, dis played at the left of the cur rent char acter .

With CURSORTYPE HOR IZON T AL, KEDIT uses a hor izon tal cursor , display ed beneath the cur rent char acter .

With the default of CURSORTYPE INTERF ACE, the shape of KEDIT’s cursor is dependent on the setti ng of the INTER FACE option. With INTER FACE CUA, KEDIT will use a ver tical cur sor; with INTER FACE CLAS SIC, KEDIT will use a hor izon tal cursor.

Most Windows program s use a verti cal text cursor , as KEDIT for Windows does by default when INTER FACE CUA is in effect. This fits well with the way KEDIT marks blocks when INTER FACE CUA is in effect. With INTER FACE CUA, blocks marked with the mouse and with CUA-com pati ble keys extend up to, but do not include, the current charac ter . Visuall y, this means that they extend up to, but not beyond, the verti - cal cur sor displayed at the left of the current character.

Text mode KEDIT and other text mode applica ti ons use a hori zon tal text cursor , as KEDIT for Windows does when INTERF ACE CLASSIC is in effect. This also fits well with the way KEDIT marks blocks when INTER FACE CLASSIC is in effect. With INTER FACE CLAS SIC, stream and box blocks always include the char acter at the cursor posi tion. Visuall y, the block extends to the edge of the hori zon tal cursor dis - played under the current character.

SET DEBUGGING

Format [Set] DEBUG Ging ON|OFF height trac ing

KEDIT default: OFF 15 +R

Level: Global

Dialog box: Options SET Com mand

178 Chapter 4. The SET Command Save Set tings handli ng: Not savable

Description SET DEBUGGING controls whether the debug ging win dow (a sep a rate win dow used by the macro debugger) is on or off, the height of the debug ging win dow, and the default trac ing level for mac ros exe cuted via the DEBUG command.

When the debug ging win dow is on, trace out put is writ ten to the debug ging win dow and inter ac - tive trace input is read from a line at the bot tom of the debug ging win dow. When the debug ging win dow is off, the KEXX debugger is inac tive and all KEXX TRACE instruc tions are ignored.

The height of the debug ging win dow is ini tially set to 15 lines. The debug ging win dow must be at least 6 lines high and can be no more than 25 lines high. Trac ing controls the initial level of trac ing in effect for mac ros run via the DEBUG com mand. The default value of +R spec i fies that interac tive trace will be active and that all clauses and expres sion results will be traced.

See also User’s Guide Chapter 10, “Using Macros”, PROFDEBUG ini tial iza tion option, DEBUG, KEXX TRACE instruction

Examples DE BUG GING ON 10 +I Turns on the debugging window , and sets it to occupy ten lines. Also sets the default level of tracing for macros run via the DEBUG com mand to +I, which means interac - tive trac ing of all clauses and inter medi ate and final expres sion results.

SET DEFEXT

Format [Set] DEFEXT ON|OFF

KEDIT default: OFF

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description With DEFEXT (‘‘default exten sion’’) ON, the KEDIT, GET, FILE, PUT, and SAVE com mands use the extension of the current fileid if you do not explicit ly spec ify one. s n o

For exam ple, assume you are edit ing the file SAMPLE1.PAS and you want to save it i t

under the name SAMPLE2.PAS. With DEFEXT OFF, you must say either p O

SAVE SAMPLE2.PAS T E

or S

SAVE SAMPLE2.=

SET DEFEXT 179 With DEFEXT ON, you can sim ply say

SAVE SAMPLE2 and the file extension of .PAS will be assumed.

With DEFEXT ON, if you want to specify a fileid that has no extension, you must give a period after the name of the file. So, with DEFEXT ON,

SAVE SAMPLE2 saves the file as SAMPLE2.PAS, and

SAVE SAMPLE2. saves the file as SAMPLE2, with no extension.

Note that SET DEFEXT does not affect how file names are handled when you use the File Open or File Save As dialog boxes, where you must explicit ly supply any desired exten sion.

See also NODEFEXT ini tial iza tion option

SET DEFPROFILE

Format [Set] DEFPROFile fileid

KEDIT default: WINPROF.KEX

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET DEFPROFILE (‘‘defaul t profil e’’) lets you change the name of the profil e that KEDIT runs by default to somethi ng other than WINPROF.KEX.

When KEDIT needs to run your profil e, because the first file is being added to the ring at the start of a KEDIT ses sion or because REPROFILE ON is in effect and new files are being added to the ring later in a KEDIT session, it norm ally runs the profil e speci - fied via the DEFPROFILE option. which defaults to WINPROF.KEX.

You can override this behavior by using the NOPROFILE option on the KEDIT com - mand line, in which case no profil e is execute d, or by using the PROFILE option to spec ify a dif fer ent pro file to be exe cuted.

When you change the value of DEFPROFILE, the change stays in effect for the rest of the KEDIT session and, if you use Options Save Setti ngs, will affect future KEDIT

180 Chapter 4. The SET Command sessions . In contra st, the PROFILE and NOPROFILE options only affect the profil e execute d while proces sing the current KEDIT com mand line, and do not affect the pro - file exe cuted for addi tional files that you later begin editing.

You can also specify DEFPROFILE as a KEDIT ini tializa tion option on the com mand line used to invoke KEDIT. If you do this, the value that you spec ify will replace the current value of the DEFPROFILE option and, at the start of a KEDIT session, will override any DEFPROFILE option saved in the Windows regis try previ ous sessions.

See also DEFPROFILE ini tial iza tion option, PRO FILE ini tial iza tion option, NOPROFILE ini - tial iza tion option, SET REPROFILE

Examples SET DEFPROFILE C:\MYMACROS\MYPROF.KEX KEDIT will use C:\MYMACROS\MYPROF.KEX as your default pro file, instead of WINPROF.KEX.

SET DEFSORT

Format [Set] DEFSORT Date|Ex ten sion|Name|Path|Size ... [Set] DEFSORT OFF

KEDIT default: NAME EXTENSION PATH

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET DEFSORT (‘‘default sort’’) controls the order in which the DIR and DIRAPPEND commands nor mally sort the list of files they cre ate. [Set] DEFSORT Date Causes DIR and DIRAPPEND to sort the list of files ac cord ing to the date and time of each file, with the new est files listed first. [Set] DEFSORT Exten sion s

Tells DIR and DIRAPPEND to sort the list of files in al pha bet ical or der ac cord ing n o

to the file ex ten sion. i t p

[Set] DEFSORT Name O

Sorts the list of files in al pha bet ical or der ac cord ing to the file name. T E

[Set] DEFSORT Path S Sorts the list of files in alpha bet i cal order ac cording to the drive letter and subdi - rec tory of each file.

SET DEFSORT 181 [Set] DEFSORT Size Sorts the list of files ac cord ing to the size of each file, with the larg est files listed first.

These operands can be com bined. For exam ple, the default setti ng of DEFSORT, which is NAME EXTEN SION PATH, tells DIR and DIRAPPEND to sort directory list ings by name and, if several files have the same name, to sort these by extension and then path.

With DEFSORT OFF, DIR and DIRAPPEND do not sort direc tory list ings; files are listed in the order they appear in your disk’s directory .

After using DIR or DIRAPPEND to cre ate a DIR.DIR file sorted according to your DEFSORT set ting, you can use the DIRSORT com mand to re-sort the DIR.DIR file into a dif ferent order.

See also DIR, DIRAPPEND, DIRSORT, SET DIRFORMAT

SET DIRFORMAT

Format [Set] DIRFORMat fname fext year

KEDIT default: 30 10 2

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET DIRFORMAT control s the output form at used by KEDIT’s DIR com mand.

The first two operands control the amount of space set aside in DIR.DIR files for file names and for file extensions . To accom modate long filenam es, you can use the SET DIRFORMAT com mand to have KEDIT set aside more col umns for file names and for file exten sions (that is, every thing after the last period in a fileid). By default, KEDIT sets aside 30 col umns in DIR.DIR files for filenam es and 10 colum ns for file exten sions.

As a spe cial case, you can spec ify 0 as the value for file exten sions. This causes KEDIT to display the name and extension together as a unit in the col umns norm ally set aside for the file name.

The third operand of SET DIRFORMAT control s the num ber of digit s used to display the year in DIR.DIR files. It can be set to either 2 (the default, which yields two-digit years, such as 96 or 08, in DIR.DIR listings) or 4 (which yields four-digit years, such as 1996 or 2008).

182 Chapter 4. The SET Command SET DIRFORMAT does not have any effect on a DIR.DIR file that you have already create d; it only affects subse quent DIR com mands. So you should use SET DIRFORMAT before issuing a DIR com mand whose output you want to affect.

See also DIR, DIRAPPEND

SET DISPLAY

Format [Set] DIS Play n1 [n2|*]

KEDIT default: 0 0

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Not savable

Description SET DIS PLAY causes KEDIT to select for dis play lines whose selec tion level falls into the range n1 through n2. Lines whose selec tion level falls outside this range are excluded from the display .

Each line of your file has a number , called its selec tion level, asso ciated with it. Selec - tion levels can range from 0 to 255. You can set the selec tion level of a line by using the SET SELECT com mand. The ALL com mand, the X and S prefix com mands, and the Edit Selec tive Editing dia log box also affect selec tion lev els of lines in your file.

Initially , all lines in your file have a selec tion level of 0, and DIS PLAY is set to 0 0, so all lines in your file are selected.

SET DIS PLAY n1 * is equiv a lent to

SET DIS PLAY n1 255 and

SET DIS PLAY n1 is equiv a lent to s n

SET DIS PLAY n1 n1 o i t With SHADOW ON, the default, excluded lines are repre sent ed in your docu m ent win- p O dow by a shadow line, which indi cates the num ber of excluded lines. With SHADOW T

OFF, excluded lines are not repre sent ed in your docu m ent window at all. E S With SCOPE DISPLA Y, the default, most KEDIT com mands will operate only on lines that are selected, and will act as if excluded lines are not pres ent in your file. With

SET DISPLAY 183 SCOPE ALL, KEDIT comm ands oper ate on excluded lines as well as selected lines, even though excluded lines are not shown on your screen. A specia l case is the current line, which is always dis played with SCOPE ALL, regard less of its selec tion level.

See also User’s Guide Chapter 8, “Selective Line Editing and Highlighting”, ALL, SET SCOPE, SET SELECT, SET SHADOW

Examples SET DIS PLAY 5 10 All lines in your file with a selecti on level of 5 through 10 are shown, while all lines in your file whose selec tion level is less than 5 or greater than 10 are excluded.

SET DIS PLAY 1 * All lines in your file whose selec tion level is greater than zero are selected.

SET DIS PLAY 1 This is equiva lent to SET DISPLA Y 1 1—only lines with a selecti on level of 1 are selected.

SET DOCSIZING

Format [Set] DOCSIZing Stan dard|EX TENded [n]

KEDIT default: EXTENDED 80

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET DOCSIZING control s the method used to deter mine the size of new non-maxi - mized docu m ent windows, and of exist ing docu m ent windows that are rearranged via the Window Cas cade menu item.

When DOCSIZING STANDARD is in effect, KEDIT lets window handling code built into Windows determ ine the size. Each window is given a standard default size that is some fixed percent age of the size of the frame window . With DOCSIZING STAN- DARD, SET DOCSIZING’s sec ond operand has no effect.

When DOCSIZING EXTENDED is in effect, the window sizes are controll ed by KEDIT. The idea is that rather than mak ing all win dows the same size, KEDIT tries to make each window large enough to hold as much use ful inform ati on as possi ble. KEDIT makes each new docu m ent window extend to the bottom of the frame win dow, and tries to make each window wide enough to display n colum ns of text, where n defaults to 80 and is the second operand speci fie d for SET DOCSIZING.

184 Chapter 4. The SET Command DOCSIZING EXTENDED makes a dif ference only when the frame window is at least wide enough for the width of one of the docu ment windows that you will create or cas - cade, plus enough extra room to allow four cascade d docu ment windows, each slightly offset from the oth ers, to fit. In a typi cal case, you will have docu ment windows 80 char acters wide and the extra room to allow for cas cad ing will be about 10 char acters wide, so the frame win dow needs to be wide enough for approxi m ately 90 colum ns of text. If the frame window is narrower than this, KEDIT uses the standard docu m ent window sizing, as if DOCSIZING STANDARD had been in effect.

Note that for DOCSIZING EXTENDED to have an effect on the initi al doc um ent win- dow create d at the start of a KEDIT session, it must have been set during a previ ous KEDIT session and saved to the Windows regis try via Options Save Settings.

SET DRAG

Format [Set] DRAG Box|Line|Stream [PERSISTent|SELection] [Anchor|Word] [RESET] [Set] DRAG CMDline [SELection] [Anchor|Word] [RESET] [Set] DRAG DRAGDROP [Set] DRAG NONE

KEDIT default: NONE

Level: Global

Dialog box: None

Save Set tings handli ng: Not savable

Description SET DRAG, a spe cialized comm and used only in the macros that pro cess mouse clicks, control s what will happen when you drag the mouse after clicking a mouse but ton. [Set] DRAG Box|Line|Stream [Set] DRAG CMDline To mark a block when you drag the mouse, KEDIT’s inter nal mouse handli ng rou- tines re peat edly issue MARK com mands. This form of SET DRAG de ter mines the operands used for these MARK com mands. You can mark a BOX, LINE, or

STREAM block or, if INTER FACE CUA is in ef fect, you can mark a com mand s n

line selection. o i t

PER SIS Tent|SE Lec tion p O Deter mines whether dragging the mouse marks persis tent blocks or selec tions. For T

LINE, STREAM, and BOX blocks, PERSIS TENT is the defaul t and SELEC - E TION may only be speci fied when INTER F ACE CUA is in ef fect. For com mand S line se lec tions, which are avail able only when IN TER FACE CUA is in effect, SE - LEC TION is the defaul t and is the only legal choice.

SET DRAG 185 An chor|Word Deter mines whether the ANCHOR oper and or the WORD oper and (which is valid only for stream blocks and com mand line se lec tions) is used in the MARK com - mands issued while dragging to mark a block. All blocks marked by dragging the mouse are anchored blocks; ANCHOR is the defaul t for SET DRAG if nei ther AN CHOR nor WORD is spec ified ex plic itly. See the MARK command for dis - cussion of these operands. RE SET If RESET is speci fie d, the first MARK com mand is sued when the mouse is dragged will include the RESET oper and, unmarking any exist ing block. Other - wise, any exist ing block in the current file will be extende d from its anchor point as you drag with the mouse. [Set] DRAG DRAGDROP This form of SET DRAG speci fie s that dragging the mouse should invoke a drag-and-drop oper a ti on, ei ther moving or copying the current ly-marked block to the loca ti on at which the mouse but ton is relea sed. If the Ctrl key is down at the end of the drag oper a ti on, the block is copied; other wise it is moved. [Set] DRAG NONE Speci fie s that no block mark, move, or copy will occur when the mouse is dragged.

See also EXTEND, MARK

SET ECOLOR

Format [Set] ECOLOR a fore ground [ON background ] [Set] ECOLOR a DE FAULT

KEDIT default: See the table below

Level: File

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET ECOLOR (‘‘em phasis color’’) control s the colors used by KEDIT’s syntax color - ing facil ity.

When syntax color ing, enabled via the SET COLOR ING com mand, is active, KEDIT uses dif ferent colors to highli ght dif ferent types of text. KEDIT includes a sim ple parser for each language with syntax color ing support. The parser scans the text in your file, decides which char acters are parts of keywords, comm ents, strings, etc. and based on this decides which of 35 emphasis types, referred to by the letter s A through Z and the num bers 1 through 9, to use for those charac ter s. For exam ple, num bers used in most program ming languages are given emphasis type C, which is by default shown in dark red.

186 Chapter 4. The SET Command Here are the emphasis colors that KEDIT uses by default when MONI T OR WIN - DOWS is in effect:

Letter Color Language Element A dark green comments B dark cyan strings C dark red numbers D blue keywords E dark red labels F dark red preprocessor keywords G red header lines H black extra right paren, matchable keyword I blue level 1 paren J blue level 1 matchable keywords K dark red level 1 matchable preprocessor keywords L dark green level 2 paren, matchable keyword M red level 3 paren, matchable keyword N dark cyan level 4 paren, matchable keyword O dark magenta level 5 paren, matchable keyword P gray level 6 paren, matchable keyword Q dark blue level 7 paren, matchable keyword R magenta level 8 or higher paren, matchable keyword S magenta incomplete strings T blue HTML markup tags U red HTML character/entity references V—Z black not currently used 1 red alternate keyword color 1 2 dark blue alternate keyword color 2 3 dark red alternate keyword color 3 4 dark magenta alternate keyword color 4 s n

5 dark green alternate keyword color 5 o i t

6 dark cyan alternate keyword color 6 p O

7 red alternate keyword color 7 T E

8 black alternate keyword color 8 S 9 blue alternate keyword color 9

SET ECOLOR 187 [Set] ECOLOR a fore ground [ON back ground] Specify the em phasis type involved (in the range A—Z or 1—9), followed by the foreground color to use and, opti onall y, the background color. If you do not spec - ify a background color, a background of white is used. You can use an aster isk (‘‘*’’) in stead of a letter as the empha sis type to in di cate that you want all em pha sis types to use the same color. The foreground and background col ors that you can choose from are the same as the colors used with the SET COLOR command. [Set] ECOLOR a DEFAULT If you have made changes to an em phasis color, you can tell KEDIT for Windows to switch back to us ing the defaul t color. A table of KEDIT for Windows’ defaul t em phasis colors is given above.

Notes · Even when syntax color ing is ac tive, some of the text in your file may not be given an em phasis color. For exam ple, most parsers do not give an em phasis color to or- dinary vari ables. KEDIT uses the color control led by SET COLOR FILEAREA, which is norm ally black on white, for such text.

· For text that is part of a block or part of a highli ghted tar get, syntax color ing is overrid den. KEDIT inste ad uses the colors deter mined by SET COLOR BLOCK (nor mally white on black) or SET COLOR THIGHLIGHT (nor mally black on green).

· For text that is highli ghted be cause you have used the SET HIGHLIGHT com - mand or the TAG com mand, and for which syntax color ing also appli es, KEDIT attem pts to merge the two colors. KEDIT uses the background color from the SET COLOR HIGHLIGHT set ting (this is norm ally yellow), and the foreground color from the appro pri ate ECOLOR setti ng. You need to take this into account when you de cide on the colors you will use with SET COLOR HIGHLIGHT and SET ECOLOR, since not all com bina ti ons of foreground and background colors work well together.

See also SET AUTOCOLOR, SET COLOR, SET COLOR ING , SET PARSER, SET PCOLOR, Chapter 8, “KEDIT Language Definition Files”

Examples ECOLOR A RED Emphasis type A (used for com ments) is display ed in red.

ECOLOR * DE FAULT All empha sis col ors are reset to their default val ues.

188 Chapter 4. The SET Command SET EOFIN

Format [Set] EOFIN AL LOW|PRE VENT

KEDIT default: ALLOW

Level: File

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET EOFIN controls how KEDIT handles end-of-file charac ters (charac ter code 26) when reading in files as you begin to edit them and during exe cuti on of the GET command. End-of-file char acters are sometim es used to sig nal that the end of all use ful data in a file has been reached. Many program s (such as the DOS TYPE com mand) will stop pro cess ing a file when an end-of-file char acter is encoun tered. With EOFIN PREVENT, KEDIT also behaves this way: when an end-of-file char acter is encoun - tered, KEDIT assumes that it has reached the end of the use ful data in the file and stops processing it. With EOFIN ALLOW, the default, KEDIT does not stop proces sing a file when it encoun ters an end-of-file char acter , but instead pro cesses the entire file and allows end-of-file char acters as data in your file. Existing files someti mes have one or more end-of-file charac ter s at the very end of the file, because some older program s require it. So KEDIT always ignores any end-of-file charac ter s at the very end of an input file, regardles s of the set ting of EOFIN.

See also User’s Guide Chapter 12, “File Processing”, SET EOFOUT, SET EOLIN

SET EOFOUT

Format [Set] EOFOUT EOL|EOLEOF|EOF|NONE

KEDIT default: EOL

Level: File s n o i

Dialog box: Options SET Com mand t p O Save Set tings handli ng: Savable T E

Description SET EOFOUT con trols the sequence of char acters that KEDIT adds to the last line of S files written to disk by the FILE, SAVE, and PUT com mands, by the autosave facil ity, and by the File Save and related menu items.

SET EOFOUT 189 [Set] EOFOUT EOL Tells KEDIT to add the same end-of-line sequence , control led by SET EOLOUT and nor mally a carriage re turn-line feed pair, to the last line of the file as it adds to ev ery other line of the file. This is the de fault. [Set] EOFOUT EOLEOF Causes KEDIT to add the end-of-line se quence define d by SET EOLOUT fol- lowed by an end-of-file char acter (char acter code 26) to the last line of a file. This was the defaul t behav ior in text mode KEDIT 4.0 and earlier. [Set] EOFOUT EOF Tells KEDIT to add only an end-of-file charac ter , with no end-of-line sequence , to the last line of the file. [Set] EOFOUT NONE Tells KEDIT not to add any thing to the last line of the file.

See also User’s Guide Chapter 12, “File Processing”, SET EOFIN, SET EOLOUT

SET EOLIN

Format [Set] EOLIN CRORLF|LF|CR|NONE

KEDIT default: CRORLF

Level: File

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET EOLIN control s how KEDIT determ ines where each line ends when reading files as you begin to edit them and during exe cuti on of the GET com mand.

Most PC files use a car riage return-line feed sequence (char acter codes 13 and 10) to mark the end of each line. Some files, espe cially those cre ated under UNIX, have only a line feed at the end of each line, and a few files have only a car riage return. [Set] EOLIN CRORLF With EOLIN CRORLF (‘‘CR or LF’’), the de fault, carriage returns, linefeeds, and car riage re turn-line feed pairs all sig nal the end of a line to KEDIT. Most text files are han dled cor rectly with EOLIN CRORLF. [Set] EOLIN CR Carria ge returns and carria ge return-l inefeed pairs signal the end of a line, but line- feed char acters do not. This allows you to edit files that use line feed char acters as data within a line, inste ad of as an end-of-line signal.

190 Chapter 4. The SET Command [Set] EOLIN LF Linefeeds and car riage re turn-line feed pairs sig nal the end of a line, but car riage re turn char acters do not, so you can edit files that use car riage re turn char acters as data. [Set] EOLIN NONE KEDIT does not look for an expli cit end-of-line sequence . Inste ad, KEDIT as- sumes that all lines have a fixed length, equal to the value of the LRECL set ting, and KEDIT reads in ex actly that many bytes per line. EOLIN NONE is use ful in spe cial ized sit u a tions and is dis cussed fur ther in User’s Guide Chapter 12, “File Processing”.

See also User’s Guide Chapter 12, “File Processing”, SET EOFIN, SET EOLOUT

SET EOLOUT

Format [Set] EOLOUT CRLF|LF|CR|NONE

KEDIT default: CRLF

Level: File

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET EOLOUT control s which charac ter s KEDIT uses to mark the end of each line writ ten to disk by the FILE, SAVE, and PUT com mands, by the autosave facil ity, and by the File Save and related menu items. [Set] EOLOUT CRLF This is the de fault and causes KEDIT to use a car riage re turn-line feed (ASCII codes 13 and 10) to mark the end of each line. This is the standard end-of-line se - quence for text files on PC system s. [Set] EOLOUT LF KEDIT adds a line feed char acter to each line. This is the stan dard way of end ing lines on UNIX system s.

[Set] EOLOUT CR s n

KEDIT adds a car riage re turn char acter to each line. o i t [Set] EOLOUT NONE p O Tells KEDIT not to write any ex plicit end-of-line se quence af ter each line. This is T

use ful in spe cial ized sit u a tions and is dis cussed in User’s Guide Chapter 12, “File E Processing”. S

SET EOLOUT 191 Depending on the value of EOFOUT, a spe cial end-of-line sequence may be writ ten after the last line of the file; see SET EOFOUT for a discus sion of the options involved.

See also User’s Guide Chapter 12, “File Processing”, SET EOFOUT, SET EOLIN

SET FCASE

Format [Set] FCASE ASIS|LOWER

KEDIT default: ASIS

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description With the default of FCASE ASIS (‘‘as is’’), KEDIT dis plays file names in the same case (upper, lower, or mixed) that the names have on disk, and create s new files using exactly the combi na tion of upper- and low er case char acters that you specify . An excep - tion comes within DIR.DIR files, where names that are in low er case or mixed case are dis played as is, but names that are in upper case are dis played in low er case, since this is gen er ally easier to read.

With FCASE LOWER, KEDIT dis plays all file names in low er case in DIR.DIR files and on the ID line, and in upper case on the title bar. New files are cre ated with low er - case names, regard less of the case in which you enter the name.

SET FILEID, FMODE, FPATH, FNAME, FEXT, FTYPE

Format [Set] FILEId d:path\name.ext [Set] FMode d[:] [Set] FPath path [Set] FName name [Set] FExt ext [Set] FType ext

KEDIT default: Based on fileid used to begin edit ing the file

Level: File

Dialog box: Options SET Com mand (SET FILEID only)

Save Set tings handli ng: Not savable

192 Chapter 4. The SET Command Description SET FILEID allows you to change the fileid of the file you are current ly edit ing. The fileid is dis played in the title bar of the docu m ent window and, unless you override it, is the fileid under which your file will eventu all y be writ ten to disk by the FILE or SAVE com mands, or by menu items like File Save.

Fileids are made up of four com ponents : the drive specifier, the directory path, the file name, and the file extension. SET FILEID lets you control all of these. Related com - mands let you control the individ ual com ponents : SET FMODE sets the drive specifier, SET FPATH sets the direc tory path, SET FNAME sets the file name, and SET FEXT and the equiva lent SET FTYPE set the file extension.

If you omit the drive specifier from the operand for SET FILEID, KEDIT uses the drive let ter of the current fileid. If you omit the directory path, the directory path of the cur- rent fileid will be used, unless the drive specifier is changing, in which case KEDIT uses the current directory of the spec ifie d drive.

Shortcuts For the drive specifier, you can give a spe cific drive letter or you can use a period (‘‘.’’) to indicat e that the current default system drive let ter should be used.

For the directory path, you can give a spe cific directory path, or you can use the same types of rela ti ve path spec ifi ca ti ons as are accepted in Com mand Prompt windows.

For the file name, give the name to use. You cannot omit the file name from the fileid spec i fi ca tion.

For the file extension, you can give a specif ic file extension. If you omit the file exten- sion, what happens depends on the setti ng of DEFEXT. If DEFEXT OFF is in effect, the new fileid will have no extension. If DEFEXT ON is in effect, and the new fileid spec ifi ca ti on does not end in a period, the current file extension will be used. If DEFEXT ON is in effect but the new fileid spec ifi ca ti on does end in a period, the new fileid will have no extension. (FEXT NONE or FTYPE NONE is handled as a spe cial case, provid ing another way to assign a fileid with no extension.)

You can also use an equal sign (‘‘=’’) for any of the four com ponents of the fileid to spec ify that the corre spond ing com ponent of the exist ing fileid should be used without change.

You can optionall y enclose fileid operands in double quotes, and you must do so for fileids that con tain blanks.

UNC names You can also specify fileids using UNC (Univer sal Nam ing Con venti on) names. This is a nam ing conven ti on, often used with files stored on a net work, in which files are s n o

referred to not by a drive let ter, path, and filename, but by a server name, the name of a i t

shared resource on the server, and then a path and filename. UNC names always begin p O

with a pair of backslashes. T

\\SERVER2\COMMON\SAM PLES\TEST.FIL E S In this exam ple, SERVER2 is the server name, COMMON is a shared resource on the server, SAMPLES is a subdi rec tory , and TEST.FIL is a file name and extension.

SET FILEID, FMODE, FPATH, FNAME, FEXT, FTYPE 193 Examples Each of the follow ing examples assumes that the cur rent fileid is C:\PROJ\PROG.TXT, and that the current drive and directory is D:\WORK.

FILEID DEF.XYZ Changes the fileid to C:\PROJ\DEF.XYZ.

FILEID SUB\DEF.XYZ Changes the fileid to C:\PROJ\SUB\DEF.XYZ.

FILEID "SUB\TESTFILE.DATA" Changes the fileid to C:\PROJ\SUB\TESTFILE.DATA. (Dou ble-quotes are required with fileids that con tain blanks, but are also allowed with fileids that don't con tain blanks.)

"D:My file.txt" Changes the fileid to D:\WORK\My file.txt. No path spec ifi ca tion was given but the drive specifier changed, so the current directory of the new drive is used. Fileid speci fi - cati ons that include blanks must be enclosed in double quotes.

FILEID =.TMP Changes the fileid to C:\PROJ\PROG.TMP.

FILEID \NEW\= This changes the fileid to C:\NEW\PROG if DEFEXT OFF is in effect, and to C:\NEW\PROG.TXT if DEFEXT ON is in effect.

FMODE . Changes the drive to the current default drive, which is D:, and since the drive is chang- ing, the current directory of the new drive is used, yielding D:\WORK\PROG.TXT.

FNAME FRED Changes the fileid to C:\PROJ\FRED.TXT.

FPATH \KEEP Changes the fileid to C:\KEEP\PROJ.TXT.

194 Chapter 4. The SET Command SET FORMAT

Format [Set] FOR MAT Jus tify|NOJustify [BLANK|EX TENded [SIn gle|DOu ble]]

KEDIT default: NOJUSTIFY BLANK DOUBLE

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET FOR MAT affects how paragrap hs are refor matted when you use the FLOW com- mand or press Shift+Ctrl+F (or, with INTER FACE CLAS SIC in effect, press Ctrl+F). It also affects what KEDIT consid ers a paragraph when you use PARAGRAPH targets.

JUSTIFY or NOJUSTIFY control s whether para graphs are justi fied within the mar gins or are left with ragged right mar gins when they are reform atted.

BLANK or EXTENDED con trols what KEDIT consid ers to be a para graph when you reform at text or when you use PARAGRAPH as a tar get. With BLANK, the default, paragraphs are sepa rat ed by com pletely blank lines. With EXTENDED, blank lines can still sepa rate para graphs, but the start of a new para graph is also rec og nized if the left mar gin is in colum n 1 and a line is encounter ed that starts with a blank, a tab charac ter , a period (‘‘.‘‘), a less than (‘‘<’’), a greater than (‘‘>‘‘), or a colon (‘‘:’’). This allows para- graphs that are indented but not sepa rat ed by blank lines. It also treats lines that start with HTML tags, with the ‘‘dot’’ com mands used with some text form atti ng program s, or with the greater than (‘‘>’’) that is often used to quote text in e-mail message s, as marking the start of a paragraph.

SINGLE or DOUBLE control s the num ber of blanks placed after a sentenc e during para graph refor matting . With DOU BLE, the default, KEDIT will insert two spaces after each sentenc e. (Unfortu nate ly, KEDIT is someti mes wrong about when it has reached the end of a sen tence, because it can be con fused by cer tain acro nyms, abbre vi - ati ons, and short words beginning with a capi tal let ter.) If SINGLE is in effect, KEDIT will only insert one space after a sen tence. (Note that in either case, addi tional spaces

may be added when FOR MAT JUS TIFY is in effect and KEDIT must add extra spaces s n

to move text into the right margin column.) o i t p O

Example FORMAT JUSTIFY EXTENDED T E

This tells KEDIT that you want paragraphs to be justi fied when you form at them, and S that paragraph boundari es may be determ ined by lines start ing with a period, colon, less than, greater than, blank, or tab.

SET FORMAT 195 SET HELPDIR

Format [Set] HELPDIR direc tory

KEDIT default: *PROGRAM

Level: Global

Dialog box: None

Save Set tings handli ng: Savable

Description SET HELPDIR is a spe cialized comm and needed only by users can not access the KEDIT Help file because it is stored on a net work device.

KEDIT's Help file, KEDITW.CHM, is in HTML Help for mat and is nor mally installed in the KEDIT program directory . Because of a Microsoft securit y fix issued in 2005, HTML Help files stored on a network drive don't work without spe cial changes to the regis try . If your copy of KEDIT is installed on a network drive, you can copy KEDITW.CHM to a local direc tory and use SET HELPDIR to tell KEDIT where it is.

The default value of HELPDIR is *PRO GRAM, which means that KEDIT will look for KEDITW.CHM in the KEDIT pro gram direc tory and nowhere else.

If HELPDIR is set to the name of a directory , for exam ple C:\MyKeditHelp, KEDIT will look for KEDITW.CHM in that directory . If KEDITW.CHM is not found there, KEDIT will then look for it in the KEDIT program directory .

Notes · SET HELPDIR is most often issued from within the WINPROF.KEX macro that is au to mat i cally ex e cuted when KEDIT starts up.

· The KEDIT Setup program does not look for or update copies of KEDITW.CHM that are stored outside of the KEDIT program direc tory . So if you copy the Help file into a dif fer ent direc tory and use SET HELPDIR to ac cess it, you will need to recopy it if you later insta ll an update d version of KEDIT that has a newer version of the Help file.

SET HEX

Format [Set] HEX ON|OFF

KEDIT default: OFF

Level: View

Dialog box: Options SET Com mand

196 Chapter 4. The SET Command Save Set tings handli ng: Savable

Description When you set HEX ON, you can enter hexa dec i m al and deci m al codes for strings used in tar get searches and with a num ber of KEDIT com mands.

With HEX ON, any string used in a string tar get that starts with X’ (that is, ‘‘X’’, in uppercas e or lower cas e, fol lowed by a single quote) is assumed to contai n the charac ter codes in hexa dec i m al for the charac ter s involved. Strings that start with D’ (that is, ‘‘D’’, in uppercas e or lower cas e, fol lowed by a single quote) are assumed to contai n the charac ter codes in dec im al for the charac ter s involved. Both types of strings must also end with a single quote. Dec im al num bers must be in the range 0 to 255 and are sepa - rated by blanks. Hexa dec i m al num bers must be in the range 00 to FF; each charac ter is rep re sented by exactly two hex adec im al dig its. Pairs of hex adec im al digits may or may not be separated by blanks.

For exam ple, the charac ter codes for ‘‘1’’, ‘‘2’’, ‘‘3’’, and ‘‘4’’ are 49, 50, 51, and 52 in deci m al and 31, 32, 33, and 34 in hexa dec i m al. With HEX ON, the fol lowing string tar gets are equiv a lent:

/1234/ /d'49 50 51 52'/ /x'31323334'/ /x'31 32 33 34'/ In addi tion to string tar gets, you can take advantage of HEX ON for the string operands of CHANGE, COUNT, and SCHANGE, and for the text operands of CAPPEND, CINSERT, COVERLAY, CREPLACE, FILLBOX, FIND, FINDUP, INPUT, NFIND, NFINDUP, OVERLA Y, PRINT, PUT, REPLACE, and TEXT. It also affects strings entered into the Edit Find, Edit Replace, and Edit Selecti ve Editing boxes.

SET HEXDISPLAY

Format [Set] HEXDISPlay ON|OFF

KEDIT default: OFF

Level: Global

Dialog box: Options SET Com mand s n o

Save Set tings handli ng: Savable i t p O Description With HEXDISPLAY ON, KEDIT will dis play on the sta tus line the hex a dec imal and T

dec im al val ues of the char acter code for the char acter at which the cur sor is located. E S For exam ple, if the cur sor is posi tioned at a low er case ‘‘e’’, whose char acter code is 65 in hex a dec imal and 101 in dec imal, KEDIT will dis play, in the status line:

SET HEXDISPLAY 197 'e'=65/101

See also SET STATUSLINE

SET HIGHLIGHT

Format [Set] HIGHlight OFF|ALTered|TAGged|SE Lect n [m]

KEDIT default: OFF

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET HIGHLIGHT control s KEDIT’s highli ghting facil ity, determ ining which types of lines are highli ghted on your display . [Set] HIGHlight OFF This is the defaul t, and it means that no lines are highli ghted. [Set] HIGHlight ALTered Tells KEDIT to highli ght all lines in your file that have been alter ed during the cur- rent edit ing session. (KEDIT deter mines whether a line has been alter ed by look- ing at the flag bits asso ci ate d with each line to see if the new bit or change bit are set. See SET LINEFLAG for a discus sion of these flag bits.) [Set] HIGHlight TAGged Tells KEDIT to high light all lines whose tag bits are set. Tag bits are most of ten set via the TAG com mand, which auto m ati cal ly puts HIGHLIGHT TAGGED into ef - fect when ever it is issued. [Set] HIGHlight SELect n [m] High lights all lines with a given se lec tion level, or whose se lec tion lev els fall in a spec i fied range.

SET COLOR HIGH LIGHT determ ines the col ors KEDIT uses to display highlight ed lines. With highli ghted text for which syntax color ing also applies, KEDIT attempts to merge the two colors. KEDIT uses the background color from the SET COLOR HIGH- LIGHT set ting, and the foreground color from the appropri ate ECOLOR setti ng. You need to take this into account when you decide on the colors you will use with SET COLOR HIGHLIGHT and SET ECOLOR, since not all com bina ti ons of foreground and background col ors work well together.

See also User’s Guide Chapter 8, “Selective Line Editing and Highlighting”, TAG, SET ECOLOR, SET LINEFLAG

198 Chapter 4. The SET Command SET IDLINE

Format [Set] IDline ON|OFF

KEDIT default: OFF

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description Use SET IDLINE to tell KEDIT whether to dis play the ID line.

The ID line is an optional line of infor mati on display ed at the top of the file area in a docu ment window . It has inform ati on about the fileid, your positi on in the file, the size of the file, etc. The ID line is usuall y off in KEDIT for Windows because the infor ma- tion con tained there is nor mally dis played else where: the fileid is on the title bar, and the current positi on in the file, the size of the file, and the num ber of alter ations to the file are on the sta tus line. SET IDLINE is pro vided mainly for compat ibil ity with the text mode version of KEDIT.

SET IMPMACRO

Format [Set] IMPMACro ON|OFF

KEDIT default: ON

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description You can set IMPMACRO (‘‘im plied macro’’) ON (the default) or OFF. With IMPMACRO ON, when you enter a com mand that KEDIT does not recog nize , KEDIT checks to see if what you entered is instead the name of a macro, and if so, KEDIT runs

the macro. With IMPMACRO OFF, when you enter a com mand that KEDIT does not s

rec og nize, KEDIT issues an error mes sage. n o i t

The advantage of IMPMACRO ON is that you can invoke most KEDIT macros p O directly, without having to issue the MACRO com mand, and can treat the macros as if T

they were built-in KEDIT com mands. The dis advan tage of IMPMACRO ON is that, E when you really do make a typing error and enter an invalid com mand, there will be a S slight delay while KEDIT checks your disk to see if the invalid com mand is really a macro.

SET IMPMACRO 199 IMPMACRO ON only helps you when the macro name involved consis ts entirely of alpha betic charac ter s. If you want to invoke a macro whose name contai ns numeric charac ter s, or you want to give a drive or path spec ifi ca ti on for a macro name, you must use the MACRO com mand to run the macro. For exam ple, even with IMPMACRO ON,

MACRO DEL5

would run the macro DEL5, while

DEL5

would instead delete five lines from your file. And

MACRO C:TEST

would run the macro TEST.KEX on your C: drive, while

C:TEST

would not run your macro and is, in fact, a valid CHANGE com mand.

See also MACRO

SET INISAVE

Format [Set] INISAVE STATE|NOSTATE [HIS Tory|NOHISTory]

KEDIT default: STATE HIST ORY

Level: Global

Dialog box: None

Save Set tings handli ng: Not savable

Description SET INISAVE does the same thing as SET REGSAVE. See the discus sion of SET REGSAVE for a full descripti on of the operands involved.

(KEDIT for Windows now stores its config u ra ti on inform ati on in the Windows regis - try, but KEDIT for Windows 1.5 and earli er stored this inform ati on in the KEDITW.INI file. So SET REGSAVE is the newer name for this option, but for com - pat ibil ity rea sons SET INISAVE remains available.)

See also NOREG ini tial iza tion option, REGUTIL, SET REGSAVE

200 Chapter 4. The SET Command SET INITIALDIR

Format [Set] INITIALDIR PRESERVE|RECALL [PRESERVE|RECALL|FIRSTFile]

KEDIT default: PRESER VE PRE SERVE

Level: Global

Dialog box: Options SET Com mand

Save Set tings han dling: Auto mat i cally saved

Description SET INITIALDIR con trols the cur rent directory put into effect at the start of a KEDIT ses sion.

The current directory is used within KEDIT for several purposes. For exam ple, when you use File New to begin edit ing an untitl ed file, the current directory is used as the path speci fi ca ti on for that file. When you use the DOS com mand to shell to an MS DOS com mand session, that session inherit s KEDIT’s current directory . And when you issue the KEDIT com mand and do not give a path speci fi ca ti on for the file you want to edit, KEDIT begins its search in the current directory.

When KEDIT begins execu ti on, the current directory is norm ally the Windows Documents or My Docu m ents folder. If you invoke KEDIT via a desktop short cut, you can override this by speci fy ing a dif ferent “Start In” directory in the short cut’s Proper - ties dia log box. With the default setting of INITIALDIR PRE SERVE PRESERVE, KEDIT leaves this cur rent directory in effect.

It is someti mes more use ful to have the directory of the files that you are actuall y work- ing with as the current directory , rather than the directory from which KEDIT was loaded. So, SET INITIALDIR lets you make the direc tory of the first file edited at the start of a KEDIT session become the current directory . But in the case where you dou - ble-click on the KEDIT for Windows icon to run KEDIT, there is no ini tial fileid speci - fied and KEDIT starts out by editing the file UNTI TLED.1. In this situ a tion, SET INITIALDIR provides a way to set the current directory to whatever was the cur rent direc tory the last time you ran KEDIT.

The first operand of SET INITIALDIR determ ines what the current directory will be if no fileid is used to start a KEDIT session. There are two choices: PRE SERVE This is the de fault; KEDIT stays with the di rec tory al ready put into ef fect by Win - dows. s n o i RE CALL t KEDIT switches to what ever direc tory was the cur rent di rec tory at the end of the p O

last KEDIT session. T E

The second operand of SET INITIALDIR deter mines what the current directory will be S if a fileid is used to start a KEDIT session. This happens when you explicit ly invoke KEDIT by speci fy ing a fileid. It also happens if, in the Windows File Manager or

SET INITIALDIR 201 Explorer, you drag-and-drop a file on KEDIT’s icon or double- click on a file whose filetype has been asso ciated with KEDIT. There are three choices for the second operand: PRE SERVE This is the de fault; KEDIT stays with the di rec tory al ready put into ef fect by Win - dows. RE CALL KEDIT switches to what ever direc tory was the cur rent di rec tory at the end of the last KEDIT session. FIRSTFILE KEDIT switches to the di rec tory of the first file ed ited.

Notes · KEDIT de ter mines the initial cur rent di rec tory while it is initializing, be fore you have a chance to enter any com mands and before any macros, even your profil e macro, are ex ecuted. So, by the time you is sue the SET INITIALDIR comm and it has no ef fect at all on the current KEDIT session. The purpose of SET INITIALDIR is to deter m ine the ini tial current di rectory for future KEDIT ses- sions, and to have any ef fect the value of INITIALDIR must be saved in the Win- dows regis try . Therefore, whenever you issue the SET INITIALDIR com mand, the regis try is auto m ati cal ly update d to re flect its new value; you do not need to save it by using Opti ons Save Set tings or by us ing the Save Setting button of the SET Command dialog box.

· SET INITIALDIR only af fects how KEDIT deter m ines the current di rectory at the start of a KEDIT session. After KEDIT has deter m ined the ini tial current di rectory , KEDIT makes no further auto m atic changes to your current direc tory , al though you can change the current direc tory yoursel f by using the File Di rectory dia log box or the CHDIR and CHDRIVE commands.

· If KEDIT is unable to switch to the di rectory speci fied by SET INITIALDIR (for exam ple, if the direc tory in ef fect at the end of the last KEDIT session no longer exist s), KEDIT will leave the current direc tory unchanged.

See also CHDIR, CHDRIVE

Examples SET INITIALDIR RE CALL FIRSTFILE If no fileid is spec ifie d in the com mand string used to start KEDIT, KEDIT switches to the cur rent directory in effect at the end of the last KEDIT ses sion. If a fileid is spec i- fied, KEDIT switches to the direc tory of that file.

SET INITIALDIR RE CALL RE CALL

KEDIT will always switch to whatever was the cur rent directory at the end of the last KEDIT session.

202 Chapter 4. The SET Command SET INITIALDIR PRESERVE PRE SERVE This is the default; KEDIT will leave unchanged the current directory put into effect by Windows when KEDIT is loaded.

SET INITIALDOCSIZE

Format [Set] INITIALDOCsize MAXi mized|NOR Mal|RE CALL

KEDIT default: MAX IMIZE D Level: Global Dialog box: Options SET Com mand Save Set tings han dling: Auto mat i cally saved

Description SET INITIALDOCSIZE determ ines whether the ini tial docu ment win dow create d when KEDIT starts up is maxi m ized within KEDIT’s frame window or is in the non-maxi m ized state sometim es referred to as the ‘‘nor mal’’ or ‘‘re stored’’ state. INITIALDOCSIZE MAX I MIZED This is the defaul t. KEDIT starts with a maxi m ized docu m ent window . INITIALDOCSIZE NORMAL KEDIT starts with a ‘‘norm al’’ docu m ent window , nei ther mini m ized nor maxi - mized, usuall y occu py ing only part of the area of the frame window. INITIALDOCSIZE RECALL KEDIT starts with the state, max im ized or non-max im ized, that was in ef fect for the last docu m ent window closed in your last KEDIT session.

Notes · KEDIT de ter mines the initial doc u ment win dow size while it is initializing, be fore you have a chance to enter any com mands and before any macros, even your pro- file macro, are ex ecuted. So, by the time you is sue the SET INITIALDOCSIZE com mand it has no ef fect at all on the current KEDIT session. The purpose of SET INITIALDOCSIZE is to de ter mine the initial doc u ment win dow size for fu ture KEDIT sessions , and to have any ef fect the value of INITIALDOCSIZE must be saved in the Windows regis try . There fore, whenever you issue the SET INITIALDOCSIZE com mand, the reg is try is au to mat i cally up dated to re flect its new value; you do not need to save it by using Opti ons Save Set tings or by us ing

the Save Setting button of the SET Command dialog box. s n o i

· SET INITIALDOCSIZE only af fects how KEDIT deter m ines the state of the ini - t tial doc u ment win dow. When ad di tional doc u ment win dows are cre ated dur ing a p O KEDIT session, the newly added windows are maxi m ized if the current docu m ent T

window is maxi m ized and other wise they are non-maxi m ized. If, in the course of a E KEDIT session, you close all of your docu m ent windows and then cre ate a new S doc u ment win dow, that win dow will be max i mized or non-max i mized de pend ing on the state of the last window closed.

SET INITIALDOCSIZE 203 See also SET DOCSIZING, SET INITIALFRAMESIZE

SET INITIALFRAMESIZE

Format [Set] INITIALFRAMEsize MAXi mized|NOR Mal|RE CALL

KEDIT default: RECALL

Level: Global

Dialog box: Options SET Com mand

Save Set tings han dling: Auto mat i cally saved

Description SET INITIALFRAMESIZE determ ines whether KEDIT’s frame window is maxi - mized or is in the non-maxi m ized state sometim es referred to as the ‘‘nor mal’’ or ‘‘re - stored’’ state. INITIALFRAMESIZE MAX I MIZED KEDIT starts with a maxi m ized frame window . INITIALFRAMESIZE NORMAL KEDIT starts with a ‘‘norm al’’ frame win dow, nei ther mini m ized nor maxi m ized, usuall y occu py ing only part of your screen. INITIALFRAMESIZE RECALL KEDIT starts with the frame win dow state, maxi m ized or non-maxi m ized, that was in effect at the end of your last KEDIT session.

Notes · KEDIT de ter mines the initial frame win dow size while it is initializing, be fore you have a chance to enter any com mands and before any macros, even your profil e macro, are ex ecuted. So, by the time you is sue the SET INITIALFRAMESIZE com mand it has no ef fect at all on the current KEDIT session. The purpose of SET INITIALFRAMESIZE is to deter m ine the ini tial frame window size for fu ture KEDIT sessions , and to have any ef fect the value of INITIALFRAMESIZE must be saved in the Windows regis try . There fore, when ever you issue the SET INITIALFRAMESIZE com mand, the reg is try is au to mat i cally up dated to re flect its new value; you do not need to save it by using Opti ons Save Set tings or by us ing the Save Setti ng button of the SET Command dialog box.

· To override the INITIALFRAMESIZE value for a partic u lar KEDIT session, you can specify the FRAMESIZE ini tializa tion opti on on the com mand line used to in - voke KEDIT.

See also FRAMESIZE initial iza tion option, SET INITIALDOCSIZE

204 Chapter 4. The SET Command SET INITIALINSERT

Format [Set] INITIALINSert ON|OFF

KEDIT default: OFF

Level: Global

Dialog box: Options SET Com mand

Save Set tings han dling: Auto mat i cally saved

Description SET INITIALINSERT determ ines whether KEDIT starts out with Insert Mode in effect.

With INITIALINSERT OFF, the default, INSERTMODE OFF is put into effect when KEDIT is loaded, and you are in Overtype Mode.

With INITIALINSERT ON, INSERTMODE ON is put into effect when KEDIT is loaded, and you are in Insert Mode.

Notes · KEDIT de ter mines the initial In sert Mode state while it is initializing, be fore you have a chance to enter any com mands and before any macros, even your profil e macro, are ex ecuted. So, by the time you is sue the SET INITIALINSERT com- mand it has no ef fect at all on the current KEDIT session. The purpose of SET INITIALINSERT is to de ter mine the initial In sert Mode state in fu ture KEDIT ses - sions, and to have any ef fect the value of INITIALINSERT must be saved in the Windows regis try . There fore, whenever you issue the SET INITIALINSERT com - mand, the regis try is auto m ati cal ly update d to re flect its new value; you do not need to save it by using Opti ons Save Set tings or by us ing the Save Setti ng button of the SET Command dialog box.

· In contras t to SET INITIALINSERT, SET INSERTMODE im medi ate ly puts you into or takes you out of Insert Mode. A SET INSERTMODE com mand in your profil e could therefore be used to de ter mine whether KEDIT starts out in Insert Mode, and would override the state set by INITIALINSERT. INITIALINSERT is avail able as a sep arate comm and so that KEDIT us ers can con trol this as pect of KEDIT’s behav ior solely via Opti ons SET Com mand and Opti ons Save Set tings, without the need for a profile.

See also SET INSERTMODE s n o i t p O

T E S

SET INITIALINSERT 205 SET INITIALWIDTH

Format [Set] INITIALWidth n

KEDIT default: 10000

Level: Global

Dialog box: Options SET Com mand

Save Set tings han dling: Auto mat i cally saved

Description SET INITIALWIDTH determ ines the WIDTH value that KEDIT puts into effect at the start of each KEDIT session. The WIDTH value determ ines the length of the longest line that you can edit during that KEDIT session. Its value can range from 1024 to 999999. The default is 10000.

Notes · KEDIT de ter mines the WIDTH value while it is initializing, be fore you have a chance to enter any com mands and before any macros, even your profil e macro, are exe cute d. So, by the time you issue the SET INITIALWIDTH com mand it has no ef fect at all on the current KEDIT session. The purpose of SET INITIALWIDTH is to de term ine the WIDTH used in future KEDIT sessions, and to have any ef fect the value of INITIALWIDTH must be saved in the Windows regis try . There fore, whenever you issue the SET INITIALWIDTH com mand, the regis try is auto m ati cal ly update d to re flect its new value; you do not need to save it by using Opti ons Save Set tings or by us ing the Save Set ting button of the SET Command dialog box.

· To override the INITIALWIDTH value for a partic u lar KEDIT session, you can spec ify the WIDTH initi aliza tion opti on on the com mand line used to invoke KEDIT.

· Once the WIDTH value is es tab lished at the start of a KEDIT ses sion, it re mains in ef fect for the dura ti on of that session and cannot be changed.

See also WIDTH ini tial iza tion option

SET INPUTMODE

Format [Set] INPUTMode OFF|FUll|LIne

KEDIT default: OFF

Level: View

Dialog box: Options SET Com mand

206 Chapter 4. The SET Command Save Set tings handli ng: Savable

Description When you enter the INPUT com mand with no operands and INPUTMODE is OFF (the default), a blank line is added to your file and the cursor is positi oned in the left mar gin colum n of the line.

If INPUTMODE FULL is in effect and you enter the INPUT com mand with no operands, KEDIT will sim ulat e the Input Mode provided with IBM’s XEDIT editor . INPUTMODE FULL has been added to KEDIT mainly for the conve nienc e of fre- quent users of XEDIT. The pre fix area will tem porari ly be turned off and blank lines will appear on your screen below the focus line. The cursor is positi oned in the left mar - gin col umn of the first of these blank lines and you can enter text, using the Enter key to move to the beginning of each new line. When you have entered enough lines to reach the bot tom of the docu m ent window , KEDIT will autom ati cal ly readjust the newly entered text to make room on the screen for more input. To leave Input Mode, move the cursor to the com mand line; you norm ally do this by press ing the F12 key (if you are using INTERF ACE CUA) or the Home key (if you are using INTERFACE CLASSIC).

If INPUTMODE LINE is in effect and you enter the INPUT com mand with no operands, KEDIT adds one blank line to your file and positi ons the cursor in its left mar gin col umn. What is specia l about INPUTMODE LINE is that, until you leave Input Mode by mov ing the cursor to the com mand line (norm ally done in INTERF ACE CLAS SIC by press ing the Home key), you can add new lines to your file by press ing the Enter key, instead of the less conve nient F2 key that is norm ally used with INTER - FACE CLASSIC. This gives you an easy way to add lines to your file without having a large part of your screen filled with blank lines, as it is with INPUTMODE FULL. INPUTMODE LINE is prim arily intended for users if INTERF ACE CLASSIC, since by default the Enter key always adds new lines to a file when INTER FACE CUA is in effect.

The REPLACE com mand with no operands is sim ilar to the INPUT com mand with no operands. INPUT with no operands adds a blank line, while REPLACE with no operands replaces the focus line with a blank line. Both can trigger KEDIT’s Input Mode, depending on the setti ng of INPUTMODE.

XEDIT users should note that with INPUTMODE FULL and WORDWRAP ON, KEDIT's Input Mode is very close to XEDIT's Power Input Mode. s n o i t p O

T E S

SET INPUTMODE 207 SET INSERTMODE

Format [Set] INSERTmode ON|OFF|TOG GLE

KEDIT default: Dependent on the value of INITIALINSERT

Level: Global

Dialog box: None

Save Set tings handli ng: Not savable

Description With INSERTMODE ON, char acters that you enter at the key board are inserted into the cursor line at the cursor posi tion. Existing text shifts to the right to make room for the newly-inserted text. (If WORDWRAP ON is in effect, text shifted beyond the right mar gin col umn may be split off to a new line.) With INSERTMODE OFF, char acter s entered at the keyboard overtype existing text at the cursor location.

INSERTMODE TOGGLE, norm ally assigned to the Ins key, toggles the status of INSERTMODE, from ON to OFF or from OFF to ON.

The sta tus of INSERTMODE is indi cated on the sta tus line, where ‘‘INS’’ is dis played if you are in Insert Mode and ‘‘OVR’’ is display ed if you are in Overtype Mode.

The cursor size also gives you an indi cati on of the sta tus of INSERTMODE, with a larger cursor norm ally display ed when INSERTMODE ON is in effect. The cursor ’s appearance is control led by the SET CURSORTYPE and SET CURSORSIZE com mands.

See also SET INITIALINSERT

SET INSTANCE

Format [Set] INSTANCE SINGLE|MUL TI PLE

KEDIT default: SINGLE

Level: Global

Dialog box: Options SET Com mand

Save Set tings han dling: Auto mat i cally saved

Description SET INSTANCE control s whether multi ple copies of KEDIT, or instead only a single copy of KEDIT, can be active at the same time.

208 Chapter 4. The SET Command With INSTANCE SIN GLE, the default, only a sin gle copy of KEDIT is active at a time. If a copy of KEDIT is already active when you double- click on the KEDIT for Win- dows icon in the Program Manager , double- click in the File Manager on a file that is associ ate d with KEDIT, or other wise try to run KEDIT, the existing instance of KEDIT is re-activate d, with any new files to be edited added to the existing instance’s ring of files. With INSTANCE MUL TIPLE, a new instance of KEDIT, with a sepa rate frame window and ring of files, is cre ated in each of these cases, and it is pos sible to have sev- eral cop ies of KEDIT active at the same time.

INSTANCE SIN GLE is the default because, when you want to edit sev eral files at a time, it is norm ally more conve nient to have one copy of KEDIT working with multi ple files than it is to have multi ple copies of KEDIT running simulta neousl y.

Notes · The value of the INST ANCE opti on is only used when you attem pt to start a new insta nce of KEDIT for Windows. By the time you issue the SET INST ANCE com - mand it there fore has no ef fect at all on the cur rent KEDIT ses sion, since ei ther a new in stance has al ready been started or an ex isting in stance has al ready been re-ac ti vated. The purpose of SET INST ANCE is to influ ence the proces sing that takes place at the start of fu ture KEDIT ses sions, and to have any effect, the value of SET INST ANCE must be saved in the Windows regis try . There fore, whenever you issue the SET INST ANCE com mand, the regis try is auto m ati cal ly update d to refle ct its new value; you do not need to save it by using Opti ons Save Set tings or by using the Save Setting button of the SET Command dialog box.

· To override the INST ANCE setti ng for a par ticu lar KEDIT session, you can spec- ify the IN STANCE SIN GLE or IN STANCE MUL TI PLE ini tial iza tion op tions on the com mand line used to invoke KEDIT.

See also INSTANCE ini tial iza tion option

SET INTERFACE

Format [Set] INTER FACE CUA|CLASSIC

KEDIT default: CUA

Level: Global

Dialog box: Options SET Com mand, Options Interface s

Save Set tings handli ng: Savable n o i t Description Use SET INTERF ACE to control whether certai n aspects of KEDIT for Windows’ user p O interface work according to the CUA (‘‘Com mon User Access’’) conven ti ons used by T

most other Windows applica ti ons, or whether they instead work according to the con - E venti ons used in the text mode version of KEDIT 5.0. S

With INTER FACE CUA, you get the Windows-st yle behavior:

SET INTERFACE 209 · Defaul t behav ior for most keys is based on CUA conven ti ons. For exam ple, the Ctrl+End key moves the cursor to the end of the file and Alt+W opens the Window menu.

· Blocks marked with the mouse or with Shift+cursor key com bina ti ons behave like selec tions, in that any text that you type after marking a block replac es the content s of the block, and moving the cursor away from the block unmarks the block.

· You can mark com mand line se lec tions, use ful for edit ing text on the com mand line and for moving it to the clipboard.

· By de fault, KEDIT uses a ver tical text cur sor.

· You can use the SET KEYSTYLE and SET MARKSTYLE com mands, or the Op- tions Inter face dia log box, to modify some as pects of KEDIT’s behav ior when IN- TERF ACE CUA is in ef fect. These com mands are pri mar ily aimed at for mer us ers of text mode KEDIT. They let you take advan tage of most aspect s of INTER FACE CUA while letti ng you make a few as pects of KEDIT’s behav ior more like the be- havior of text mode KEDIT. SET KEYSTYLE lets you adjust the behav ior of some of KEDIT’s keys, while SET MARKSTYLE control s whether the mouse marks selec tions or persistent blocks.

With INTER FACE CLASSIC, you get text mode-com pati ble behavior:

· Defaul t behav ior for most keys is very close to the behav ior in text mode KEDIT 5.0. For exam ple, the Ctrl+End key delet es text from the cursor through the end of the line, and Alt+W deletes a word.

· Blocks do not exhibi t CUA-style behav ior . All blocks in INTER FACE CLASSIC are persis tent blocks: typing a charac ter does not replac e their content s, and cursor movem ent does not unmark them.

· Comm and line se lections are not avail able.

· By defaul t, KEDIT uses a hori zon tal text cursor , resem bling the text mode cursor .

· SET KEYSTYLE and SET MARKSTYLE have no ef fect.

See also SET KEYSTYLE, SET MARKSTYLE

210 Chapter 4. The SET Command SET INTERNATIONAL

Format [Set] INTER NA Tional CASE|NOCASE [SORT|NOSORT]

KEDIT default: NOCASE NOSORT

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET INTERNA TIONAL controls some aspects of how KEDIT works with interna - tional char ac ters.

CASE|NOCASE INTERNA TIONAL CASE|NOCASE affects how text in your files is handled by the UPPER CASE and LOWER CASE com mands, and in case-insensi ti ve string searches.

When INTERNA TIONAL NOCASE is in effect, only the 26 let ters of the Englis h alphabet are handled by the UPPER CASE and LOWER CASE com mands, and given specia l handli ng in case-insensi ti ve string searches.

When INTERNA TIONAL CASE is in effect, KEDIT asks Windows which charac ters are alpha betic and how they are uppercased or lowercased, and han dles the UPPERCASE and LOW ER CASE com mands and case-insen si tive com par i sons accord ingly. This allows accented char acters, etc. to be treated prop erly, accord ing to rules determ ined by the Windows language drivers installed on your system.

SORT|NOSORT KEDIT's handli ng of the SORT com mand and inter nati onal charac ter s is somewhat com pli cated, because it depends on the value of SET CASE, and on both the first and second operands of SET INTER NA TIONAL.

Ÿ If the second operand of SET INTER NA TIONAL is set to NOSORT, the SORT com mand works like this:

- If SET CASE's first IGNORE|RESPECT oper and is set to RESPECT, all char ac ters are sorted according to the value of their charac ter code, without regard to whether the char acters are alphabetic and with out regard to case.

- If SET CASE's first IGNORE|RESPECT operand is set to IGNORE, then the SORT comm and does pay atten tion to whether the char acters are alphabetic and whether they

are uppercase or lower case . If INTER NA TIONAL NOCASE is in effect, the SORT s

com mand lowercases the 26 letter s of the Engli sh alphabet before making its com pari - n o i

sons. If INTERNA TIONAL CASE is in effect, KEDIT uses your Windows lan guage t driver to decide which char acters are alphabetic, and it lowercases any upper case p O alpha betic char acters, which may include accented char acters, etc., before making its T

comparisons. E S Ÿ If the second operand of SET INTER NA TIONAL is set to SORT, the SORT com - mand does not compare the lines to be sorted one char acter at a time, in the way that it

SET INTERNATIONAL 211 does when the second operand of SET INTER NA TIONAL is NOSORT. Instead, when it com pares text in the sort fields of two lines of your file, it uses your Windows lan - guage driver to com pare the entire strings as a unit.

If SET CASE's first IGNORE|RESPECT oper and is set to RESPECT, the compar ison is case sen si tive; if it is set to IGNORE, the compar ison is case insen si tive.

There are two reasons for using your Windows language driver to com pare the strings to be sorted, and for com paring entire strings at a time, rather than on a charac - ter-by-char ac ter basis:

First, this allows the Windows language driver to determ ine how accented let ters are sorted with respect to non-accented versions of the charac ter s involved. With the sec- ond operand of SET INTER NA TIONAL set to NOSORT, accented let ters will always sort after all 26 of unaccented letter s of the Engli sh alphabet, but most Windows lan - guage drivers sort the accented letter s, using language-de pendent rules, interm ixed with, or immedi ately after, the unaccented ver sions of those letters.

Second, by doing the sort based on the entire strings involved, your Windows language driver can apply language-de pendent rules that give specia l handli ng to some multi-charac ter sequences. For exam ple, the Windows Engli sh language driver gives spe cial han dling to the Latin char acter "Æ", sort ing it between the two char acter sequences "AE" and "AF", yield ing order ings like this: "ADC", "AEF", "ÆC", "AFC".

Notes Ÿ SET INTER NA TIONAL has no effect on the behavior of KEXX instructi ons or built-in functi ons, such as the UPPER() and LOWER() KEXX functi ons. Most KEXX instructi ons and built-in func tions always conside r only the 26 letter s of the Engli sh alpha bet as alpha betic; the excep tions are the ANSIUPPER(), ANSILOWER(), and ANSIDATATYPE() built-in functi ons, which depend on your Windows language driver to decide which char acters are alphabetic, upper case, and lowercase.

Ÿ The handli ng done by SET INTER NA TIONAL assumes that the charac ter s you are working with are in the ANSI charac ter set, and it would not yield the expected results for text that is in the OEM charac ter set. SET INTERNA TIONAL there fore has no effect if the cur rent screen font is an OEM font; regard less of the actual value of SET INTER NA TIONAL, interna ti onal case and sort proces sing is bypassed in this sit u a tion.

See also User’s Guide Section 3.8, “International Support”

212 Chapter 4. The SET Command SET KEYSTYLE

Format [Set] KEYSTYLE enter [home delete backspace alt]

where each value can be either

Standard|AD Justed KEDIT default: STANDARD STANDARD STANDARD STANDARD STANDARD Level: Global Dialog box: Options SET Com mand, Options Interface Save Set tings handli ng: Savable

Description The default behavior for many keys is very dif ferent when INTERF ACE CUA is in effect than when INTER FACE CLASSIC is in effect. Users of text mode KEDIT who switch to KEDIT for Windows often want to use INTERF ACE CUA so that KEDIT will act as much as pos si ble like other Win dows appli ca tions. But some times they are not com fortable with the new behavior of a few keys that are frequentl y used in text mode KEDIT. SET KEYSTYLE lets you change the default behavior of some of the keys that text mode KEDIT users have found hardest to get used to.

There are five keys whose behavior you can adjust. For each of the five keys, you can specify that, when INTER FACE CUA is in effect, their behavior is STAN DARD (that is, they have the standard CUA behavior; this is the default for all five keys) or that their behavior is ADJUSTED (in which case they behave more like they would in text mode KEDIT). SET KEYSTYLE only makes a dif ference when INTER FACE CUA is in effect; when INTER FACE CLAS SIC is in effect, all five of the keys have text mode com pati ble behavior , regardles s of the value of the KEYSTYLE option.

1. The first oper and control s the behav ior of the Enter key. Its STANDARD be havior when the cur sor is in the file area and IN TER FACE CUA is in effect is to in sert a new line follow ing the charac ter at the cursor posi ti on. The ADJUSTE D behav ior of the Enter key when the cursor is in the file area is to move the cursor to the left mar gin column of the next line.

2. The second oper and control s the Home key. Its STANDARD be havior is to move the cursor to the start of the line that it is on. Its ADJUSTE D behav ior is to move the cursor to the com mand line and also to exe cute any pending pre fix commands.

3. The third oper and control s the Delet e key. Its STANDARD be havior when the s

cursor is at the end of a line is to join the text from the follow ing line to the cursor n o i

posi ti on. Its ADJUSTE D behav ior is to do nothing when the cursor is at the end of t a line. p O

T

4. The fourth oper and control s the Backspac e key. Its STANDARD be havior when E the cur sor is at the start of a line is to join the text of that line to the end of the pre - S ceding line. Its AD JUSTED behav ior is to do nothing when the cursor is at the start of a line.

SET KEYSTYLE 213 5. The fifth oper and control s the Alt key, when it is pressed alone and not in com bina - tion with any other key. Its STANDARD be havior is to acti vate the menu bar at the top of KEDIT’s frame win dow. Its ADJUSTE D behav ior is to do nothing.

Notes · When you update the setti ngs in the secti on of the Opti ons Inter face dia log box la- beled Adjust CUA Key board Behav ior , you are ac tuall y updat ing the value of the KEYSTYLE option.

· The de fault key defi ni ti ons for the five keys involved check the value of the KEYSTYLE opti on and act ac cordingl y. If you supply your own defi ni ti ons for these keys, SET KEYSTYLE will have no ef fect on how they behave unles s you check the value of KEYSTYLE within your re placem ent key definitions.

· SET KEYSTYLE is provided as an easy way to tailor the behav ior of the keys that most often cause problem s for users of text mode KEDIT who switch to KEDIT for Windows. You can do much more exten sive tai loring of these keys, or of any other KEDIT keys, by us ing KEDIT’s macro language to replac e KEDIT’s defaul t key def i ni tions with def i ni tions of your own.

See also SET INTER FACE, SET MARKSTYLE

Examples SET KEYSTYLE AD JUSTED AD JUSTED STANDARD STAN DARD STAN DARD Set the Enter and Home keys to have their ADJUSTED behavior , with the Enter key moving to the left mar gin col umn of the next line and the Home key moving to the com - mand line and proces sing any pending pre fix com mands. Set the Delete, Backspac e, and Alt keys to have their standard CUA behavior.

SET LASTOP

Format [Set] LASTOP commandname text

KEDIT default: Unde fined

Level: Global

Dialog box: None

Save Set tings handli ng: Not savable

Description With SET LASTOP, most often used within macros, you can set the content s of KEDIT’s operand mem ory for a parti cu lar com mand, control ling the operands that will be used the next time the com mand is issued without any operands.

The commandname operand speci fie s the com mand whose operand mem ory you want to set, and can be one of ALter, Change, CLocate, COUnt, Find, Locate, SCHange, or TFind. Text spec ifie s the new content s of the com mand’s operand memory.

214 Chapter 4. The SET Command KEDIT ‘‘rem em bers’’ the last operands of several KEDIT com mands, so that you can reissue the same com mand again without having to type in the operands all over again. For exam ple, if you issue the CHANGE com mand with no operands, the last CHANGE com mand that you issued will be repeated. KEDIT only remem bers the operands of com mands issued directly from the KEDIT com mand line; to avoid confu sion, operands of com mands issued from within a macro are not autom ati cal ly remem bered. Edit Find, Edit Replace, and searches done from the toolbar also have no effect on the value of LASTOP.

Examples SET LASTOP LO CATE /1234/ If, when you next issue a LOCATE com mand, no operands are given, KEDIT will locate the string ‘‘1234’’.

SET LASTOP FIND 1234 Sets the operand mem ory for the FIND com mand. (The operand mem ory for the FIND com mand also affects the related FINDUP, NFIND, and NFINDUP com mands.)

SET LINEFLAG

Format [Set] LINEFLAG flagbits [target ]

where flagbits can be one or more of the fol lowing:

CHAnge|NOCHAnge NEW|NONEW TAG|NOTAG KEDIT default: NOCHANGE NONEW NOTAG

Level: File

Dialog box: Options SET Com mand (for focus line only)

Save Set tings handli ng: Not savable

Description Use the SET LINEFLAG com mand to control the values of the flag bits for lines in your file.

Associ ate d with each line in your file are three flag bits, known as the change bit, the s

new bit, and the tag bit. You can use the SET LINEFLAG com mand to set or clear one n o i

or more of these bits for the lines in the speci fie d tar get area. t p O When KEDIT ini tially reads a file in from disk, it sets all three bits off for all lines in the T

file. While you are edit ing your file, KEDIT sets the change bit for any line that is E changed, added, moved, or sorted. For any line that is added to your file, KEDIT also S sets the new bit. KEDIT sets or clears tag bits when proces sing the TAG, MORE, LESS, and SET LINEFL AG com mands.

SET LINEFLAG 215 See also TAG, SET HIGHLIGHT

Examples SET LINEFLAG TAG NOCHANGE 10 For each of the next 10 lines, beginning with the focus line, this com mand would turn the TAG bit on, turn the change bit off, and leave the new bit unaf fected.

SET LINEFLAG NONEW NOCHANGE ALL Clears the new and change bits for all lines in the file.

SET LINEND

Format [Set] LINENd ON|OFF [char]

KEDIT default: OFF #

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description You use SET LINEND to enable or disable the abil ity to enter multi ple com mands on the KEDIT comm and line. If the facility is enabled, the com mands are sep arated by the LINEND charac ter , which is ‘‘#’’ by default but can be changed. If LINEND is OFF, you can only enter one com mand at a time on the com mand line, and the LINEND char- acter has no spe cial meaning.

If LINEND is ON, the fol lowing will dupli cate the focus line and then go down four lines:

DUP#DOWN 4 If LINEND is OFF, the ‘‘#’’ would have no spe cial meaning and you would have an invalid com mand.

LINEND only affects com mands entered from the com mand line It has no effect on com mands issued from macros or on text entered into dialog boxes.

Examples LINEND ON Allow multi ple com mands on the same com mand line.

LINEND OFF Disal low multi ple com mands on the same com mand line.

216 Chapter 4. The SET Command LINEND ON % Allow multi ple com mands on the same com mand line, and set the LINEND charac ter that sep arates them to be ‘‘%’’.

SET LOCKING

Format [Set] LOCK ING ON|OFF

KEDIT default: OFF

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description Use SET LOCK ING to tell KEDIT to lock files that are added to the ring, pre venting access to these files by other users and program s.

If LOCK ING ON is in effect when you begin edit ing a file, KEDIT will attempt to lock the file. SET LOCK ING has no effect on the status of files that are already in the ring. KEDIT locks a file by keeping an open handle for the file with a sharing mode that pre - vents other program s from accessing the file; SET SHARING control s the sharing mode used.

There are three special cases where KEDIT does not lock a file, even if LOCK ING ON is in effect when you begin edit ing the file:

1. When you use the DIR com mand to create a DIR.DIR file and when you use the MAC ROS comm and to create a MACRO.KML file, the lock pro cess ing is by - passed, since these are nor mally used as tempo rary in-mem ory files.

2. When you edit files that are marked on disk as read-only, lock proces sing is also bypasse d. There is lit tle need to protec t against changes to such a file since, unles s a utilit y program is used to change its read-only at tribute, neither you nor any other user on your net work can write to it.

3. When you edit files on your A: or B: drives, KEDIT does not auto m ati cal ly lock s the files. This is because these are nor mally diskette drives, which are usu ally not n o i shared over a network, and there can someti mes be problem s if you inad ver tent ly t change diskett es in a drive that has open files. You can still use the LOCK com - p O

mand or initi aliza tion opti on to force KEDIT to lock files on your A: and B: drives. T E

KEDIT display s ‘‘Lock’’ on the status line to indi cate when you are edit ing a locked S file, dis plays ‘‘R/O’’ when you are edit ing a file whose read-only attrib ute bit is set, and display s ‘‘R/W’’ for file that is not locked and not read-only. Additi onall y, if IDLINE

SET LOCKING 217 ON is in effect, KEDIT display s an asterisk (‘‘*’’) on the ID line in front of the fileid for a locked file, and a plus sign (‘‘+’’) in front of the fileid for a read-only file.

You can override the current set ting of SET LOCKING for a parti cu lar file by using the LOCK or NOLOCK options on the KEDIT com mand that you use to begin edit ing the file. You can also use the LOCK com mand to lock a file that you have already begun to edit, and the UNLOCK com mand to unlock a file that is locked.

See also User’s Guide Chapter 12, “File Processing”, LOCK and NOLOCK initial iza tion options, LOCK, UNLOCK, SET SHARING

SET LRECL

Format [Set] LRecl n

KEDIT default: * (WIDTH value)

Level: File

Dialog box: Options SET Com mand

Save Set tings handli ng: Not savable

Description The SET LRECL (‘‘logi cal record length’’) com mand affects the length of lines written to disk during a FILE, SAVE, and PUT com mands, by the autosave facil ity, and by File Save and related menu items. SET LRECL also affects how lines are read in if EOLIN NONE is in effect.

SET LRECL * sets the log ical record length equal to the value of the WIDTH initial iza - tion option, and is the default setti ng. This default does not norm ally need to be changed.

If RECFM FIXED is in effect, all lines writ ten to disk will be n char acters long, where n is the LRECL set ting. If neces sary , KEDIT will pad shorter lines with blanks or will truncat e longer lines to the correct length when writing your file to disk.

If RECFM VARY ING is in effect, lines will be a max imum of n char acters long, and will be truncat ed if neces sary . Shorter lines will not be padded with blanks. For exam - ple, if you set LRECL to 80 and some of the lines in your file are more than 80 charac - ters long, only the first 80 charac ter s of these lines would be writ ten out. Charac ter s beyond colum n 80 would not be written out. Note that KEDIT does not give you any warnings or message s about the text that is lost.

With the pos sible excepti on of the last line of the file (which is control led by SET EOFOUT), KEDIT adds an end-of-line sequence, control led by SET EOLOUT, to each line. The end-of-line sequence is not consid ered part of the logi cal record length. With the default of EOLOUT CRLF, a car riage return-line feed pair is added to each line writ ten to disk, for a total length of n+2 bytes per line.

218 Chapter 4. The SET Command If TABSOUT ON is in effect, tab com pression is done first, and then the record length is examined.

The LRECL and RECFM set tings have no effect on how KEDIT reads your file in or how KEDIT proces ses your file while you are edit ing it; they only affect how KEDIT writes your file to disk. An excepti on to this comes when EOLIN NONE is in effect; LRECL then control s how data read from disk will be broken into lines.

Except in spe cial sit u a tions, RECFM and LRECL can be left at their default val ues and ignored. With the default setting s of RECFM VARY ING and LRECL equal to the value of the WIDTH ini tializa tion option, KEDIT will never need to pad or truncat e lines when writ ing them to disk.

See also User’s Guide Chapter 12, “File Processing”, WIDTH initial iza tion option, SET RECFM, SET TRAIL ING

SET MACROPATH

Format [Set] MACROPath ON|OFF|envvar|dirlist

KEDIT default: PATH Level: Global Dialog box: Options SET Com mand Save Set tings handli ng: Savable

Description SET MACROPATH control s the path search done by KEDIT when you want to run a macro that cannot be found in mem ory or in the current directory . It also control s the path search done by the DEFINE com mand when you load a macro or a .KML file into mem ory, by the SET TOOLBUTTON com mand when you load a bitmap file from disk, and by the SET PARSER com mand when you load a KEDIT Language Defi ni ti on file. [Set] MACROPath ON The de fault. Tells KEDIT to search for macros in each of the di rec to ries spec ified via the PATH vari able in the system envi ron m ent. [Set] MACROPath OFF KEDIT will look for macros only in mem ory and in the current direc tory . In this

specia l case, KEDIT will not do its norm al path search for macros, and also won’t s n

do its usual search of the KEDIT Mac ros, KEDIT program direc tory , and USER o i and SAM PLES sub di rec tories. t p O [Set] MACROPath envvar T

Tells KEDIT to do a path search for macros, with the list of direc to ries to search E found in the envi ron m ent variable envvar. Di rec to ries in the list are sep arated from S each other by a semico lon, in the same form at as is tra diti onall y used with the PATH= en vi ron ment variable.

SET MACROPATH 219 [Set] MACROPath dirlist Dirlist is a string with a list of semi-co lon-de limited direc to ries. It can also con tain entri es that be gin with an aster isk, to indi cat e an indi rect refer ence to an envi ron - ment vari able. ‘‘=’’ is also al lowed, caus ing a search of the di rec tory of the cur rent file. For example, SET MACROPATH C:\TEMP;E:\SOURCE;*INCLUDE;= means search the C:\TEMP and E:\SOURCE direc to ries, then the direc to ries listed in the INCLUDE envi ron m ent variable , and then the direc tory of the current file.

In order for the value of MACROPATH to affect KEDIT’s ini tial search for your pro - file, it needs to be set in an earli er KEDIT session and then saved to the Windows regis - try via the Options Save Setti ngs dia log box. You can also specify MACROPATH as a KEDIT ini tializa tion option, and if you do so its value will over ride the value in the registry.

When searching for macros, .KML files, .BMP files, and .KLD files, KEDIT pro ceeds as fol lows: If a spe cific drive and/or directory is speci fie d, KEDIT looks only there. Other wise , KEDIT looks first in the current directory , and next does a path search, as con trolled by SET MACROPATH. Finally, unless MACROPATH OFF is in effect, it looks in the “KEDIT Mac ros” subdi rec tory of your Windows Docu m ents or My Docu - ments folder, the directory from which KEDIT for Windows was loaded, and the USER and SAM PLES subdi rec tori es of that directory . The search ends suc cessfull y as soon as KEDIT finds the file it is looking for, and ends in fail ure if the file cannot be located.

As dis cussed in User’s Guide Section 10.2.3, “Storing Your Macros”, we nor mally rec- om mend that macros that you create be kept in the “KEDIT Mac ros” subdi rec tory of your Windows Docu m ents folder (which is someti mes known as the My Docu m ents folder).

See also MACROPATH initial iza tion option, MACRO, SET PATH

220 Chapter 4. The SET Command SET MARGINS

Format [Set] MAR gins left right [[+|-]parindent]

KEDIT default: 1 72 +0

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description Use SET MAR GINS to control your left and right mar gin col umns and the para graph indent colum n (the indenta ti on used for the first line of a para graph).

The MARGINS setti ng affects para graph reform atti ng by the FLOW com mand, the wordwrap facilit y, and the LEFTADJUST, RIGHTADJUST, and CENTER com mands.

For the left and right mar gins, enter the colum n num ber of the mar gin. For the para- graph indent colum n, you can enter a specif ic colum n num ber, or you can specify a pos- iti ve or nega ti ve offset from the left mar gin column.

The left mar gin must be less than or equal to the right mar gin. The right mar gin and paragraph indent colum n must be less than or equal to the trunca ti on colum n. You can spec ify the right mar gin as an aster isk (‘‘*’’); this will set the right mar gin to the trun ca - tion column.

See also User’s Guide Section 3.11, “Word Processing Facilities”

Examples MAR GINS 10 60 The left mar gin is set to 10, the right mar gin is set to 60, and the paragraph indent col- umn is unchanged.

MAR GINS 10 65 +3 The left mar gin is set to 10, the right mar gin is set to 65, and the paragraph indent col- umn is three colum ns to the right of the left mar gin col umn, at colum n 13. If you later issued the com mand

MAR GINS 5 60

the paragraph indent speci fi ca ti on would not change, and paragraphs would be s n

indented three colum ns to the right of the new left mar gin, to colum n 8. o i t p O

T E S

SET MARGINS 221 SET MARKSTYLE

Format [Set] MARKSTYLE line [box stream]

where each value can be either

PERSIS Tent|SE Lec tion KEDIT default: SELECTION SELEC TION SELEC TION

Level: Global

Dialog box: Options SET Com mand, Options Interface

Save Set tings handli ng: Savable

Description SET MARKSTYLE control s whether, when you use the mouse to mark text while INTER FACE CUA is in effect, you mark selec tions or per sis tent blocks.

SET MARKSTYLE has three operands, control ling how lines, boxes, and streams are marked. The default for all three operands is SELEC TION, meaning that selec tions are marked; the other choice is PER SISTENT , meaning that persis tent blocks are marked.

1. The first oper and control s whether dragging in the file area with Ctrl+button 1, or dragging with but ton 1 in the window mar gin or in the prefix area, marks a persis - tent line block or marks a line selection.

2. The second oper and control s whether dragging with Alt+but ton 1 in the file area marks a persis tent box block or marks a box selec tion.

3. The third oper and control s whether dragging with but ton 1 in the file area marks a per sis tent stream block or marks a stream se lection.

Notes · When you update the setti ngs in the secti on of the Opti ons Inter face dia log box la- beled Adjust CUA Mouse Behav ior , you are ac tuall y updat ing the value of the MARKSTYLE option.

· SET MARKSTYLE only af fects blocks or se lec tions marked with the mouse and does not af fect blocks or selec tions marked from the keyboard. The defaul t def ini - tions for Shift+cursor pad key, which are the key com bina ti ons used in CUA-com - pat i ble ap pli ca tions to mark se lec tions, al ways mark se lec tions and never mark per sis tent blocks. The de fault def ini tions for Alt+L, Alt+B, and Alt+Z al ways mark persis tent line, box, and stream blocks.

· The de fault macros that handle mouse acti ons check the value of the MARKSTYLE opti on and act ac cordingl y. If you supply your own defi ni ti ons for these macros, SET MARKSTYLE will have no ef fect on how they behave unles s you check the value of MARKSTYLE within your re placem ent definitions.

222 Chapter 4. The SET Command See also SET KEYSTYLE

Examples SET MARKSTYLE PERSIS TENT PERSIS TENT SELEC TION Sets the mouse to mark lines and boxes as persis tent blocks, but to mark stream selec- tions when dragging with mouse but ton 1.

SET MONITOR

Format [Set] MONi tor WINDOWS|COLOR|MONO

KEDIT default: WIN DOWS

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description Use the SET MONI T OR com mand to control certai n aspects of how KEDIT for Win- dows handles your display .

With MON IT OR WIN DOWS, the norm al KEDIT for Windows handling of your dis- play applies, the norm al KEDIT for Windows col ors are used by default on your dis- play, and the SET COLOR com mand works as described in this document.

MONI T OR COLOR and MONI T OR MONO are provided only for com pati bil it y with text mode KEDIT, and cause KEDIT’s dis play handli ng, default colors, and SET COLOR handli ng to work as they do in text mode KEDIT. In most sit ua ti ons we recommend that you leave the default of MONI T OR WINDOWS in effect; MONI T OR COLOR and MONI T OR MONO may not be supporte d in future versions of KEDIT for Windows.

With MONI T OR COLOR, KEDIT uses the default colors used on text mode color dis- plays. With MON I TOR MONO, KEDIT uses the colors it used with the orig inal IBM s

mono chrome display. n o i t

When ever the SET MON I TOR comm and is issued, KEDIT auto mati cally resets all p O colors to the proper defaults for the type of display —WIN DOWS, COLOR, or T

MONO—that you spec ified . E S

See also SET COLOR

SET MONITOR 223 SET MOUSEBEEP

Format [Set] MOUSEBEEP ON|OFF

KEDIT default: ON

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET MOUSEBEEP control s whether KEDIT sounds the speaker when mouse errors within a doc um ent window , such as a mouse click at an invalid loca tion in the file area, are detected, and when the SOS MOUSEBEEP comm and is executed. Note that many mouse related errors, such as invalid mouse clicks while a dialog box is dis played, are handled directly by Windows and are not affected by SET MOUSEBEEP.

See also SET BEEP, SOS MOUSEBEEP

SET MSGLINE

Format [Set] MSGLine ON line [n] [Over lay]

KEDIT default: ON 1 5 OVERLA Y Level: View Dialog box: Options SET Com mand Save Set tings handli ng: Savable

Description Use SET MSGLINE to control where in your doc um ent window message s gener ate d by KEDIT will be dis played. You can specify what line of the docu m ent window will be the first line used for mes- sage display , the num ber of lines to use for message display , and whether the first mes- sage line should be reserved for message s or should OVERLA Y a line norm ally used to display a line of your file. The first line used for message s can be speci fie d rel ati ve to the top of the doc um ent window , the middle of the doc um ent window , or the bottom of the docu m ent window; see SET CURLINE for a discus sion of how to do this. You can also specify the num ber of lines to use for message display . In most sit ua ti ons, KEDIT only needs to display one message at a time. Com mands like QUERY can sometim es gen er ate sev eral messages, and a macro can issue sev eral messages or cause sev eral error messages to be gen er ated. If KEDIT has more messages to display than

224 Chapter 4. The SET Command you have allowed for, KEDIT uses a specia l pop-up window for message display . Oth- er wise, KEDIT dis plays its mes sages in the area you specify with SET MSGLINE.

Finally, you can specify that the first message line is norm ally to be used for a line of your file, and that when there is a message to dis play, it will OVER LAY a line of your file on the display . (Message lines other than the first are always dis played in overlay mode.)

Even though you can specify a message area that overlaps the com mand line, KEDIT will never overlay the com mand line with a message . Instead, it will skip over the com - mand line and put the message on the line below or above the com mand line.

Examples SET MSGLINE ON 2 5 OVERLAY This is the default MSGLINE set ting, spec ify ing that mes sages will dis play start ing on line 2 of the docu m ent window , with a maxi m um of five message s dis played. When no message is display ed in line 2, line 2 will be used to display a line of your file.

SET MSGLINE ON -2 5 OVER LAY The second-to-t he-last line of your window will be used for message s. If KEDIT needs to display more than one message , the third-to-last line, etc., up to a total of five lines, will be used.

SET MSGMODE

Format [Set] MSGMode ON|OFF

KEDIT default: ON

Level: View

Dialog box: None

Save Set tings handli ng: Not savable

Description With MSGMODE ON, KEDIT pro cesses messages (includ ing error messages ) in the norm al way, display ing them on your screen and saving the text of the last message so

that QUERY LASTMSG can retrieve it. With MSGMODE OFF, KEDIT does not dis- s

play message s and error message s on your screen, although the text of the last message n o i

is still saved for QUERY LASTMSG. t p O MSGMODE OFF is intended for use in spe cial ized sit u a tions within mac ros, which T

sometim es need to issue comm ands that gen er ate mes sages or error messages that need E not be display ed. For exam ple, you may want to issue a CHANGE com mand from S within a macro, but may not want KEDIT to display its message indi cat ing how many strings were changed.

SET MSGMODE 225 The NOMSG com mand provides a better soluti on to this problem , and should norm ally be used in pref er ence to SET MSGMODE OFF.

See also NOMSG ini tial iza tion option, NOMSG

SET NEWLINES

Format [Set] NEWLines SAMELine|BE LOW|BELOWCurr

KEDIT default: SAMELINE

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description When you add a new line to your file with the SOS LINEADD com mand (norm ally assigned to functi on key F2) or because WORDWRAP is ON and you go beyond the right mar gin, KEDIT norm ally places the newly added line in the line of the docu m ent window in which the cursor is located, scrolling the text above the new line up to make room for it. This is what happens with NEWLINES SAMELINE, the default.

With NEWLINES BELOW, the new line is placed one line below the cursor line, scrolling the text below the new line down to make room for it. When the cursor is on the bot tom line of the docu m ent window , KEDIT can’t add a new line below the cursor line, so the new line is added at the bottom of the docu m ent window , and text above the new line scrolls up to make room for it.

NEWLINES BELOWCURR is like NEWLINES BELOW, in that new lines are added below the cur sor line. The dif fer ence is that, with NEWLINES BELOWCURR, when you are at the bot tom of the docu m ent window and add a new line, KEDIT scrolls the window so that the new line is posi tioned at the current line locati on, and future lines can then be added below the current line.

226 Chapter 4. The SET Command SET NOVALUE

Format [Set] NOVALUE ON|OFF

KEDIT default: OFF

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET NOVALUE provides a debugging aid for devel opers of KEDIT macros. With NOVALUE ON, use of uninitialized vari ables in a KEXX macro will cause an error, much as SIGNAL ON NOVALUE does. This brings to your attenti on cases where you have for gotten to use quotes around literal values in macros.

You can get much the same effect by using SIGNAL ON NOVALUE within your KEXX macros to trap ref er ences to uninitialized vari ables. An advan tage of SET NOVALUE ON is that it catches all uses of uninitialized vari ables in any macro that you run, without having to change the source of the macro. A disad van tage of SET NOVALUE ON is that, since it affects all macro s that you run, it may trap harmless ref - erence s to uninitialized vari ables in exist ing macros and in macros that you get from other KEDIT users.

SET NUMBER

Format [Set] NUM ber ON|OFF

KEDIT default: OFF

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable s n o i

Description If NUMBER ON is in effect, the line number of each line appears in the pre fix area of t the line. Line num bers are not display ed if PRE FIX OFF is in effect. p O

T

The line num bers are conti nu all y updated as you add lines to your file or delete them. E The line num bers are not part of your file; they are merely display ed on the screen for S your conve nienc e. The line num ber associ ate d with a line is not written to disk when the file is saved.

SET NUMBER 227 By default, the pre fix area is 5 char acters wide, and can dis play line numbers up to 99999. To display line num bers above this value, you can use SET PREFIXWIDTH to make the prefix area wider.

See also SET PREFIX, SET PREFIXWIDTH

SET OFPW

Format [Set] OFPW ON|OFF

KEDIT default: ON

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET OFPW determ ines whether KEDIT operate s in ‘‘one-file-per-window’ ’ mode.

KEDIT is a Windows MDI (‘‘Mul ti ple Docu ment Inter face’’) applica ti on. You can edit multi ple files with KEDIT and dis play them within mul tiple win dows. These win dows are known as ’’docu m ent windows’ ’. The doc um ent windows are all display ed within a larger window , known as the ‘‘frame window’’.

When you open a new file, most Windows MDI appli cati ons cre ate a new doc um ent window to display the file. If you want to display the file in multi ple windows, you can use the Window New menu item to create an addi tional doc um ent window display ing the same file. When you close a file, all docu m ent windows dis play ing that file are destroyed. When you close a docu m ent window , that window is destroyed and, if it is the only doc u ment win dow dis play ing a file, the file itself is also closed.

With the default of OFPW ON, which is recom mended for most KEDIT users, this is also how KEDIT behaves. It is referred to as one-file-per-window mode because once a docu m ent window is create d and a file display ed in that window , that one file is the only file that will ever be dis played in that win dow. Mov ing to a dif fer ent file (for exam ple, by using the Next File or Pre vious File toolbar buttons) involves moving to a dif fer ent document window.

OFPW OFF is avail able mainly for compat ibil ity with text mode ver sions of KEDIT. With OFPW OFF, KEDIT for Windows behaves more like text mode KEDIT, where windows are not tied to parti cu lar files. Instead, any docu m ent window can display any file. When a new file is added to the ring, the new file is dis played in the current win- dow. The old file remains in the ring, but may not be visi ble in any docu m ent window . The Next File and Previ ous File toolbar buttons do not move you to a dif ferent doc u - ment window , but instead dis play dif ferent files in the same window.

228 Chapter 4. The SET Command When you close a file with OFPW OFF in effect, the docu m ent windows in which it was display ed remain, display ing whatever file precede d the removed file in the ring. When you close a docu m ent window with OFPW OFF, the file that was display ed in that window remains in the ring. Excepti ons to these general rules come when you close the last file in the ring, in which case all docu m ent windows are also closed, and when you close the last docu m ent window , in which case all files in the ring are closed.

See also User’s Guide Section 3.5, “Editing Multiple Files”

SET OPENFILTER

Format [Set] OPENFilter /text1/filter1/ ...

KEDIT default: See below

Level: Global

Dialog box: None

Save Set tings handli ng: Not savable

Description SET OPENFILTER con trols the file fil ters dis played at the bot tom of the File Open dialog box. These in turn control the files in the dialog box’s default list of avail able files.

SET OPENFILTER takes one or more pairs of strings as its operands, with one pair of strings for each entry in the list of file filters. The first string of each pair is the string that is actuall y display ed when you use the File Open dia log box. The second string of each pair is the filter , con sist ing of a DOS fileid spec ifi ca tion (pos si bly includ ing wild - card char ac ters) or of mul ti ple DOS fileid spec i fi ca tions sep a rated by semi co lons (‘‘;’’), used by File Open to build the list of matching files.

The strings used with the SET OPENFILTER command are all delimited with slash (‘‘/’’) char acters, or with some other delim iter char acter not appear ing in the strings. s

The default value for SET OPENFILTER (which is really all one long line, though it is n o

split here into mul tiple lines) is i t p O

SET OPENFILTER /All files (*.*)/*.*/

Text Files (*.TXT)/*.txt/ T C Files (*.C;*.CPP;*.H)/*.c;*.cpp;*.h/ E KEDIT Mac ros (*.KEX;*.KML)/*.kex;*.kml/ S

This spec ifies four fil ters. They are dis played as

SET OPENFILTER 229 All files (*.*) Text Files (*.TXT) C Files (*.C;*.CPP;*.H) KEDIT Mac ros (*.KEX;*.KML) with *.*, *.txt, etc. used by File Open to build the list of available files, depending on which file fil ter is selected.

SET PARSER

Format [Set] PARSER parser fileid

KEDIT default: See the table below

Level: Global

Dialog box: None

Save Set tings handli ng: Not savable

Description The syntax color ing facil ity depends on language-s pecif ic param eter files, known as KLD (KEDIT Language Defi ni ti on) files, to determ ine which text to display as com - ments, strings, keywords, etc. Use the SET PARSER com mand to define a syntax col- oring parser and load its associ ate d KLD file.

Use the parser operand to specify the name of the parser you want to define.

The fileid operand speci fie s a file, with a default extension of .KLD, contai ning your language defi ni ti on. The for mat of these KEDIT Language Defi ni ti on files is dis cussed in Chapter 8, “KEDIT Language Definition Files”. KEDIT searches for the .KLD file in the same direc to ries it uses when search ing for macro files, as con trolled by SET MACROPATH.

For exam ple, if you were work ing with a hypo thet ical language called LANG and you had described the language in a KEDIT Language Defi ni ti on file called LANGDEF.KLD, you could define a parser called LANG with the command

SET PARSER LANG LANGDEF.KLD After issuing the SET PARSER com mand, you could then issue the com mand

SET COL OR ING ON LANG to use this parser to control syntax color ing for the current file.

If files in your language always had an extension of, for exam ple, .LNG, you could use the SET AUTOCOLOR com mand to tell KEDIT to always use the LANG parser for .LNG files:

230 Chapter 4. The SET Command SET AUTOCOLOR .LNG LANG SET PARSER com mands are typi cal ly execute d from your KEDIT profil e when KEDIT is ini tially loaded. For example:

* if first profile ex e cu tion in a session, * setup the LANG parser and then * cause all .LNG files to be colored us ing the LANG parser if ini tial() then do 'set parser lang langdef.kld' 'set autocolor .lng lang' end Several language defi ni ti ons are built into KEDIT, and when KEDIT is loaded it auto - mati cally issues SET PARSER commands that use these lan guage def ini tions to set up its default parsers. To disti nguish these internal language defi ni ti on files from actual disk files, KEDIT uses an aster isk as the first char acter of their names. For example, the command

SET PARSER C *C.KLD tells KEDIT to use *C.KLD as the Lan guage Def ini tion File asso ci ated with the C parser. The aster isk in the name tells KEDIT to use the spe cial file *C.KLD, which is built into KEDIT, and not to look for the file on disk.

The fol low ing parser def ini tions are auto mati cally put into effect at KEDIT ini tial iza tion:

Parser File BASIC *BASIC.KLD C *C.KLD COBOL *COBOL.KLD CSHARP *CSHARP.KLD FORTRAN *FORTRAN.KLD HTML *HTML.KLD JAVA * JAVA . K LD INI *INI.KLD KLD *KLD.KLD PASCAL *PASCAL.KLD REXX *REXX.KLD s

RESOURCE *RESOURCE.KLD n o i XBASE *XBASE.KLD t p O

NULL *NULL.KLD T E

Copies of these inter nal files are included in the SAM PLES subdi rec tory of the main S KEDITW directory . If you mod ify one of these copies you should save it in a dif ferent loca tion (nor mally the “KEDIT Mac ros” sub direc tory of your Windows Docu ments

SET PARSER 231 folder, which is someti mes known as the My Docu m ents folder) and load it by issuing a SET PARSER com mand referring to the modified file.

If you want your own KLD file to be used in place of one of KEDIT’s built-in KLD files, you can use a SET PARSER comm and that speci fies the appro pri ate parser name along with your KLD file. For exam ple

SET PARSER C NEWC.KLD would use your NEWC.KLD file in place of the built-in *C.KLD file.

See also SET AUTOCOLOR, SET COLOR ING , SET ECOLOR, Chapter 8, “KEDIT Language Definition Files”

SET PATH

Format [Set] PATH ON|OFF|envvar|dirlist

KEDIT default: *PATH;*INCLUDE;=

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET PATH control s the path search done by KEDIT when you use the KEDIT com - mand or the GET com mand and specify a file’s name and extension but no drive specifier or path and the file that you spec ify cannot be found in the current directory . [Set] PATH ON KEDIT looks for your file in each of the direc to rie s spec ifie d via the PATH envi - ron ment vari able. [Set] PATH OFF KEDIT will look for your file only in the current direc tory . In this specia l case, KEDIT will not do its norm al path search for your file, and also won’t do its usual search of the KEDIT Mac ros, KEDIT program direc tory , and USER and SAM- PLES sub di rec tories. [Set] PATH envvar Tells KEDIT to do a path search for files, with the list of di recto rie s to search found in the en vi ron ment vari able envvar. Di rec to ries in the list are sep arated from each other by a semico lon, in the same for mat as is tra di tion ally used with the PATH= en vi ron ment variable. SET PATH dirlist Dirlist is a string with a list of semi-co lon-de limited direc to ries. It can also con tain entri es that be gin with an aster isk, to indi cat e an indi rect refer ence to an envi ron -

232 Chapter 4. The SET Command ment vari able. ‘‘=’’ is also al lowed, caus ing a search of the di rec tory of the cur rent file. For example,

SET PATH C:\TEMP;E:\SOURCE;*PATH;= means search the C:\TEMP and E:\SOURCE direc to ries, then the direc to ries listed in the PATH envi ron m ent variable , and then the direc tory of the current file.

In order for the value of PATH to affect KEDIT’s search for files added to the ring at the start of a KEDIT session, it needs to be set in an earli er KEDIT session and then saved to the Windows regis try via the Options Save Setti ngs dia log box. You can also specify PATH as a KEDIT ini tializa tion option, and if you do so its value will over ride the value in the registry.

When searching for files to be edited, KEDIT procee ds as follows: If a spe cific drive and/or directory is speci fie d, KEDIT looks only there. Other wise , KEDIT looks first in the current directory , then does a path search control led by SET PATH. Finally, it looks in the “KEDIT Mac ros” subdi rec tory of your Windows Docu m ents or My Docu m ents folder, and in the directory from which KEDIT was loaded and in the USER and SAMPLES subdi rec tori es of that directory . The search ends suc cessfull y as soon as KEDIT finds the file it is looking for; if the file cannot be located, KEDIT assumes you want to edit a new file with the spec ified name in the current directory.

The default value of *PATH;*INCLUDE;= tells KEDIT that its path search should involve looking in each of the directo rie s listed in the PATH envi ronm ent variable and the INCLUDE envi ronm ent variable and then in the directory of the current file.

See also PATH initial iza tion option, SET MACROPATH

SET PCOLOR

Format [Set] PCOLOR a fore ground [ON background ] [Set] PCOLOR a DE FAULT

KEDIT default: See the table below

Level: File

Dialog box: Options SET Com mand s

Save Set tings handli ng: Savable n o i t Description SET PCOLOR (“printer color’’) control s the colors used by KEDIT to print syntax- col- p O ored text when PRINTER WINDOWS and PRINTCOLORING ON are in effect and T

you are printing to a color printer. E S The default SET PCOLOR values, given in the table below, are the same as the default values, control led by SET ECOLOR, that KEDIT uses to display syntax- colored text

SET PCOLOR 233 on your screen. But they can be control led sepa rat ely so that you have the option of using dif ferent color schemes on your printer and on your screen. [Set] PCOLOR a fore ground [ON back ground] Specify the em phasis type involved (in the range A—Z or 1—9), followed by the foreground color to use and, opti onall y, the background color. If you do not spec - ify a background color, a background of white is used. You can use an aster isk (‘‘*’’) in stead of a letter as the empha sis type to in di cate that you want all em pha sis types to use the same color. The foreground and background col ors that you can choose from are the same as the colors used with the SET COLOR command. [Set] PCOLOR a DEFAULT If you have made changes to a printer color, you can tell KEDIT for Windows to switch back to using the defaul t color. A table of KEDIT for Windows’ defaul t printer col ors is given be low.

Note Even when syntax color ing is active, some of the text in your file may not be given an emphasis color. For exam ple, most parsers do not give a specia l color to ordina ry vari- ables. KEDIT uses the color control led by SET PCOLOR V, which is norm ally black on white, to print such text.

See also SET ECOLOR, SET PRINTCOLORING

Examples PCOLOR A RED Emphasis type A (used for com ments) is printed in red.

PCOLOR * DE FAULT All printer color s are reset to their default val ues.

Default Letter Language Element Printer Color A dark green comments B dark cyan strings C dark red numbers D blue keywords E dark red labels F dark red preprocessor keywords G red header lines H black extra right paren, matchable keyword I blue level 1 paren J blue level 1 matchable keywords K dark red level 1 matchable preprocessor keywords L dark green level 2 paren, matchable keyword

234 Chapter 4. The SET Command Default Letter Language Element Printer Color M red level 3 paren, matchable keyword N dark cyan level 4 paren, matchable keyword O dark magenta level 5 paren, matchable keyword P gray level 6 paren, matchable keyword Q dark blue level 7 paren, matchable keyword R magenta level 8 or higher paren, matchable keyword S magenta incomplete strings T blue HTML markup tags U red HTML character/entity references V black unemphasised text (see note above) W—Z black not currently used 1 red alternate keyword color 1 2 dark blue alternate keyword color 2 3 dark red alternate keyword color 3 4 dark magenta alternate keyword color 4 5 dark green alternate keyword color 5 6 dark cyan alternate keyword color 6 7 red alternate keyword color 7 8 black alternate keyword color 8 9 blue alternate keyword color 9

SET POINT

Format [Set] Point .name [OFF]

KEDIT default: No named lines s

Level: File n o i t

Dialog box: Actions Bookm ark p O

Save Set tings handli ng: Not savable T E S Description Use the SET POINT com mand to give a name to the focus line. The line can then be referred to in target spec ifi cations by that name. The name that you specify must be

SET POINT 235 preceded by a period (‘‘.’’). If name is already in use for some line of the current file, it is first removed from that line.

Use the OFF operand to remove a line name. If name is assigned to some line in the cur- rent file, the line name is removed. Oth er wise, an error occurs.

A line can have more than one name, but no name can be used for more than one line in the cur rent file. Line names are asso ciated with lines of your file, but are not part of your file and are not saved when your file is writ ten to disk. The line name remains with a line if you change the line or if you use the MOVE com mand to move the line else- where in the cur rent file.

By default, Alt+1, Alt+2, and Alt+3 assign the names Bookmark1, Bookmark2, and Bookmark3, respec tively, to the focus line, while Alt+4, Alt+5, and Alt+6 issue LOCATE com mands that return you to these lines. The Set Bookm ark but ton on the bottom toolbar also assigns BOOKMARK1 to the focus line, and the Go to Bookm ark button returns to the line named Bookmark1.

You can also use the Actions Bookm ark dialog box to work with line names.

Examples POINT .ABC Gives the name ABC to the focus line.

POINT .ABC OFF Removes the name ABC from what ever line of the cur rent file it is assigned to.

.XYZ Makes the line named XYZ become the focus line.

SET PREFIX

Format [Set] PRE fix ON|OFF|Nulls [Left|Right] [Set] PRE fix Syn onym newname oldname

KEDIT default: OFF LEFT

Level: View

Dialog box: Options SET Com mand (first form of com mand only)

Save Set tings handli ng: Savable (first form of com mand only)

Description The first form of SET PREFIX controls whether KEDIT’s prefix area is display ed and, if so, whether it is placed at the left or right side of the docu m ent window . All prefix comm ands are entered in the pre fix area. The prefix area is nor mally displayed as five

236 Chapter 4. The SET Command equal signs next to each line in the file area. With NUM BER ON, the equal signs are not dis played; line num bers of each line in the file area appear instead.

With PREFIX NULLS, if NUMBER OFF is in effect KEDIT display s the pre fix area as five blanks rather than as five equal signs. If NUMBER ON is in effect, PRE FIX NULLS causes leading zeroes in line num bers to be dis played as blanks.

The second form of the SET PRE FIX com mand allows you to define synonym s for pre- fix com mands. This lets you refer to prefix com mands using names of your own choos- ing. Newname is the new name by which you want to refer to the prefix com mand oldname. Newname is a string of one to five non-numeric charac ter s.

For exam ple,

PRE FIX SYN ONYM A F PRE FIX SYN ONYM B P will make ‘‘A’’ act like the ‘‘F’’ pre fix comm and and ‘‘B’’ act like the ‘‘P’’ pre fix com- mand. (You could then think of ‘‘A’’ and ‘‘B’’ as ‘‘After ’’ and ‘‘Before’ ’, instead of ‘‘F’’ and ‘‘P’’ as ‘‘Follow ing’ ’ and ‘‘Preced ing’ ’.)

You can have up to fiftee n prefix synonym s in effect. Prefix synonym s are global, affect ing all files in the ring.

See also User’s Guide Chapter 7, “The Prefix Area”, LPREFIX, SET NUMBER, SET PREFIXWIDTH

Example PRE FIX ON RIGHT Causes the pre fix area to be dis played to the right of the file area.

Prefix Here is a sum mary of the avail able pre fix comm ands, which are dis cussed in more command detail in User’s Guide Chapter 7, “The Prefix Area”: summary A Add a blank line to your file C In di cate a line that is to be Cop ied D De lete a line from your file F Indi cat e the line Fol lowing which text will be moved or copied. (Used in conjunc ti on with ‘‘C’’ or ‘‘M’’) I Insert a blank line into your file—same as ‘‘A’’ L Low er case a line s

M In di cate a line that is to be Moved n o i

P Indi cat e the line Pre ceding which text will be moved or copied. (Used t

in conjunc ti on with ‘‘C’’ or ‘‘M’’) p O

S Show exclude d lines T E

U Up per case a line S X eX clude a line / In di cate a line that is to be come the new cur rent line

SET PREFIX 237 " In di cate a line that is to be du pli cated < In di cate a line that is to be shifted left 1 column > In di cate a line that is to be shifted right 1 column SCALE Spec ify that the scale line is to be dis played in this line TABL Spec ify that the tab line is to be dis played in this line .name Give a line a name nA or An Add n lines nC or Cn Copy n lines nD or Dn De lete n lines nI or In In sert n lines or Low er case n lines nS or Sn Show first n lines repre sent ed by shadow line nU or Un Up per case n lines S-n Show last n lines repre sent ed by shadow line nX or Xn eX clude n lines n" or "n Du pli cate a line n times n< or or >n Shift a line n colum ns to the right CC Placed in the prefix area of the first and last lines to be Copied DD Placed in the pre fix area of the first and last lines to be De leted LL Placed in the pre fix area of the first and last lines to be Lowercased MM Placed in the prefix area of the first and last lines to be Moved UU Placed in the pre fix area of the first and last lines to be Uppercased XX Placed in the pre fix area of the first and last lines to be eX cluded << Placed in the pre fix area of the first and last lines to be shifted left >> Placed in the prefix area of the first and last lines to be shifted right "" Placed in the pre fix area of the first and last lines to be du pli cated n<< or <> or >>n Indi cat es that a group of lines is to be shifted n colum ns to the right n"" or ""n Indi cat es that a group of lines is to be dupli cated n times

238 Chapter 4. The SET Command SET PREFIXWIDTH

Format [Set] PREFIXWIDTH n

KEDIT default::5 Level: File Dialog box: Options SET Com mand Save Set tings handli ng: Savable

Description SET PREFIXWIDTH control s the width of the prefix area, which can be a value in the range 5 through 9.

This option is useful if you use NUMBER ON in connec ti on with PRE FIX ON or PREFIX NULLS to display line num bers within the files you are edit ing and you want to be able to display line num bers larger than 99999, which is the largest that will fit in the default 5-char acter width of the prefix area.

See also SET PREFIX, SET NUMBER

SET PRINTCOLORING

Format [Set] PRINTCOLORing ON|OFF

KEDIT default: ON

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description With the default of PRINTCOLORING ON, syn tax-col ored text is printed in color s n

when PRINTER WIN DOWS is in effect and you print to a color printer. o i t p

With PRINTCOLORING OFF, KEDIT prints all text in black and white. O

T

The colors KEDIT uses to print syntax- colored text are control led by SET PCOLOR. E S

See also SET PCOLOR, SET PRINTER

SET PRINTCOLORING 239 SET PRINTER

Format [Set] PRINTER WINdows|device CLOSE|NOCLOSE FORM|NOFORM CONVert|NOCONVert

KEDIT default: WIN DOWS CLOSE FORM CONVER T

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET PRINTER determ ines whether KEDIT uses your Windows printer driver for printer out put or bypasses the Windows printer driver and sends out put directly to your printer. SET PRINTER also control s some other details of KEDIT’s printer handli ng, such as whether your printer is autom ati cal ly closed after each print oper ati on. [Set] PRINTER WINdows This is the defaul t and is the recom mended setti ng for most us ers. KEDIT uses your Windows printer driver to send out put to your printer. If you have multi ple Windows print ers, you can use the File Print Setup di alog box (which is also acces - sible from the Setup but ton of the File Print dia log box) to choose the printer that KEDIT will use. The File Print di alog box’s Font and Mar gins but tons let you con- trol the font that KEDIT uses for printer out put and the mar gins that KEDIT uses on the page. [Set] PRINTER de vice You can by pass the Windows printer and send output di rectly to LPT1:, LPT2:, LPT3:, COM1:, or COM2. This is use ful primar ily if you have files that con tain device -depend ent printer es cape codes, which are not handled properl y by the device-independent printer handli ng used when PRINTER WINDOWS is in effec t.

KEDIT has no de vice-specif ic printer support. When you send out put di rectly to a device , KEDIT acces ses your printer through standard system file handles and has no spe cial fa cil i ties for re cov ery from printer er rors. For cor rect op er a tion, your printer must be attac hed to the speci fie d port, turned on, and properl y ini ti alize d (possi bly by using the system ’s MODE com mand before you enter KEDIT). KEDIT does not control the fonts or mar gins used on your printer; these are determined by defaul ts built into the printer or by printer es cape codes that you imbed in your files. CLOSE|NOCLOSE When an appli cati on like KEDIT sends out put through the Windows Print Man- ager or to a net work printer, your out put is not actu all y printed unti l the appli cati on ‘‘closes’’ the print file, let ting the Print Man ager know that all out put is com plete and ready to go. By defaul t, SET PRINTER’s CLOSE oper and is in ef fect and KEDIT au to mati cally closes the printer af ter each use of the PRINT comm and. This is alm ost alway s desir able behav ior; the excep ti on com es when you want to

240 Chapter 4. The SET Command use multi ple PRINT com mands for several smaller amounts of data that you would like to print togethe r as a unit. This case can be handled by using SET PRINTER’s NOCLOSE option. FORM|NOFORM The FORM|NOFORM opti on control s whether, when KEDIT is printing to a de- vice (that is, when PRINTER LPT1:, etc. is in ef fect), KEDIT au to mati cally sends a form feed char acter , forcing a page eject, when ever the printer is closed. With the default of FORM, KEDIT does send a form feed charac ter . With NOFORM , form - feed char acters are not au to mati cally sent; if you are us ing a spooler or net work printer, your sys tem may au to mati cally eject the page anyway , or you may need to use the Eject or Form Feed button on your printer.

When PRINTER WIN DOWS is in ef fect, KEDIT always sends out put to the printer a page at a time and the FORM|NOFORM opti on has no ef fect. CON VERT|NOCONVERT Files that you edit with KEDIT are nor mally dis played us ing ei ther the ANSI or the OEM char ac ter set. Simi larly , your printer is nor mally setup to print text in the ANSI char acter set or in the OEM char acter set. In cor rect out put can be gen er ated if the char acter set used by your file does not match the char acter set used by your printer.

With SET PRINTER’s CON VERT op tion, which is the de fault, KEDIT attempts to com pensat e for this by auto m ati cal ly convert ing the data that it sends to your printer from OEM to ANSI if you are using an OEM charac ter set for your file and an ANSI charac ter set for your printer. Sim ilarl y, KEDIT converts from ANSI to OEM dur ing printing if you are using an ANSI font for your file and an OEM font for your printer, or if you are us ing an ANSI font for your file and PRINTER WIN- DOWS is not in ef fect (since in most cases the de fault fonts built into printers use the OEM charac ter set). Use the NOCONVERT opti on to pre vent this conversion from taking place.

Notes The printer is always closed, and a page eject is always done, when you print your file by using the File Print dialog box or the Print but ton on the toolbar, regardles s of which of SET PRINTER’s CLOSE|NOCLOSE or FORM|NOFORM options are in effect.

See also PRINT, SET PRINTCOLORING

Examples PRINTER WIN DOWS CLOSE FORM CONVERT

This is the default; out put is sent through the Windows Print Manager , with output s n

auto mati cally sent to the printer after each PRINT comm and. o i t PRINTER LPT1: NOCLOSE NOFORM CONVERT p O

T

This set ting is closest to the default handli ng in the text mode version of KEDIT. Out- E put is sent directly to LPT1: and may con tain device-spe cific escape codes. The printer S is not auto mati cally closed, and form feeds are not auto mati cally sent after each PRINT command.

SET PRINTER 241 SET PRINTPROFILE

Format [Set] PRINTPROFile fileid

KEDIT default: PRINTPROFILE

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET PRINTPROFILE lets you change the name of the profil e exe cuted when the Win- dows Explorer invokes KEDIT to print an associ ate d file.

You can use the Windows Explorer to spec ify that KEDIT will be the applica ti on used to print files with cer tain exten sions. Once a file exten sion has been asso ciated with KEDIT, you can select a file with that extension in the Windows Explorer and choose Print from the but ton 2 context menu to have the file printed by KEDIT. You can also have KEDIT print the file by dragging the file within the Windows Explorer to your default printer icon.

When the Windows Explorer uses KEDIT to print a file, KEDIT is invoked with a com - mand like

KEDITW32 /P fileid When KEDIT sees /P as its first parame ter it takes this a sig nal to run the pro file spec i - fied via the SET PRINTPROFILE option, instead of your norm al profil e. This specia l profil e should contai n com mands to print your file and then exit from KEDIT. An appro priate default pro file, PRINTPROFILE, is built into KEDIT, so most KEDIT users will not need to change the value of the PRINTPROFILE option.

242 Chapter 4. The SET Command SET QUICKFIND

Format [Set] QUICKFIND Re spect|Ig nore Word|NOWord Regexp|NORegexp string

KEDIT default: Preserve d from previ ous editing session

Level: Global

Dialog box: None

Save Set tings handli ng: Autom ati cal ly saved at the end of a session

Description SET QUICKFIND is specia lize d com mand, most often used from within macros, that sets the value of the search string in the Quick Find toolbar item.

Once the Quick Find string has been set, you can search for it by acti vating the Quick Find toolbar item and pressing Enter or by clicking on the Find Next toolbar but ton. Changes to the Quick Find string are also reflected in the default string display ed when you use the Edit Find or Edit Replace dialog boxes. KEDIT autom ati cal ly updates the Quick Find string whenever you use Edit Find or Edit Replace or issue a LOCATE or CLOCATE com mand from the com mand line.

The operands for SET QUICKFIND are RESPECT|IGNORE, which determ ines whether case will be respected in a search involving the Quick Find string, WORD|NOWORD, which deter mines whether a search will be limited to whole word boundari es, REGEXP|NOREGEXP, which determ ines whether the Quick Find string will be treated as a reg u lar expres sion, and finally the string itself. For example, to set the Quick Find string to ‘‘yester day’’, and to spec ify that a search involving this string will ignore case, use word boundari es, and not be treated as a regu lar expres sion, you would use the command

SET QUICKFIND IGNORE WORD NOREGEXP yester day The string spec ifie d with the SET QUICKFIND com mand cannot be more than 100 char ac ters long. s n o i t p O

T E S

SET QUICKFIND 243 SET RANGE

Format [Set] RANge target1 target2

KEDIT default: The entire file

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Not savable

Description Use the SET RANGE com mand to specify the range of lines in your file within which KEDIT com mands will operate . Target1 spec ifies the first line of the range and target2 spec ifies the last line of the range.

Norm ally, KEDIT com mands range over your entire file. For exam ple, if you are edit - ing a 1000-line file, com mands can norm ally affect all lines of your file, from line 1 through line 1000. If you want to spend some time working with only a subset of your file, for exam ple lines 100 through 200, you can use the SET RANGE com mand to tell KEDIT to limit its oper a tions to that por tion of your file:

SET RANGE :100 :200 KEDIT will then show you only lines 100 through 200 of your file, and any KEDIT com mands that you issue will operate only within that range of lines. Line 100 will act very much like the first line of your file, and line 200 will act like the last line of your file. For exam ple, even though there are 1000 lines in your file, the BOTT OM com - mand will go to line 200 of your file. Above line 100, KEDIT display s a top-of-range line, sim ilar to the norm al top-of-file line, and lines 1 through 99 of your file are not shown. Below line 200, KEDIT display s an end-of-range line, sim ilar to the norm al end-of-file line, and lines 201 through 1000 of your file are not shown.

The FILE and SAVE com mands will always write your entire file to disk, regardles s of the range in effect. All other KEDIT com mands act within the current range, and ignore lines out side of the range.

When you have finishe d working with a parti cu lar range of lines within your file, you can use the SET RANGE com mand to once again include your entire file in the current range. In our exam ple of a 1000-line file,

SET RANGE :1 :1000 would allow com mands to range over your entire file. A more general way of doing this, which would be inde pendent of the size of your file, would be

SET RANGE -* *

Examples SET RANGE :10 * Sets the range to extend from line 10 of your file through the end of your file.

244 Chapter 4. The SET Command SET RANGE -5 5 The line five lines above the focus line becomes the first line of the range, and the line 5 lines below the focus line becomes the last line of the range.

SET RANGE BLOCK This is han dled as a special case. It sets the range to extend from the first to the last lines of the current ly defined block.

SET RECENTFILES

Format [Set] RECENTFiles n

KEDIT default: 9

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description At the bottom of the File menu is a list of files that you have recently edited. You can select a file from this list to re-edit it with out going into the File Open dia log box. RECENTFILES determ ines the maxi m um num ber of files that can appear on this list. By default, up to 9 recently-used files will appear. RECENTFILES can have val ues in the range 0 to 25.

SET RECFM

Format [Set] RECFm Fixed|Vary ing

KEDIT default: VARYING

Level: File

Dialog box: Options SET Com mand

Save Set tings handli ng: Not savable s n o i

Description SET RECFM, included for use in specia lize d sit ua ti ons, control s whether KEDIT t writes varying- or fixed-length lines when files are written to disk by the FILE, SAVE, p O and PUT com mands, by the autosave facil ity, and by File Save and related menu items. T

When KEDIT writes a file with the default set ting of RECFM VARY ING, it writes out E all charac ter s through the last nonblank charac ter in each line. (Depending on the S setting of TRAIL ING, trail ing blanks may also be written. ) With RECFM FIXED, KEDIT will write out all lines at the same length (as set by the SET LRECL command).

SET RECFM 245 Lines that are less than the current logi cal record length are padded with blanks. Lines that are longer than the current logi cal record length are truncated.

Each line that KEDIT writes with RECFM FIXED nor mally takes up LRECL+2 bytes on disk, since an end-of-line sequence, control led by SET EOLOUT and default ing to a car riage return-line feed pair, is writ ten after each line. A 10-line file, for example, with LRECL 80, RECFM FIXED, EOLOUT CRLF, and EOFOUT EOL would therefore take 820 bytes when writ ten to disk.

See also User’s Guide Chapter 12, “File Processing”, SET LRECL

SET REPROFILE

Format [Set] REPROFile ON|OFF

KEDIT default: OFF

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Not savable

Description Use SET REPROFILE to deter mine whether your profil e should be re-execute d when- ever you start to edit an addition al file.

When you first invoke KEDIT, KEDIT assigns val ues to all SET options for the file you will edit. These are based on KEDIT’s built-in default setti ngs, as modi fie d by any changes you have made via Options Save Setti ngs. KEDIT then execute s your profil e, which may change some of these options, and reads in your file. If, during your ses sion, you edit additi onal files and REPROFILE OFF is in effect, KEDIT copies over the val - ues of most SET options from the current file to the new file, as discusse d in Section 2.4, “Editing Additional Files”. Then KEDIT loads in the new file. Your profil e is not re-executed.

With REPROFILE ON, when you edit an addi tional file, the SET options for the new file are not cop ied from the cur rent file. Instead, they are set to their default val ues, based on KEDIT’s built-in defaults, as modi fie d by your saved set tings. Then your pro- file is re-exe cuted, and finally your file is read in.

Re-execut ing your profil e whenever you begin to edit a new file may slow things down slightly, but is rec om mended so that your profil e can contai n com mands that adjust KEDIT’s set tings depending on the extension of the file being edited. With REPROFILE ON, your profil e can set things up properl y for each new file added to the ring. Using the INITIAL() func tion, your profil e can test if it is being exe cuted for the first time or is being re-exe cuted, and can avoid redefin ing keys, etc., unnecessarily.

246 Chapter 4. The SET Command To deter mine the name of the pro file to exe cute when a new file is loaded with REPROFILE in effect, KEDIT uses the value of the PROFILE option speci fie d on the com mand line involved and, if the PROFILE option is not speci fie d, uses the value of DEFPROFILE. The default value for DEFPROFILE is WINPROF.KEX. You can use SET DEFPROFILE or the DEFPROFILE initial iza tion option to spec ify a dif fer ent default profile.

SET REGSAVE

Format [Set] REGSAVE STATE|NOSTATE [HIS Tory|NOHISTory]

KEDIT default: STATE HIST ORY

Level: Global

Dialog box: None

Save Set tings handli ng: Not savable

Description SET REGSAVE determ ines which inform ati on KEDIT updates in its secti on of the Windows regis try upon ter mina ti on. Inform ati on saved in the regis try at the end of a KEDIT session is used the next time that you run KEDIT to setup the File menu’s list of recently-edited files, the ini tial posi tion of KEDIT’s frame window, etc.

The STATE|NOSTATE value control s whether KEDIT updates certai n sta tus inform a- tion within the regis try at the end of a session. This includes inform ati on about the state (maxi m ized or non-maxi m ized) of KEDIT’s frame and doc um ent windows, the size and posi tion of the frame win dow, the screen and printer fonts that you are using, etc. With REGSAVE STATE in effect, the default, this inform ati on is updated at the end of the cur rent ses sion. With REGSAVE NOSTATE, it is not.

The HIS TORY|NOHISTORY value control s whether, at the end of the current session, KEDIT updates the lists of recently-issued comm ands, recently-edited files, recently-used Edit Find search strings, etc. that it maintains within the Win dows reg is - try. With the default value of HIS TORY, the lists are updated; with NOHISTORY they are not.

Notes · STATE and HIST ORY infor m ati on that is not update d in the Windows regis try at

the end of a KEDIT session is not de leted from the regis try , but is inste ad left un- s

changed. So if, for exam ple, you put REGSAVE NOSTATE NOHISTORY into n o i

ef fect and then exit KEDIT, infor m ati on that was saved in the regis try at the end of t your last KEDIT ses sion will re main in the reg is try, and will be used the next time p O you run KEDIT. You can, however , use the REGUTIL com mand to rem ove this T

in for ma tion from the registry. E S · KEDIT also uses the Windows regis try to save infor m ati on about SET com mand opti ons whose values you have changed from their defaul ts. This infor m ati on is

SET REGSAVE 247 not update d auto m ati cal ly at KEDIT ter mina ti on, but is inste ad update d via the Opti ons Save Settings dialog box.

· If you start KEDIT with the NOREG or NOINI opti ons, REGSAVE NOSTATE NOHISTORY is the default inste ad of the usual REGSAVE STATE HIST ORY. The NOREG (or NOINI) option tells KEDIT not to load any infor m ation from the Windows regis try but to inste ad start with defaul t window posi ti ons and with empty history lists.

· For his tori cal reasons SET INISAVE, which does the same thing as SET REGSAVE, is also avail able.

See also NOREG ini tial iza tion option, REGUTIL

SET RESERVED

Format [Set] RE SERved line [color] text [Set] RE SERved line OFF

KEDIT default: No reserved lines

Level: File

Dialog box: None

Save Set tings handli ng: Not savable

Description With SET RESERVED, you can reserve lines of the docu m ent window for specia l text that you want KEDIT to display in the current file’s window . You might, for exam ple, want to display a sum mary of your func tion key defi ni ti ons near the bottom of the doc- u ment window.

The line to be reserved can be speci fie d rel ati ve to the top of the doc um ent window , the middle of the doc um ent window , or the bottom of the docu m ent window; see SET CURLINE for a discus sion of how to do this.

You can also specify the color to be used when display ing the reserved line; see SET COLOR for a discus sion of how colors can be speci fie d. If you don’t specify a color, KEDIT uses the COLOR IDLINE value to deter mine the color of the reserved line.

The alternate form of SET RESERVED lets you turn off display of a reserved line.

Examples SET RE SERVE -1 WHITE ON BLUE F1=Help F2=Add F3=Quit F8=Dup The speci fie d text (starting with ‘‘F1=’’) is display ed, using white text on a blue back - ground, in the last line of the doc um ent window .

248 Chapter 4. The SET Command SET RE SERVE -1 OFF This removes the reserved line from the display .

SET RIGHTCTRL

Format [Set] RIGHTCTRL ON|OFF

KEDIT default: OFF

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET RIGHTCTRL lets you use the right Ctrl key found on most keyboards as an Enter key. (The Enter key on 3270 display s, which many KEDIT users are famil iar with, is located in the same posi tion as the right Ctrl key is on most PC key boards.)

With RIGHTCTRL ON, whenever you press the right Ctrl key, KEDIT acts as if you had pressed the Enter key on the numeric key pad, whose KEDIT keyname is NUMENTER. The default def ini ti ons for both ENTER and NUMENTER are the same, so pressing the right Ctrl key and pressing the ENTER key do the same thing by default. If you use the right Ctrl key as an Enter key, you may want to redefine the ‘‘real’’ ENTER key to serve some other purpose.

SET SCALE

Format [Set] SCALe ON|OFF [line]

KEDIT default: OFF M+1

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable s n o i

Description When SCALE ON is in effect, KEDIT dis plays a ‘‘scale line’’ in the file area of the doc - t um ent window . The scale line, which vis ibly display s indi cati ons of what colum n text p O is in, appears only on your screen and is not a part of your file. The scale line helps you T

see what colum n things are in by indi cat ing where every fifth colum n is located. Also, E the left and right zone col umns are indi cated by ‘‘<’’ and ‘‘>’’ char acters, the left and S right mar gins by ‘‘[’’ and ‘‘]’’ charac ter s, the paragraph indent colum n by a paragraph sym bol, the trunca ti on colum n by a ‘‘T’’, and the col umn pointer by a ‘‘|’’. If the tab

SET SCALE 249 line is being display ed on the same line as the scale line, the current tab colum n set tings are also indicat ed on the scale line. (If the same col umn is serving several purposes, for exam ple as both the left zone col umn and the left mar gin col umn, only one of the above indicators is displayed.)

The scale line norm ally appears just below the middle of the doc um ent window , but you can specify what line of the docu m ent window it should appear on. The line can be spec ifie d rel ati ve to the top of the doc um ent window , the middle of the doc um ent win- dow, or the bottom of the docu m ent window; see SET CURLINE for a discus sion of how to do this.

See also SET TABLINE

Examples SCALE ON M-1 Display s the scale line one line above the middle of the doc um ent window .

SCALE ON Dis plays the scale line in the default loca tion (or in the loca tion last set by issu ing ‘‘SCALE ON line’’).

SET SCOPE

Format [Set] SCOPE All|Dis play

KEDIT default: DIS PLAY

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Not savable

Description Using KEDIT’s selec tive line edit ing facil ities, you can exclude cer tain por tions of your file from your dis play. With SCOPE DIS PLAY, the default, lines that are excluded from display are also excluded from proces sing by most KEDIT com mands; these com mands act as if excluded lines were not present in your file. With SCOPE ALL, KEDIT com mands operate on all lines of your file, even though some of them may be excluded from display . SCOPE ALL is rarely used except in special ized situ a - tions within macros. In most sit ua ti ons the default of SCOPE DISPLAY is appropriate.

While most com mands avoid excluded lines when SCOPE DISPLA Y is in effect, there are a few excepti ons. The FILE and SAVE com mands and menu items that write your file to disk always operate on your entire file, writ ing even excluded lines to disk. The SORT com mand and the Actions Sort dialog box sort all lines in the tar get area of your file, even though some of these lines may be excluded lines.

250 Chapter 4. The SET Command When SCOPE ALL is in effect, the cur rent line is always dis played, regard less of its selec tion level.

The ALL com mand with a tar get operand autom ati cal ly puts SCOPE DISPLA Y into effect when ever it is suc cess fully exe cuted, as does the Edit Selective Edit ing dia log box when it suc cessfull y matches a string that you specify.

See also User’s Guide Chapter 8, “Selective Line Editing and Highlighting”, ALL, SET DISPLAY, SET SELECT, SET SHADOW

Examples ALL /Lin coln/ DELETE 5 The ALL com mand selects all lines of your file contai ning ‘‘Lincoln’ ’, makes the first such line become the focus line, and puts SCOPE DISPLA Y into effect. Since SCOPE DIS PLAY is in effect, the DELETE comm and oper ates only on lines that are selected, so it deletes the first five lines con tain ing ‘‘Lin coln’’.

ALL /Lin coln/ SET SCOPE ALL DELETE 5 After lines con tain ing ‘‘Lin coln’’ are selected, the SET SCOPE ALL comm and tells KEDIT that com mands should operate on all lines of your file. The DELETE com mand therefore deletes the focus line and the four lines below it, for a total of five lines, regardles s of whether they contai n ‘‘Lincoln’ ’.

SET SCREEN

Format [Set] SCReen n [Hori zon tal|Ver ti cal] [Set] SCReen m Split

KEDIT default: 1

Level: Global

Dialog box: None

Save Set tings handli ng: Not savable s

Description SET SCREEN lets you specify the num ber of docu m ent windows that you want to have n o i

display ed within KEDIT’s frame window , and it arranges the windows in a tiled fash- t ion so that they completely fill the frame window. p O

T

SET SCREEN is provided mainly for com pati bil ity with the text mode version of E KEDIT, which only supports tiled windows. SET SCREEN works only when OFPW S (‘‘One File Per Window’ ’) OFF is in effect, since OFPW OFF makes KEDIT for Win- dows use the same rules for placing files in docu m ent windows as text mode KEDIT

SET SCREEN 251 does. The Window Tile and Window Cas cade menu items, and the Window Arrange dialog box, provide useful alterna ti ve methods for arranging your document windows.

In text mode KEDIT, docu m ent windows are always tiled and the SET SCREEN command provides the only method for changing how many docu m ent windows are display ed and how they are arranged. With KEDIT for Windows, you can easil y create new docu m ent windows (for exam ple, with Window New), you can use the mouse to move and resize windows, So the window arrange ment that you spec ify with SET SCREEN may not remain per manen tly in effect in the way that it does in text mode KEDIT. [Set] SCReen n [Hor i zon tal|Ver ti cal] With the first form of the SET SCREEN com mand, you spec ify the num ber of doc- um ent windows to display within the frame win dow. If HORI ZON T AL is speci - fied (or if nothing is speci fied, since HORI ZON T AL is the default ) the frame win dow will be split hor izon tally into n docu m ent windows. If you spec ify VER - TI CAL, the frame win dow is split ver tically into n document windows. [Set] SCReen m Split With the second form of the SET SCREEN com mand, you spec ify the num ber of hor izon tal areas that are to ap pear on your screen. SPLIT in di cates that each of these hori zon tal areas is to be split down the middle into two windows, giving you a to tal of 2m windows.

See also User’s Guide Section 3.5, “Editing Multiple Files”, SET OFPW

Examples SCREEN 2 This gives you two docu m ent windows, one in the upper half of the frame win dow and the other in the lower half.

SCREEN 2 V This gives you two frame win dows, one in the left half of the frame win dow and the other in the right half.

SCREEN 3 S This divides the frame win dow into three hori zon tal areas, each split verti cally, giving you a total of six doc um ent windows.

252 Chapter 4. The SET Command SET SCROLLBAR

Format [Set] SCROLLbar ON|OFF [Vertical|Horizontal|BOTH]

KEDIT default: ON BOTH

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET SCROLLBAR control s the scroll bars KEDIT norm ally display s on your doc u - ment windows.

The first operand control s whether scroll bars are display ed at all. The second operand lets you display only a VER TICAL scroll bar, only a HOR IZON T AL scroll bar, or BOTH ver ti cal and hor i zon tal scroll bars.

See also User’s Guide Chapter 4, “Keyboard and Mouse”

SET SELECT

Format [Set] SE Lect [+|-]n [target ]

KEDIT default: All lines have selec tion level 0

Level: File

Dialog box: Options SET Com mand (for focus line only)

Save Set tings handli ng: Not savable

Description Use the SET SELECT command to set the selec tion level of lines in your file.

Each line of your file has a number , called its selec tion level, asso ciated with it. Selec -

tion levels can range from 0 to 255. You can set the selec tion level of lines in your file s

by using the SET SELECT com mand. (The ALL com mand, the Edit Selec tive Editing n o i

dialog box, and the X and S pre fix com mands also manipu lat e the selecti on levels of t lines in your file.) Using the SET DISPLA Y com mand, you spec ify the range of selec- p O tion levels of lines you want selected for display . Lines whose selec tion levels fall T

within the range spec ifie d by the SET DISPLA Y com mand are selected for display . E Lines whose selecti on levels are out side this range are excluded from your display and, S if SCOPE DISPLA Y is in effect, are excluded from processing by most KEDIT commands.

SET SELECT 253 SET SELECT affects selec tion lev els of lines in the spec ified tar get area. If no tar get is spec ified , SET SELECT sets the selec tion level of the focus line. [Set] SELect n tar get Sets the se lec tion level of lines in the tar get area to n. [Set] SELect +n tar get Adds n to the se lec tion level of lines in the tar get area. (If the result would be greater than 255, the se lec tion level is set to 255.) [Set] SELect -n tar get Subtracts n from the se lec tion level of lines in the tar get area. (If the result would be less than 0, the se lec tion level is set to 0.)

Note that, like most other KEDIT com mands, SET SELECT operate s only on lines within the cur rent SCOPE. If SCOPE DIS PLAY is in effect, SET SELECT will not operate on excluded lines.

All lines in your file initially have a selec tion level of 0. When a new line is added to your file, it gets a selec tion level equal to the n1 value of the current DISPLA Y set ting (DIS PLAY n1 n2). When a line is copied, dupli cated, or split, the resulting new line is given the same selec tion level as the line which is copied, dupli cated, or split.

See also User’s Guide Chapter 8, “Selective Line Editing and Highlighting”, ALL, SET DISPLAY, SET SCOPE, SET SHADOW

Examples SET SE LECT +1 KEDIT adds 1 to the selecti on level of the focus line.

SCOPE ALL SE LECT 2 ALL KEDIT gives all lines of your file a selec tion level of 2.

SCOPE DIS PLAY SE LECT 2 ALL KEDIT gives all selected lines of your file a selection level of 2.

SET SHADOW

Format [Set] SHADow ON|OFF

KEDIT default: ON

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

254 Chapter 4. The SET Command Description SET SHADOW control s how excluded lines are repre sent ed on your display . With SHADOW ON, the default, KEDIT display s a shadow line to repre sent each group of one or more excluded lines. The shadow line lets you see where excluded lines occur in your file, and indi cates how many lines are excluded. With SHADOW OFF, KEDIT does not display shadow lines; excluded lines are com pletely omit ted from your display.

Excluded lines most often result from use of the ALL com mand, the Edit Selec tive Edit ing dialog box, or of the X prefix com mand.

See also User’s Guide Chapter 8, “Selective Line Editing and Highlighting”, ALL, SET DISPLAY, SET SCOPE, SET SELECT

SET SHARING

Format [Set] SHARING DENYWRITE|DENYNONE [DENYWRITE|DENYREADWRITE]

KEDIT default: DENYWRITE DENYREADWRITE

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET SHARING control s the sharing modes used by KEDIT when it reads a file into mem ory and when it locks a file.

The first operand control s the sharing mode used when KEDIT reads a file, which hap- pens when you begin to edit a file without file locking in effect, when you load a macro or .KML file, and when you use the GET com mand. DENYWRITE This is the defaul t sharing mode used when reading files. It means that the at- tempted read will fail if any other pro gram has write ac cess to the file and that no other program can be gin to write to the file while KEDIT is reading it. DENYNONE KEDIT will at tempt to read the file regard les s of whether other program s have

write ac cess to it. The read will still fail if some other pro cess has ex clu sive ac cess s to the file. Note that with DENYNONE there is a chance that the file may not be n o i

read in properl y, since it is pos sible that another program might change the file t while KEDIT is in the proces s of reading it. p O

T

The second operand control s the sharing mode used when KEDIT locks a file. KEDIT E locks a file when you begin to edit a file and LOCKING ON is in effect or you specify S the LOCK option, and when you use the LOCK com mand to lock a file that is already in the ring.

SET SHARING 255 DENYREADWRITE This is the defaul t sharing mode used when locking files. It means that KEDIT will have ex clu sive ac cess to the file while it is locked. If any other pro grams are us ing the file when the lock is re quested, the request will fail. Once the lock has been ob- tained, no other program s will be able to acces s the file. DENYWRITE KEDIT will be able to lock the file as long as no other program is current ly writ ing to the file or pre venting write ac cess to the file. While the file is locked, no other program will be able to begin writing to the file or open the file in deny write mode. Other pro grams will be able to read from the file. Note that with DENYWRITE there is a chance that the file may not be read properl y by these other program s, since they may try to read from the file while you are saving changes to disk.

There is no operand to control the sharing modes used when KEDIT writes a file that you are editing to disk when file locking is not in effect. In this case, KEDIT always requires exclu sive access to the file.

See also User’s Guide Chapter 12, “File Processing”

SET STATUSLINE

Format [Set] STATUSLine ON|OFF

KEDIT default: ON

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET STATUSLINE lets you control whether or not KEDIT display s a line of sta tus inform ati on at the bottom of your frame win dow.

With the default setting of STATUSLINE ON, KEDIT dis plays a sta tus line at the bot - tom of your frame win dow. The status line is used to display your posi tion in the cur- rent file, the num ber of alter ations and undoable changes made to the file, the size of the file, the num ber of files you are editing, the num ber of docu m ent windows you are using, whether you are in Insert Mode or Overtype Mode, and whether the current file is locked.

Other infor mation that can be dis played on the sta tus line is optional: With CLOCK ON, the sta tus line gives the time of day. With HEXDISPLAY ON, the sta tus line dis - plays the char acter code, in hex adec im al and in deci m al, for the char acter at the cur sor position.

See also SET CLOCK, SET HEXDISPLAY

256 Chapter 4. The SET Command SET STAY

Format [Set] STAY ON|OFF

KEDIT default: ON

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description The STAY option control s the positi oning of the focus line after you attempt to locate a string tar get or string colum n tar get or after you use one of the com mands listed below. With STAY OFF (and assum ing WRAP is OFF), an unsucces sful LOCATE, CLOCATE, TFIND, or Edit Find opera ti on, makes the end-of-file line become the new focus line. (The top-of-file line is the new focus line after an unsuc cessful backward search.) With STAY ON, the focus line is unchanged after an unsucces sful LOCATE, CLOCATE, TFIND, or Edit Find opera ti on. With STAY OFF, the last line scanned or affected by the ALTER, ANSITOOEM, CEN - TER, CHANGE, COMPRES S, COUNT, EXPAND, FIND, FINDUP, LEFT ADJUST, LOW ERCASE, NFIND, NFINDUP, OEMTOANSI, PRINT, PUT, RIGHTADJUST, SET LINEFLAG, SET SELECT, SHIFT, UPPER CASE, and SORT comm ands becomes the new focus line after the com mand has com pleted. This is also true for the Edit Replace and Actions Sort dialog boxes. With STAY ON, the loca tion of the focus line is unchanged after these com mands fin ish.

SET STREAM

Format [Set] STReam ON|OFF

KEDIT default: ON

Level: View s

Dialog box: Options SET Com mand n o i t

Save Set tings handli ng: Savable p O

T

Description The setti ng of STREAM affects the search for string colum n tar gets when you use the E CLOCATE or CDELETE comm ands. With STREAM OFF, a search for a string col - S umn target is lim ited to the focus line. With STREAM ON, all lines through the end of the file (or the whole file, if you have set WRAP ON) are searched.

SET STREAM 257 Note that the set ting of STREAM only affects the oper a tion of the CLOCATE and CDELETE com mands, which are the only two com mands whose operands are colum n tar gets. The LOCATE com mand and the Edit Find dialog box are never lim ited to the focus line and are not affected by SET STREAM.

SET SYNONYM

Format [Set] SYNonym ON|OFF [Set] SYNonym [LINEND char] newname [n] definition

KEDIT default: ON

Level: View

Dialog box: Options SET Com mand (SYNONYM ON|OFF only)

Save Set tings handli ng: Savable (SYNONYM ON|OFF only)

Description Use the SET SYNONYM com mand to control KEDIT’s synonym facilit y.

The first form of the SET SYNONYM com mand controls whether KEDIT does syn - onym proces sing at all. With SYNONYM ON, the default, synonym proces sing (as described below) is done for com mands issued from the com mand line (and for com - mands issued from macros via the SYNEX com mand). With SYNONYM OFF, no synonym proces sing is done and KEDIT acts as if no synonym s have been defined. Note that synonym proces sing is norm ally bypassed for com mands issued from mac- ros, unless you use the SYNEX command.

The second, more frequentl y used, form of SET SYNONYM lets you change the names and defi ni ti ons of KEDIT’s com mands. After an optional LINEND charac ter spec ifi ca ti on (discusse d below, and usuall y not neces sary ), you give the name which you want a com mand to be known by. You can fol low this with the num ber of charac - ters that KEDIT will accept as the mini mal trun ca tion for this name. Then you tell KEDIT what the com mand with this name should do.

For exam ple, suppose that you wish KEDIT’s LOCATE com mand were called SEARCH. You would issue the com mand

SYN ONYM SEARCH LOCATE

Then, instead of

LOCATE /abc/

you could enter

258 Chapter 4. The SET Command SEARCH /abc/ Note that KEDIT does only one level of synonym proces sing. When KEDIT sees that SEARCH is a synonym for LOCATE, it exe cutes the LOCATE com mand without looking to see if LOCATE is itself a synonym for some other com mand.

After spec i fy ing the newname that you want for a com mand, you can specify the num - ber n of char acters that will be accepted as its min im al trun cation. In the example above, SEARCH would have to be spelled out in full. With

SYN ONYM SEARCH 3 LOCATE SEARCH could be given as ‘‘SEA’’, ‘‘SEAR’’, ‘‘SEARC’’, or ‘‘SEARCH’’.

KEDIT’s synonym proces sing can convert what you enter as one com mand into more than one com mand. For exam ple, suppose you want to have a com mand called FIRST that finds the first occurrence of a string in your file. You need to spec ify a LINEND charac ter to tell KEDIT where each com mand in your synonym defi ni ti on ends. (This is dif ferent from the charac ter control led by SET LINEND, and is in effect only during the affected SET SYNONYM com mand.) The FIRST com mand will go to the top of the file and then look for the specified string:

SYN ONYM LINEND + FIRST TOP + LOCATE Here, ‘‘+’’ is set as the LINEND char acter . Then two comm ands (‘‘TOP‘‘ and ’’LOCATE’’) are issued, with the ‘‘+’’ used to indi cate the sep ara tion between the two com mands. You could then enter

FIRST /X/ to find the first occurrence of ‘‘X’’ in your file. Any operands on the com mand that you enter are placed by KEDIT at the end of the last com mand in the synonym defi ni ti on, so that ‘‘/X/’’ is taken as an operand for the LOCATE com mand and not of the TOP com mand.

If your synonym defi ni ti on ends with a specia l charac ter , any operands you give are placed immedi ately after the spe cial char acter . If it ends with an alpha betic or numeric charac ter , KEDIT adds a blank after the synonym defi ni ti on and then appends your operands.

The newname given in your synonym defi ni ti on can be a single specia l charac ter or it can be a string of one to ten alphabeti c charac ter s. You can define up to 80 synonym s. The synonym s are global, affect ing all files in the ring. s

Query SYN onym * n o i t

will dis play all the SYN ONYM def ini tions cur rently in effect. p O

T

You can cause KEDIT to bypass synonym proces sing for a com mand issued from the E com mand line by preced ing it with ‘‘COM MAND’’. For exam ple, suppose that you S have made COPY a synonym for some other com mand, but that you now want to exe- cute the ‘‘real’’ KEDIT COPY com mand, bypassing the synonym.

SET SYNONYM 259 COM MAND COPY :12 causes KEDIT to proces s the com mand COPY :12, without first looking for synonym s for COPY. On the other hand, synonym proces sing is bypassed for com mands issued from within a macro, so ‘‘COPY :12’’ issued from a macro would execute KEDIT’s COPY com mand, and not your synonym . ‘‘SYNEX COPY :12’’ would cause KEDIT to look for synonym s of COPY.

See also COM MAND, SYNEX

SET TABLINE

Format [Set] TABLine ON|OFF [line]

KEDIT default: OFF -2

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description When TABLINE is ON, a ‘‘tab line’’ is dis played in the spec ified line of the docu m ent window . This tab line indi cates the posi tion of each tab colum n (control led via the SET TABS com mand) by showing a ‘‘T’’ in the appropri ate column.

The tab line norm ally appears near the bottom of the file area, but you can specify what line of the docu m ent window it should appear on. The line can be speci fied rel ative to the top of the docu m ent window , the middle of the doc um ent window , or the bottom of the doc um ent window; see SET CURLINE for a discus sion of how to do this.

If the tab line is set to appear on the same line as the scale line, then the tab infor mation appears on the scale line, interm ixed with the inform ati on norm ally display ed on the scale line.

See also SET SCALE, SET TABS

260 Chapter 4. The SET Command SET TABS

Format [Set] TABs n1 [n2 n3 ...] [Set] TABs INCR n [Set] TABs n1 [n2 ...] INCR n

KEDIT default: INCR 8

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description Use SET TABS to set your tab col umns. Whenever you press the Tab key (or, if PRE- FIX ON is in effect, the F4 key), KEDIT moves the cursor forward to the next tab col - umn. Whenever you backtab (which, unless PREFIX ON is in effect, is norm ally done by pressing Shift+Tab), the cursor moves backward to the previ ous tab column.

Initi ally, tab colum ns are set up every eight colum ns, start ing at colum n 1. Issue the SET TABS com mand if you want to change this.

With the first form of the SET TABS com mand, you enter a list of up to 32 tab col umns. The num bers you give must be in ascending order and can range from 1 to the value of the WIDTH ini tial iza tion option.

With the second form of the SET TABS com mand, you spec ify an increm ent n and KEDIT sets tabs in colum n 1 and every n col umns there af ter.

The third form of the SET TABS com mand lets you give a list of specif ic tab col umns and then spec ify that tabs will be set every n col umns there af ter.

Using SET TABS is sim ilar to defining tab stops on a typewrit er. It can be very use ful if you need to enter text in spe cific colum ns. For exam ple, you may be entering tables where entries must be lined up in specif ic colum ns, or you may be using a program - ming language that requires parts of your program to be in specif ic columns.

Note that KEDIT does not actu ally enter a tab char acter (char acter code 9) into your file when you press the Tab key. KEDIT merely moves the cursor to the next tab colum n. Your TABS setti ng also has no effect on how tab charac ter s are proces sed by KEDIT when it reads files from disk or writes them out to disk; this proces sing is control led by s

SET TABSIN and SET T ABSOUT. n o i t See also COM PRESS, EXPAND, SET TABSIN, SET TABSOUT, SET TABLINE p O

T

Example TABS 1 10 16 30 40 INCR 5 E S Col umns 1, 10, 16, 30, and 40, and then col umns 45, 50, 55, 60, etc., are set up as tab col umns.

SET TABS 261 SET TABSAVE

Format [Set] TABSAVE ON|OFF

KEDIT default: OFF

Level: File

Dialog box: Options SET Com mand

Save Set tings handli ng: Not savable

Description SET TABSAVE is a spe cialized comm and that deals with an issue affect ing a small num ber of KEDIT users.

KEDIT's TABSIN/TABSOUT proces sing can someti mes lead an “unchanged” line to be written back to disk dif ferentl y than when it was read in – existing tabs can be replaced with spaces, or vice versa. Some version control sys tems undesir ably see these all as “changed” lines.

TABSAVE ON avoids this by checking to see whether the current line is subject to the problem and, if so, by saving an exact copy of the charac ter sequence of the origi nal line. Later, when the file is saved, and an “unchanged” line is about to be written back to disk, KEDIT doesn't write the line out in the nor mal way, but instead writes back its saved copy of the exact origi nal version of the line.

To use TABSAVE, you need to do the follow ing:

· Put TABSIN ON into ef fect (or use TABSIN ON n, if you assum e tab stops at other than the every -8-col umns defaul t)

· Put TABSAVE ON into ef fect.

· Put TABSOUT ON into ef fect (or use TABSOUT ON n) if you want tab com pres- sion on newly added lines or lines whose content s change dur ing the edit ing ses- sion. If you want all new/changed lines to be saved without tab com pression, you should use TABSOUT OFF n (where n matches the TABSIN ON n set ting).

Things will work properl y only if all three of these (including the TABSOUT ON|OFF n set ting) are in effect when you load the file involved. Further more, you will proba bly only want to put TABSAVE ON into effect for certai n file extensions , because it makes files take twice as much room in mem ory. You would therefore want somethi ng like the follow ing in your WINPROF.KEX file:

262 Chapter 4. The SET Command 'reprofile on' if fext.1() = 'C' | fext.1() = 'H' then do 'tabsin on' 'tabsout on' 'tabsave on' end KEDIT will then keep track of the origi nal content s of all lines of your file. When you save the file, KEDIT will com pare the current content s and the origi nal content s of each line of the file, ignoring changes due to tabs versus space charac ter s. If the con- tents of a line have not changed, the origi nal version of the line will be written back to disk pre serving its origi nal tab charac ter s. If the content s of a line have changed, the updated version of the line will be written back to disk, with its tab com pression deter - mined by the TABSOUT setting.

One point to be aware of is that to preserve the tabs, the TABSAVE handli ng discusse d above always needs to be in effect for the files in questi on – if you manage even once to edit and save the file without the TABSAVE handli ng, the tabs will of course get changed.

See also SET TABSIN, SET TABSOUT

SET TABSIN

Format [Set] TABSIn ON|OFF|TABQUOTE [n]

KEDIT default: OFF 8

Level: File

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description To save space on disk, some text edi tors com press strings of blanks into tab charac ter s (charac ter code 9) when writing files to disk. (If you set TABSOUT ON, KEDIT will also perform this com pression.) When TABSIN ON is in effect, KEDIT autom ati cal ly handles this situ a ti on, expanding to strings of blanks any tabs that it finds when it reads a file in. s

When TABSIN ON causes tab expansion, KEDIT norm ally assumes tab stops every 8 n o i

colum ns (col umns 1, 9, 17, etc.). These are standard tab setti ngs used by many pro- t grams. The DOS TYPE com mand, for example, pro cesses tab char acters using these p O tab stops. You can, however , set the tab increm ent used by TABSIN to some num ber n T

other than 8 if you need to proces s files stored with dif ferent tab stops. Note that the tab E colum ns used with TABSIN proces sing are inde pendent of the tab col umns used while S you are editing your file (which are control led by SET TABS) or when you write a file out (when SET TABSOUT is relevant).

SET TABSIN 263 TABSIN OFF is the default. You would want to leave TABSIN OFF if your file con- tains tab char acters that you want to leave intact and unex panded. To take effect when your file is read in, TABSIN ON must be one of your saved set tings or must be issued from your profil e.

With TABSIN ON, KEDIT expands all tab charac ter s, including those found after the first single quote or double quote charac ter on a line. With TABSIN TABQUOTE, KEDIT expands all tab charac ter s in a line up to the first single or double quote, but leaves tabs after the first quote on a line unexpanded.

SET TABSIN also affects how KEDIT expands tab charac ter s in text from other appli - cations pasted into KEDIT via the CLIP BOARD. If TABSIN ON or TABSIN TABQUOTE (which in this sit u a tion is treated like TABSIN ON) is in effect, tabs are expanded according to TABSIN’s tab stops. With TABSIN OFF, tabs are expanded according to the current SET TABS setting.

See also User’s Guide Chapter 12, “File Processing”, CLIP BOARD, COM PRESS, EXPAND, SET TABSAVE, SET T ABSOUT

SET TABSOUT

Format [Set] TABSOut ON|OFF [n]

KEDIT default: OFF 8

Level: File

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description If you set TABSOUT ON, KEDIT will com press strings of blanks into tab charac ters (charac ter code 9) when it writes your file to disk. Your file may then take up less disk space. If TABSIN ON is in effect when such a file is read back in by KEDIT, the tab charac ter s will be expanded back into blanks.

When TABSOUT ON causes blank com pression, KEDIT norm ally assumes tab stops every eight colum ns (col umns 1, 9, 17, etc.). These are standard tab setti ngs used by many pro grams. The DOS TYPE com mand, for example, pro cesses tab char acters using these tab stops. You can, however , set the tab increm ent used by TABSOUT to some num ber n other than 8 if you need to store files with dif ferent tab stops. Note that the tab col umns used with TABSOUT proces sing are inde pendent of the tab col umns used when your file is read in (SET TABSIN control s this) and while you are edit ing your file (where SET TABS is relevant).

You may want to leave the default value of TABSOUT OFF in effect because many program s do not properl y han dle files with tab com pression, and the disk space saved may not be worth the extra confu sion.

264 Chapter 4. The SET Command Even with TABSOUT ON, KEDIT does not com press blanks appearing after the first single quote or double quote on a line. Also, even with TABSOUT ON, single blanks are not changed to tabs.

See also User’s Guide Chapter 12, “File Processing”, COM PRESS, EXPAND, SET TABSAVE, SET TABSIN

SET THIGHLIGHT

Format [Set] THIGHlight ON|OFF

KEDIT default: ON

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET THIGHLIGHT (‘‘Tar get HIGHLIGHT’ ’, pro nounced ’’ highlight ’’) controls KEDIT’s tar get high light ing facil ity.

With THIGHLIGHT ON, when the LOCATE, CLOCATE, or TFIND com mands, or the Edit Find dialog box find a string tar get, KEDIT highli ghts it on your display .

The tar get remains highli ghted until you issue another com mand from the com mand line, until another LOCATE, CLOCATE, or TFIND com mand is execute d, until another Edit Find opera ti on takes place, until you add or delete a line in your file, change the high lighted line, mark a block, or you issue the RESET THIGHLIGHT com mand (norm ally assigned, along with RESET BLOCK, to Alt+U).

The color used to high light the tar get is determ ined by SET COLOR THIGHLIGHT.

SET TIMECHECK

Format [Set] TIMECHECK ON|OFF s n o i

KEDIT default: ON t p O Level: File T E

Dialog box: Options SET Com mand S

Save Set tings handli ng: Savable

SET TIMECHECK 265 Description Every disk file has asso ci ated with it a timestamp, indi cat ing when the file was last changed. (This is the same as the date and time displayed for a file by the DIR command.)

SET TIMECHECK control s what happens when the timestamp that a file had when you began to edit it dif fers from the timestamp that the disk copy has when you try to FILE or SAVE it. With TIMECHECK ON, the default, you get a message warning you that the timestamp has changed. This lets you know that some other program or network user may have changed the disk file while you were edit ing it. You can use the FFILE or SSAVE commands if you want to write the file to disk despite this. With TIMECHECK OFF, the check is not perform ed.

If you use File Save or a related menu item to save your file to disk with TIMECHECK ON and the timestamps do not match, KEDIT display s a dialog box that asks whether you want to save the file any way.

After a suc cessful FILE or SAVE, both the disk file’s timestamp and KEDIT’s internal record of the timestamp are updated.

SET TIMECHECK lets other program s or users change a file you are edit ing, and then warns about what has happened when you try to write the file to disk. You can use KEDIT’s file locking facil ity, control led by SET LOCKING , to pre vent such changes from occurring.

See also User’s Guide Chapter 12, “File Processing”, SET LOCKING

SET TOFEOF

Format [Set] TOFEOF ON|OFF

KEDIT default: ON

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description With TOFEOF ON, the default, KEDIT display s the top-of-file and end-of-file lines on your display in the usual way. With TOFEOF OFF, KEDIT does not display the nor mal top-of-file and end-of-file lines, but instead dis plays blank lines in their place.

You can control the color of the top-of-file and end-of-file lines with the SET COLOR TOFEOF com mand.

SET TOFEOF is provided for specia lize d sit ua ti ons and is rarely used.

266 Chapter 4. The SET Command SET TOOLBAR

Format [Set] TOOLBAR ON|OFF Top|Bot tom|BOTH

KEDIT default: ON TOP

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET TOOLBAR determ ines whether KEDIT display s toolbars, which are sets of but- tons that you can select with the mouse to carry out com mon opera ti ons.

The first operand, ON or OFF, determ ines whether toolbars are display ed at all. The sec ond operand determ ines whether, when toolbars are display ed, they should be dis- played at the TOP, the BOTT OM, or BOTH the top and bot tom of the frame window.

The top and bottom toolbars display dif ferent sets of buttons. Useful default toolbar lay outs are built into KEDIT, and you can use the SET TOOLSET com mand (in con- necti on with the SET TOOLBUTTON com mand) to define your own toolbar contents.

See also SET TOOLBUTTON, SET TOOLSET

SET TOOLBUTTON

Format [Set] TOOLButton name visual [COND ccc] /help1/[help2/]

KEDIT default: See the table below

Level: Global

Dialog box: None

Save Set tings handli ng: Not savable

Description Use SET TOOLBUTTON to define the but tons and other items that can appear on a s

toolbar. For each button, you spec ify the name of that but ton, how it will look when it is n o i

display ed on a toolbar, any condi ti ons under which the button should be dis abled, and t the help inform ati on display ed for the button. p O

T

A num ber of TOOLBUTTON defi ni ti ons are built into KEDIT and are used on the E default toolbars. Use QUERY TOOLBUTTON * to see all of the current toolbutton S defi ni ti ons. You can use the SET TOOLBUTTON com mand to modify these default TOOLBUTTON defi ni ti ons or to define new but tons of your own. You can then use the

SET TOOLBUTTON 267 SET TOOLSET com mand to specify which of your but tons will appear on the top or bottom toolbar and how they will be arranged on the toolbar.

Here is a sam ple TOOLBUTTON com mand:

SET TOOLBUTTON ADDLINE ADDLINE.BMP /Add Line/ This tells KEDIT to define a button called ADDLINE. When display ing this but ton on the toolbar, KEDIT uses the image in the bitmap file ADDLINE.BMP. The COND operand, which speci fie s condi ti ons in which the button should be dis abled, is omit ted here, so the button is always enabled. When the mouse pointer is positi oned over this button, KEDIT will display the help inform ati on ‘‘Add Line’’ in a popup box and in the status line.

Here are the com ponents of the SET TOOLBUTTON com mand: Name The name is used for two things:

First, when you use the SET TOOLSET com mand to control which buttons appear on the toolbar, you give the names of all of the buttons involved. In the exam ple above, ADDLINE is the name of the button and ADDLINE must be spec ifie d in a SET TOOLSET com mand before the button will be dis played on a toolbar.

Second, whenever you click on a toolbar button, KEDIT runs a macro called TOOL_name (that is, ‘‘TOOL_’’ followed by the name of the button). Macros for the de fault toolbar buttons are built into KEDIT, but you are free to rede fine them. If you de fine your own toolbar buttons, you will also need to define the TOOL_name macros involved, which must be in-mem ory macros. In the above exam ple, you would need to define a macro called TOOL_ADDLINE. Vi sual The vi sual repre sen ta ti on of a toolbar button can be speci fie d in four ways:

· Builtin

You can give the name of one of the prede fine d toolbar bitmap im ages built into KEDIT, for exam ple the NEW bitmap (used for the New File toolbar but- ton) or the OPEN bitmap (used for the Open File toolbar button).

· File name.BMP

You can give the name of a bitmap file on disk. The file exten sion is norm ally .BMP, and KEDIT uses the same search order to look for these files as it does for macros.

You can create your own bitmaps using a paint program or a resource edit ing program that can handle .BMP files. The bitmaps can be any size that you like, but all of KEDIT’s built-in buttons are 16 pixels wide by 15 pixels high, and it is pos sible that in future versions of KEDIT we will need to standard ize on a fixed bitmap size like this. Two sample bitmap files, AD DLINE.BMP and DELLINE.BMP are suppli ed with KEDIT and insta lled by defaul t in the

268 Chapter 4. The SET Command SAMPLES subdi rec tory of the main KEDITW direc tory . The exam ple above uses the sample ADDLINE.BM P file.

· /Text/

Inste ad of a bitmap im age, KEDIT can display a button contai ning the text you spec ify. Slash (‘‘/’’) char acters are nor mally used to de limit the text, but you can use any spe cial char acter other than back slash (‘‘\’’) that does not ap pear within the text.

· QUICKFIND

The name QUICKFIND is given specia l handli ng; it des ignate s the Quick Find combo box on the de fault toolbar, used to search for text. All of the other toolbar items are buttons that run the TOOL_name macro in response to a mouse click. When you selec t the Quick Find toolbar item, no macro is exe - cuted; Quick Find is in stead handled di rectly by spe cial code within KEDIT. Quick Find can only appear on the top toolbar, and can only appear there once. COND ccc Use COND, followed by a string of one or more charac ter s, to specify condi ti ons under which the button will be dis abled. COND is used by all of KEDIT’s defaul t toolbutton defi ni ti ons, but it is opti onal and you may want to ignore it if you are just get ting started with SET TOOLBUTTON. If COND is omitted, the toolbutton is always en abled and the as so ciated TOOL_name macro is al ways run when the button is selected.

The table near the end of this de scripti on lists each of the condi ti ons that you can spec ify, and the char ac ter cor re spond ing to the con di tion. For ex am ple, con di tion A means the current docu m ent window is mini m ized and condi ti on B means that the current file is empty. So a SET TOOLBUTTON com mand speci fy ing COND AB would mean that the button should be dis abled if the docu m ent window is min- im ized or the file is empty. If you do a Q TOOLBUTTON * to look at KEDIT’s de- fault toolbutton def ini ti ons, you will see that many of the de fault but tons are disabled under exactly these conditions.

When a button is dis abled, KEDIT display s the reason why (that is, the rea son cor- respond ing to the first condi ti on in the list that you spec ifie d that turns out to be true) on the sta tus line, inste ad of the norm al help for the button, and beeps at you if you try to selec t that but ton. The TOOL_name macro asso ci ate d with the but ton is not executed.

/help1/[help2/] s

TOOLBUTTON defi ni ti ons also include the help text display ed by KEDIT when n o i

the mouse pointer is posi ti oned over the button. Help is dis played in two places: in t a popup box near the tool button, and on the status line. You can specify either a p O single help string to be dis played in both places, or you can specify a pair of help T

strings, with the first string display ed in the popup box and the second string, usu- E ally the longer of the two, dis played on the sta tus line. Slash (‘‘/’’) charac ter s are S norm ally used to deli mit the text, but you can use any specia l charac ter that does not appear within the text.

SET TOOLBUTTON 269 In our exam ple above, the help text is given as /Add Line/ The string ‘‘Add Line’’ is used as the help text in both the popup box and on the status line. Had the ex am ple in stead used /Add Line/Add a new line below the fo cus line/ the second string would be used as the sta tus line help. The defaul t toolbuttons all use the popup help box to display a short ti tle for the toolbutton, and use the status line for more detai led infor m ati on.

The file DEFTOOLB.KEX, in the SAMPLES sub direc tory of the main KEDITW directory , has com mands corre spond ing to all of the default SET TOOLSET and SET TOOLBUTTON def i ni tions.

Conditions Here is a table of the condi ti ons, and the charac ter corre spond ing to them, used with the optional COND operand of SET TOOLBUTTON:

Char Condition A Current document window is minimized B Current file is empty C No files in the ring D Only one file in the ring E Only one document window F No minimized document windows G No non-minimized document windows H No selection (non-persistent block) in the current file I No block (persistent or non-persistent) in the current file J No block in any file K No block or command line selection in the current file L No block or command line selection in any file M No line block in the current file N No line block in any file O No box block or one-line stream block in the current file P No box block or one-line stream block in any file Q No stream block in the current file R No stream block in any file S No line T Nothing to Undo

270 Chapter 4. The SET Command Char Condition U Nothing to Redo V There is no text in the clipboard W Clipboard Cut and Copy not currently possible X Bookmark1 is not defined Y Bookmark2 is not defined Z Bookmark3 is not defined

If any condi ti ons at all are speci fie d, condi ti on C is also applied and the toolbutton is disable d if there are no files in the ring. You would therefore only need to specify con- diti on C for a button that is dis abled only when there are no files in the ring.

See also SET TOOLBAR, SET TOOLSET

Examples "TOOLB BLKUPPER BLKUPPER COND AI /Up per case Block/Up per case block/" "DEF TOOL_BLKUPPER 'up per case block'" This is the default defi ni ti on for the Uppercas e Block button on KEDIT’s default bot- tom toolbar and for its associ ate d macro. The two com mands are quoted as they would be if included in a macro. The but ton’s name is BLKUPPER; it is dis played as a bitmapped icon called BLKUPPER (this icon is built into KEDIT); the but ton is dis - abled if condi ti ons A (the docu m ent window is mini m ized) or I (there is no block in the current file) are true.

"TOOLB REV /Reverse/ /Re verse Line/Reverse line"s contents/" "DEF TOOL_REV 're place' re verse(curline.3())" “TOOLSET TOP ADD REV” These three lines, if included in a macro, would define a toolbutton called REV and its associ ate d macro, TOOL_REV, and would add the button to the top toolbar. The but ton is not display ed as a bitmapped icon, but instead as the text ‘‘Reverse ’’, with ’’Reverse Line‘‘ as the popup toolbar help and ’’Reverse line’s content s’’ as the status line help. No COND operand is spec ifie d, so the button is always enabled.

Note that the delimit ers for the but ton text (‘‘Re verse’’) are sep a rate from the delimit ers for the help text, and that the fol lowing would not be valid:

"TOOLB REV /Reverse/Re verse Line/Re verse line"s contents/" The TOOL_REV macro replaces the focus line with the reverse of its cur rent con tents. s n o i t p O

T E S

SET TOOLBUTTON 271 SET TOOLSET

Format [Set] TOOLSet [Top|Bottom|NOFiles] DEFAULT [Set] TOOLSet [Top|Bottom|NOFiles] USER toolbuttons [Set] TOOLSet [Top|Bottom|NOFiles] ADD toolbuttons [Set] TOOLSet [Top|Bottom|NOFiles] DELete toolbuttons

KEDIT default: TOP|BOTT OM|NOFILES DEFAULT

Level: TOP and BOT TOM, File level; NOFILES, Global level

Dialog box: None

Save Set tings handli ng: Not savable

Description Use SET TOOLSET to determ ine which but tons will appear on one of KEDIT’s toolbars, and how the buttons will be arranged.

Here are the com ponents of the SET TOOLSET com mand: TOP|BOT TOM|NOFILES The first oper and deter mines which toolbar’s content s you want to set. You can spec ify the TOP or BOTT OM toolbar for the current file. These are control led on a per-file basis , so that each file in the ring can poten ti ally have dif ferent toolbar content s. You can also specify the specia l NOFILES toolset, display ed as the top toolbar when no files are in the ring; the bot tom toolbar is empty when no files are in the ring. If this oper and is omit ted, the TOP toolbar is assumed. DE FAULT If the sec ond oper and is DEF AULT, the spec ifie d toolbar display s a de fault toolset that is built into KEDIT. USER toolbuttons If the sec ond oper and is USER, the list speci fie d via the toolbuttons op er and de ter- mines the toolbar’s content s. Toolbuttons is a list with the names of the but tons that should appear on the toolbar. Each item in the list must be the name of a but ton that is either one of the prede fine d toolbar but tons built into KEDIT, or has been previ - ously define d via the SET TOOLBUTTON com mand. Pe riods (‘‘.’’) can also ap - pear in the list to indi cat e spacing betwee n toolbar but tons, which other wise ap pear imm edi ately adjacent to one another. ADD toolbuttons DE Lete toolbuttons If you want to make minor adjust m ents to the current toolbar content s, you can use the ADD or DELETE operands. With ADD, the toolbuttons that you spec ify are added to the end of the current toolbar content s. With DELETE , the toolbuttons that you specify are re moved from the current toolbar content s. If you include a blank-deli m ited period (‘‘.’’) follow ing any item in your list of but tons to be de- leted, KEDIT not only re moves the speci fie d toolbutton from the toolbar, but also any spacing that follows that toolbutton on the toolbar.

272 Chapter 4. The SET Command The file DEFTOOLB.KEX, in the SAMPLES sub direc tory of the main KEDITW directory , has com mands corre spond ing to all of the default SET TOOLSET and SET TOOLBUTTON def i ni tions.

See also SET TOOLBAR, SET TOOLBUTTON

Examples TOOLSET TOP USER . OPEN NEW . UNDO REDO . GET PUT This exam ple speci fie s a user-defined top toolbar that display s some spacing, the OPEN and NEW buttons, more spacing, the UNDO and REDO buttons, more spacing, and then the GET and PUT buttons. OPEN, NEW, UNDO, and REDO are all default tool buttons whose defi ni ti ons are built into KEDIT. Before issuing this com mand, you would need to use the SET TOOLBUTTON com mand to define GET and PUT buttons, since these are not default but tons. You can use QUERY TOOLBUTTON * to see all of the current toolbutton definitions.

TOOLSET TOP DEFAULT TOOLSET TOP ADD . COMPILE DE BUG Here, KEDIT’s default toolbar content s are display ed, fol lowed by some spacing, and then COMPILE and DEBUG buttons, both of which must have been previ ously defined via the SET TOOLBUTTON com mand. If you wanted to display these buttons only when you were edit ing C program s, and other wise display only the default top toolbar, you might have somethi ng like the follow ing in your KEDIT profile:

'reprofile on' if ini tial() then do 'set toolbutton compile /Com pile/ /Com pile file/' 'set toolbutton debug /De bug/ /De bug file/' 'de fine toolmacs.kml' end 'set toolset top default' if fext.1() = 'C' then 'set toolset top add . compile debug' You would also need to define the macros TOOL_COMPILE and TOOL_DEBUG. You would most likely put them in a .KML file (like TOOLMACS.KML in this exam- ple) that is loaded via the DEFINE com mand during the ini tial execu ti on of your profil e at the start of a KEDIT session. s n o i t p O

T E S

SET TOOLSET 273 SET TRAILING

Format [Set] TRAIL ING ON|OFF|SIN GLE|EMPTY

KEDIT default: OFF

Level: File

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET TRAIL ING control s how trail ing blanks in the files that you edit are handled. [Set] TRAILING ON If you put TRAIL ING ON into ef fect, you can work with files that con tain trail ing blanks. Trailing blanks are kept when files are read from disk, you can work with them as you edit the file, and they are include d as part of your file when it is writ ten back to disk. [Set] TRAILING OFF This is the de fault, and it spec ifies that KEDIT will not pro cess trail ing blanks in your files. Trailing blanks are elim inate d as your file is read in from disk. The lines of your file are stored inter nally without any trail ing blanks, and any trail ing blanks that you add while edit ing your file are ignored. When your file is writ ten to disk, it contai ns no trailing blanks. [Set] TRAILING SINGLE This is a rarely-used oper and that works like TRAILING OFF, except that a single trail ing blank is added to each line as it is writ ten to disk. [Set] TRAILING EMPTY This is a rarely-used oper and that works like TRAILING OFF, except that a single trail ing blank is added to each blank line as it is written to disk. Nonblank lines are writ ten to disk with no trail ing blanks.

Note that when RECFM FIXED is in effect, lines in your file can be truncat ed or pad- ded with blanks when they are written to disk so that they will be exactly LRECL bytes long. So in this case, SET TRAIL ING does not control the num ber of trailing blanks writ ten to disk.

See Also User’s Guide Chapter 12, “File Processing”

274 Chapter 4. The SET Command SET TRANSLATEIN, TRANSLATEOUT

Format [Set] TRANSLATEIn NONE|OEMTOANSI [Set] TRANSLATEOut NONE|ANSITOOEM

KEDIT default: NONE

Level: File

Dialog box: Options SET Com mand

Save Set tings handli ng: Not savable

Description SET TRANSLATEIN control s whether KEDIT converts a file from ANSI to OEM as it reads the file in. With the default of TRANSLATEIN NONE, no transla ti on is done. But with TRANSLATEIN OEMTOANSI in effect, KEDIT trans lates text from OEM to ANSI as it loads new files into the ring and when proces sing the GET com mand.

A related com mand, SET TRANSLATEOUT, controls whether KEDIT converts a file from ANSI to OEM as it writes the file to disk. With the default of TRANSLATEOUT NONE, no trans lation is done. But with TRANSLATEOUT ANSITOOEM in effect, KEDIT trans lates text from ANSI to OEM as it writes files to disk dur ing File Save and related opera ti ons and when proces sing the PUT and PUTD commands.

You should be cauti ous about using SET TRANSLATEIN and SET TRANSLATEOUT, because OEM to ANSI con ver sion on a file that is already in ANSI, and ANSI to OEM conver sion on a file that is already in OEM, can leave you with a garbled file. Before using SET TRANSLATEIN or SET TRANSLATEOUT, be sure to read User’s Guide Section 3.7, “Character Sets”, which discusse s the ANSI and OEM char acter sets and KEDIT’s facil ities for dealing with them, and which has a dis - cussion of the proper use of SET TRANSLATEIN and SET TRANSLATEOUT.

See also ANSITOOEM, OEMTOANSI, User’s Guide Section 3.7, “Character Sets”

SET TRUNC

Format [Set] TRunc n|* s n o i

KEDIT default: * (WIDTH value) t p O Level: View T E

Dialog box: Options SET Com mand S

Save Set tings handli ng: Not savable

SET TRUNC 275 Description Use SET TRUNC to control which colum n serves as KEDIT’s ‘‘trunca ti on colum n’’. You can specify a col umn num ber n or can spec ify an aster isk (‘‘*’’) to indi cate that the trunca ti on colum n should be set equal to the value of the WIDTH ini tializa tion option.

The trunca ti on colum n is the rightmost colum n of text that is affected by most KEDIT com mands. You cannot input, overtype, change, or delete charac ter s to the right of the trunca ti on colum n. Depending on the VER IFY set ting, you may be able to see text beyond the trunca ti on colum n, but most KEDIT com mands act as if text to the right of the trunca ti on colum n was not there.

SET TRUNC does not affect how text is read in from disk or writ ten out to disk by KEDIT. The value of the WIDTH initi aliza tion option norm ally con trols the maxi m um length of lines read in, and the LRECL set ting control s the maxi m um length of lines that are written out.

Nor mally, the trun ca tion col umn is equal to the value of the WIDTH initial iza tion option, so there are norm ally no colum ns of your file to the right of the trunca ti on col- umn. There fore, unless you change the default TRUNC value, it has no effect on KEDIT’s opera ti on. The TRUNC value is rarely changed, and is provided for use in spe cial ized situations.

You cannot set your MAR GINS or ZONE colum ns to the right of the trunca ti on col- umn. If you issue a SET TRUNC com mand that speci fie s a colum n to the left of the cur- rent MAR GINS or ZONE colum ns, KEDIT autom ati cal ly resets these colum ns to be equal to the new trunca ti on colum n. If you specify a trunca ti on colum n to the right of the cur rent MARGINS or ZONE col umns, they are not reset.

SET UNDOING

Format [Set] UN DO ING ON|OFF [n [k]]

KEDIT default: ON 200 512

Level: File

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description SET UNDOING control s, whether the undo facil ity is enabled or disable d for the cur- rent file, how many undo levels KEDIT attempts to keep, and the maxi m um amount of mem ory that KEDIT will use to hold the undo inform ati on.

By default, KEDIT will try to save up to the last 200 levels of changes to your file, with a maxi m um of 512K of undo inform ati on per file.

When ever KEDIT reaches the lim its spec ified by SET UNDO ING, it auto mati cally dis- cards as much undo inform ati on as neces sary so that editing can conti nue. No message

276 Chapter 4. The SET Command is given tell ing you that this happened, but you can always tell how many levels of changes are available to the UNDO com mand by looking at the counter display ed on the status line as the third num ber after ALT=. QUERY UNDO gives more inform a- tion, tell ing you how many levels of changes are available for the UNDO com mand, how many levels are avail able for the REDO com mand, and how many kilobyt es of mem ory are occupied by the undo information for the current file.

See also User’s Guide Chapter 3, “Using KEDIT for Windows”, REDO, UNDO

Examples SET UN DO ING ON 400 1024 Tells KEDIT to save up to 400 levels of changes to the current file, with a maxi m um of 1024K for the data involved.

SET VARBLANK

Format [Set] VARblank ON|OFF

KEDIT default: OFF

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description With VARBLANK ON, a blank in a string tar get or column string target will match any string of one or more blanks. This is useful if, for exam ple, the FLOW com mand has justi fied text and you are looking for a group of words that may have had extra blanks sprinkled among them.

With VARBLANK OFF, there is no specia l handli ng of blanks during searches. A blank will only match exactly one blank.

SET VERIFY

Format [Set] Ver ify [Hex] l1 r1 [[Hex] l2 r2 ...] s n o i KEDIT default: 1 * (Col umn 1 through WIDTH value) t p O

Level: View T E

Dialog box: Options SET Com mand S

Save Set tings handli ng: Not savable

SET VERIFY 277 Description Use SET VERIFY to control which colum ns of your file KEDIT display s in the current view of your file.

SET VERIFY has no effect on the content s of your file; it merely affects how KEDIT dis plays your file while you are edit ing it.

In a window 80 col umns wide, KEDIT norm ally display s col umns 1 through 80 of your file. Colum ns of text to the right of col umn 80 are not display ed. With SET VERIFY , you can specify a pair of col umns that are the leftmost and rightmost colum ns that you want KEDIT to display . For exam ple, to have KEDIT display colum ns 20 through 99 of your file, you could enter

SET VER IFY 20 99 To view only colum ns 30 through 40, you could enter

SET VER IFY 30 40 Since the colum ns spec ifie d do not fill the 80-colum n width of the window , most of the docu m ent window would be empty. If, on the other hand, you spec ify a col umn range wider than the window , KEDIT display s only as many colum ns as will fit. So in an 80 col umn window,

SET VER IFY 100 200 would cause KEDIT to display colum ns 100 through 179.

If the rightmost colum n to display is speci fie d as an asterisk (‘‘*’’) or is omit ted, KEDIT display s as many colum ns of your text as will fit. So, in an 80-col umn window , all three of the fol lowing would cause dis play of col umns 1 through 80:

SET VER IFY 1 * SET VER IFY 1 SET VER IFY 1 80 A very power ful aspect of SET VERIFY is that it lets you specify more than one pair of col umns at a time. For example,

SET VER IFY 30 40 10 20 50 * tells KEDIT to display colum ns 30 through 40 of your text, followed by colum ns 10 through 20 of your text, and then all text from colum n 50 on that will fit.

You can pre cede spec ifi ca ti on of a pair of col umns for SET VERIFY with the word ‘‘HEX’’ to tell KEDIT that you want to display and work with the hexa dec i m al value of the char acter codes involved, rather than the char acters themselves. The dis play of each colum n of your file will then occupy two colum ns on your display : the first colum n has the high order hex adec im al digit of the char acter code for the char acter and the sec ond colum n has the low order digit of the code. For example,

SET VER IFY HEX 1 20 1 20 tells KEDIT to display colum ns 1 through 20 of your file in hexa dec i m al form at, and then to display the same col umns again in the nor mal charac ter format.

278 Chapter 4. The SET Command The value of VERSHIFT, which is control led by the LEFT and the RIGHT com mands and by autoscrolling the dis play, inter acts with the SET VERIFY set ting to deter mine which colum ns are actuall y display ed by KEDIT. If, for exam ple, you have an 80-column window and you issue the command

SET VER IFY 1 40 70 * KEDIT will display colum ns 1 through 40 and 70 through 109 of your file. If you then tell KEDIT to shift the win dow to the right by issuing the com mand RIGHT 10, VERSHIFT will be set to 10 and the colum ns dis played will be offset by 10 colum ns from what you speci fied with SET VERIFY . KEDIT will there fore display colum ns 11 through 50 and 80 through 119 of your file.

See also LEFT, RIGHT, SET AUTOSCROLL

SET WINMARGIN

Format [Set] WINMARgin ON|OFF [n]

KEDIT default: ON 6

Level: Global

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description Use SET WINMARGIN to control the display of a mar gin area that you can use to mark line blocks.

When WINMARGIN ON is in effect, a mar gin area—norm ally 6 pixels wide—is dis- played to the left of the first colum n of each docu m ent window . You can use this mar gin area to mark line blocks by plac ing the mouse pointer in the mar gin (the mouse pointer will become an arrow point ing upward and to the right) and dragging with mouse but - ton 1 down. With WINMARGIN OFF, this mar gin area is not displayed.

The second operand to SET WINMARGIN control s the width, in pixels , of the mar gin area. s n o

Examples WINMARGIN ON 6 i t p

Dis play a mar gin area 6 pix els wide. O

T

WINMARGIN ON E S Turn on display of the mar gin area, using whatever pixel width value is current ly in effect.

SET WINMARGIN 279 SET WORD

Format [Set] WORD NONBlank|ALPHAnum [TRAILing|NOTRAILing]

KEDIT default: NONBLANK TRAILING

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description The first operand of SET WORD, NONBLANK or ALPHANUM, con trols what KEDIT consid ers to be a ‘‘word’’ when you use Shift+Ctrl+W (SOS DELWORD), Ctrl+Curr (SOS TABWORD), Ctrl+Curl (SOS T ABWORDB), use the mouse to mark words, or use the MARK STREAM WORD com mand. (Most other areas of KEDIT, such as wordwrap facil ity, para graph reform atti ng, and KEXX built-in functi ons, always conside r groups of consec uti ve nonblank charac ter s to be words and are unaf - fected by SET WORD. Word tar gets look for strings bordered by nonalphanumeric char acters and are also unaf fected by SET WORD.)

With WORD NONBLANK, the default, KEDIT consid ers any group of consec uti ve nonblank charac ter s to be a word.

With WORD ALPHANUM, KEDIT consid ers a group of consec uti ve alphanu m eric char acters (that is, let ters and numbers) to be a word. (Under score char acters and spe - cial char acters with char acter codes greater than 127 are also grouped with the alphanu - meric char acters here. Under scores are fre quently used within vari able names in pro gramm ing lan guages, and many lan guages use accented char acters with char acter codes above 127.) KEDIT also treats a sequence of nonblank charac ter s that are not alpha nu meric (that is, a sequence of punctuation characters) as a word.

Conside r the follow ing exam ple, which might come from a FOR TRAN program :

CALL PRO CESS (PI**2)

With WORD NONBLANK, KEDIT would treat this line as having three words: ‘‘CALL’’, ‘‘PROCESS ’’, and ‘‘(PI**2)’’. If you placed the cursor on the ‘‘P’’ in ‘‘PI’’ and deleted a ‘‘word’’ with Shift+Ctrl+W, then ‘‘(PI**2)’’ would be deleted.

With WORD ALPHANUM, KEDIT would treat this line as having seven words: ‘‘CALL’’, ‘‘PROCESS ’’, ‘‘(’’, ‘‘PI’’, ‘‘**’’, ‘‘2’’, and ‘‘)’’. Placing the cursor on the ‘‘P’’ in ‘‘PI’’ and pressing Shift+Ctrl+W would delete only ‘‘PI’’.

The second operand of SET WORD, TRAIL ING or NOTRAILING, control s whether marking a word (usuall y done by double- clicking on the word) does or does not cause trail ing blanks fol lowing the word to also be marked.

280 Chapter 4. The SET Command SET WORDWRAP

Format [Set] WORDWrap ON|OFF

KEDIT default: OFF

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description With WORDWRAP ON, whenever text that you are entering with KEDIT would extend beyond the right mar gin, a new line is auto mati cal ly added to the file, with the word you are typing placed starting at the left mar gin and the cursor posi tioned so that you can conti nue with your typing.

With WORDWRAP OFF, KEDIT allows text entry to conti nue beyond the right m argin.

See also User’s Guide Chapter 3, “Using KEDIT for Windows”, FLOW, SET MAR GINS

SET WRAP

Format [Set] WRap ON|OFF

KEDIT default: OFF

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Savable

Description The WRAP option affects how far KEDIT searches for a string tar get when you issue a LOCATE, TFIND, FIND, NFIND, FINDUP, or NFINDUP com mand, and when you use the Edit Find dialog box. s

If WRAP is OFF, KEDIT searches from the line below the focus line through the bot - n o i

tom of the file for the desired string. (For a back ward search, KEDIT searches back - t ward from the line above the focus line to the top of the file.) If the string is not found, p O you get a ’’Tar get not found’’ error message . T E

If WRAP is ON, no error occurs when the bot tom of the file is hit. Instead, KEDIT S wraps around to the top of the file and conti nues to search from there. You get an error message if KEDIT goes full circle and hits the focus line again without finding the

SET WRAP 281 string. (With a backward search, when KEDIT hits the top of the file it will wrap around to the bottom of the file and conti nue the search.) If the string is located after wrapping around to the top of the file, KEDIT indi cates this by display ing the message ‘‘Wrapped...’’.

The WRAP option has a sim ilar effect on string colum n searches carrie d out by the CLOCATE com mand when STREAM ON is in effect.

SET ZONE

Format [Set] Zone n1 n2

KEDIT default: 1 * (Col umn 1 through the trunca ti on colum n)

Level: View

Dialog box: Options SET Com mand

Save Set tings handli ng: Not savable

Description The ZONE setti ng affects which colum ns KEDIT looks in when it searches for strings during tar get searches and during the CHANGE and related com mands, and when you use the Edit Find, Edit Replace, and Edit Selecti ve Editing dialog boxes. When KEDIT looks for a string, it only looks within the colum ns spec ifie d by the ZONE set ting. Nor- mally, ZONE is set so that all col umns of text on a line will be searched.

The ZONE setti ng involves two num bers. The first num ber you give is the left end of the zone you want to search. The second num ber is the right end of the zone. The left zone value must be less than or equal to the right zone value. The right zone value must be less than or equal to the trunca ti on colum n. For exam ple,

ZONE 10 20 says that searches should only look in colum ns 10 through 20 of each line. If all or part of the string you are looking for were out side of col umns 10 through 20, the string would not be found.

You can specify an aster isk (‘‘*’’) for the right zone setti ng, and KEDIT will set the right zone colum n equal to the trunca ti on colum n.

ZONE also affects the handli ng of col umn com mands such as CLOCATE and affects the pro cess ing of the CMATCH, FILL, LOW ER CASE, UPPER CASE, SHIFT, ANSITOOEM, OEMTOANSI, and SORT com mands.

Examples ZONE 5 30 String searches should only look in col umns 5 to 30.

282 Chapter 4. The SET Command ZONE 1 * String searches should look in all col umns of your file through the trunca ti on colum n.

SET =

Format Set = text

KEDIT default: Empty string

Level: View

Dialog box: None

Save Set tings handli ng: Not savable

Description SET = can be used to set the content s of the equal buffer, which is norm ally set to repeat the most recently com pleted com mand exe cuted from the KEDIT com mand line. The content s of the equal buffer determ ine the com mand that is re-execute d when you use the = com mand or the REPEAT com mand. SET = is useful mainly from within a KEDIT macro, and provides the only way to change the content s of the equal buffer from within a macro.

Note that toolbar and menu opera ti ons, such as use of the Edit Find dialog box, do not affect the content s of the equal buffer.

See also =, REPEAT s n o i t p O

T E S

SET = 283 Chapter 5. QUERY and EXTRACT

This chapter discusse s the QUERY com mand, which dis plays on your screen inform a- tion about inter nal KEDIT set tings. It discusse s the EXTRACT com mand and the related implied EXTRACT functi ons, which return inform ati on to a macro about inter - nal KEDIT set tings. Finally, it gives details on each of the operands accepted by these com mands and the inform ati on they return.

5.1 QUERY

You can use the QUERY com mand to find out the current value of any KEDIT SET option. KEDIT display s the result of your QUERY on the message line. The form at of the QUERY com mand is:

Query option For exam ple, if you have entered

set zone 5 65 then the com mand

query zone will dis play

zone 5 65 You can use the same mini m al trunca ti ons for option that the SET comm and accepts.

In addi tion to the val ues of KEDIT SET options, you can QUERY the values of some KEDIT ini tializa tion options, such as ISA and WIDTH. You can also QUERY a num - ber of val ues that you cannot directly set at all, such as the SIZE of your file, or the VERSION of KEDIT that you are using. Section 5.3, “QUERY and EXTRACT Operands”, gives full details on all val ues that you can QUERY.

The MODIFY com mand does the same thing as the QUERY com mand, except that it display s the result on the com mand line, pre ceded by the word ‘‘SET’’, so that you can eas ily change the value of a SET option and re-enter it.

The STA TUS com mand dis plays, in a dialog box, the val ues of most SET options.

284 Chapter 5. QUERY and EXTRACT 5.2 EXTRACT and Implied EXTRACTs T C A

EXTRACT The EXTRACT com mand, valid only when issued from a macro, provides one method R command for the macro to obtain inform ati on from KEDIT. T X E /

This discus sion shows how the EXTRACT com mand works, giving the general patter n Y

followed with most operands of the com mand. Section 5.3, “QUERY and EXTRACT R Operands”, gives specif ic details on the vari ables set and inform ati on returned for all E U

EXTRACT operands. Q

Most things that you can QUERY can be EXTRACTed. The EXTRACT com mand is given a list of one or more QUERY operands, surrounded by delim iter charac ter s (a slash (‘‘/’’) is used here, but any nonalphanumeric char acter is accept able). The main differ ence between EXTRACT and QUERY is that, with EXTRACT, the results are not display ed, but are instead used to set the val ues of variable s within your macro. For exam ple, if ZONE 5 65 is in effect,

query zone

would display

zone 5 65

while

extract /zone/

which would norm ally be within quotes in your macro:

’extract /zone/’

will return the current zone setti ng: The vari able ZONE.1 is set to 5 (the left zone col - umn) and ZONE.2 is set to 65 (the right zone colum n). ZONE.0 is set to 2, indi cat ing that two pieces of infor mati on have been returned to your macro.

extract /zone/wrap/

sets ZONE.1 to the left zone, ZONE.2 to the right zone, ZONE.0 to 2, WRAP.1 to the value of WRAP (‘‘ON’’ or ‘‘OFF’’, in uppercas e), and WRAP.0 to 1. In general , if

query option

would display

op tion word1 word2 word3 ... wordn

then

extract /option /

sets option.1 to word1, option.2 to word2, etc., and option.0 to n.

EXTRACT and Implied EXTRACTs 285 Case of The results of a QUERY comm and are usu ally displayed in low er case, while results EXTRACT from EXTRACT are usu ally in upper case. In a few cases, where it is impor tant to return results text exactly as it exists in your file or as it was entered from the key board, the result is returned in mixed case.

When you give an option to the EXTRACT com mand, you can truncat e the option in the same way that you can truncat e it with the SET or QUERY com mand. So, since ‘‘wr’’ is an accept able trun cation for WRAP,

extract /wr/ is acceptable . (Note, however , that WRAP.0 and WRAP.1 would be set in this case, and not WR.0 and WR.1)

Implied Mac ros can also extract inform ati on from KEDIT by using specia l func tions known as EXTRACT implied EXTRACT functi ons. The name of each implied EXTRACT functi on corre - functions sponds to the name of a variable that would be set by the EXTRACT com mand. An implied EXTRACT func tion returns as its value the same infor mation that the EXTRACT functi on would place in the corre spond ing variable . For example,

say zone.1() display s the same thing as

’extract /zone/’ say zone.1 Note that for EXTRACT operands that consis t of more than a single word, for exam ple,

’ex tract /color ar row/’ the additi onal words must be passed to the implied EXTRACT as a param eter . For exam ple:

color.1(’arrow’)

286 Chapter 5. QUERY and EXTRACT 5.3 QUERY and EXTRACT Operands T C

The fol lowing QUERY and EXTRACT operands, supporte d in earli er text mode ver- A R

sions of KEDIT, are not used by this version of KEDIT for Windows: BLINK, BOR- T DER, CURSORSHAPE, EAPRESERVE, ISA, KEYBOARD, LOGO, MOUSE, X E MOUSEBAR, MOUSETEXT, PSCREEN, RETRACE, REXXIO, SCREEN, / Y

SHIFTSTATE, SWAP, SYSRC, and TOPVIEW. Any QUERY or MODIFY com mands R involving these options will yield an error message . EXTRACT com mands and E U

implied EXTRACT functi ons involving these options will return default inform ati on; Q avoiding an error message in this sit ua ti on means that many exist ing macros that use these options will continue to work.

ALT Query ALT display s two num bers: the num ber of alter ations to your file since the last AUTOSAVE or SAVE and the num ber of alter ations since the last SAVE.

EXTract /ALT/ sets these vari ables:

alt.0 2 alt.1 Num ber of al terati ons since last AUTOSAVE or SAVE alt.2 Number of al ter ations since last SAVE

ARBCHAR Query ARBchar display s whether ARBCHAR is ON or OFF, and the first and sec ond ARBCHAR char ac ters.

EXTract /ARBchar/ sets these vari ables:

arbchar.0 3 arbchar.1 ON|OFF arbchar.2 First ARBCHAR char ac ter arbchar.3 Second ARBCHAR charac ter

ARROW Query ARRow dis plays whether ARROW is ON or OFF.

EXTract /ARRow/ sets these vari ables:

ar row.0 1 ar row.1 ON|OFF

ATTRIBUTES QUERY and EXTRACT ATTRIB UTES are sup ported mainly for compat ibil ity with older versions of KEDIT; the corre spond ing SET ATTRIBUTES com mand is also still available but is no longer docu m ented. SET/QUERY COLOR is now preferred.

Query ATTRibutes display s the 30 current attribute values.

QUERY and EXTRACT Operands 287 EXTract /ATTRib utes/ sets these vari ables:

at trib utes.0 30 at trib utes.1 Filearea attrib ute value at trib utes.2 Curline at trib ute value at trib utes.3 Block at trib ute value at trib utes.4 Cblock at trib ute value at trib utes.5 Cmdline at trib ute value at trib utes.6 Idline at trib ute value at trib utes.7 Msgline at trib ute value at trib utes.8 Ar row at trib ute value at trib utes.9 Pre fix at trib ute value at trib utes.10 Pend ing at trib ute value at trib utes.11 Scale attrib ute value at trib utes.12 Tofeof at trib ute value at trib utes.13 Ctofeof at trib ute value at trib utes.14 Tabline at trib ute value at trib utes.15 Shadow at trib ute value at trib utes.16 Statarea attrib ute value at trib utes.17 Di vider at trib ute value at trib utes.18 Scrollbar at trib ute value at trib utes.19 Slider at trib ute value at trib utes.20 Mousebar at trib ute value at trib utes.21 High light at trib ute value at trib utes.22 Chighlight at trib ute value at trib utes.23 Thighlight at trib ute value at trib utes.24 Cthighlight at trib ute value at trib utes.25 Di a log at trib ute value at trib utes.26 Alert at trib ute value at trib utes.27 Tooltip at trib ute value at trib utes.28 Currbox at trib ute value at trib utes.29 Boundmark at trib ute value at trib utes.30 Colmark at trib ute value

AUTOCOLOR Query AUTOCOLOR ext dis plays the name of the parser asso ciated with the speci fied extension, or NULL if there is no such parser.

EXTract /AUTOCOLOR ext/ sets these vari ables:

autocolor.0 2 autocolor.1 Exten sion (with a leading period) autocolor.2 Name of as so ciated parser, or NULL Query AUTOCOLOR * or sim ply Query AUTOCOLOR display s, for each exten sion that has an associ ate d parser, the extension involved and the name of the parser.

288 Chapter 5. QUERY and EXTRACT EXTract /AUTOCOLOR/ or EXTRACT /AUTOCOLOR */ sets the follow ing

vari ables: T C

autocolor.0 num ber of ex ten sions with as so ci ated pars ers A R

autocolor.i ith exten sion (with a leading period) and parser T X E /

AUTOEXIT Query AUTOEXIT display s whether AUTOEXIT is ON or OFF. Y R E

EXTract /AUTOEXIT/ sets these variable s: U Q autoexit.0 1 autoexit.1 ON|OFF

AUTOINDENT Query AUTOIndent display s whether AUTOINDENT is ON or OFF.

EXTract /AUTOIndent/ sets these vari ables:

autoindent.0 1 autoindent.1 ON|OFF

AUTOSAVE Query AUtosave dis plays the alterati on count at which an AUTOSAVE is trig gered, or OFF.

EXTract /AUtosave/ sets these vari ables:

autosave.0 1 autosave.1 n|OFF

AUTOSCROLL Query AUTOSCroll dis plays the cur rent setting of AUTOSCROLL: HALF, OFF, or n col umns.

EXTract /AUTOSCroll/ sets these variables :

autoscroll.0 1 autoscroll.1 HALF|OFF|n

BACKUP Query BACKup dis plays the current setti ng of BACKUP: OFF, TEMP, or KEEP.

EXTract /BACKup/ sets these variables :

backup.0 1 backup.1 OFF|TEMP|KEEP

BEEP Query BEEP display s whether BEEP is ON or OFF.

EXTract /BEEP/ sets these variables :

beep.0 1 beep.1 ON|OFF

QUERY and EXTRACT Operands 289 BLOCK Query BLOCK display s the type of block currentl y marked (LINE, BOX, STREAM, or NONE) and, if a block is defined, the file line and colum n of the start of the block, the file line and colum n of the end of the block, the fileid of the file contai n ing the block, and whether the block is PERSIS TENT or is a SELECTION.

EXTract /BLOCK/ sets these vari ables: block.0 8 block.1 LINE|BOX|STREAM|NONE block.2 Line num ber of start of block (this and fol lowing val ues are set to the null string if no block is marked) block.3 Col umn num ber of start of block block.4 Line num ber of end of block block.5 Col umn num ber of end of block block.6 Fileid of file contai ning marked block block.7 PER SIS TENT|SE LEC TION block.8 Content s of the current ly marked one-line block, or the null string if there is no marked block or the marked block oc cu pies mul ti ple lines

BOUNDMARK Query BOUNDMark display s a list of the types of boundary marker that are current ly active (ZONE, TRUNC, MARGINS, TABS, VER IFY, and/or WINMARGIN) or dis- plays OFF if no boundary markers are active.

EXTract /BOUNDMark/ sets these variables : boundmark.0 1 boundmark.1 One or more of ZONE, TRUNC, MAR GINS, TABS, VERIFY , and WINMARGIN; or OFF

CASE Query CASE dis plays whether text is entered in MIXED case or UPPER case, whether string searches RESPECT or IGNORE case, and whether com pari sons made during the CHANGE com mand RESPECT or IGNORE case.

EXTract /CASE/ sets these variables : case.0 3 case.1 MIXED|UP PER case.2 RE SPECT|IG NORE case.3 RE SPECT|IG NORE

CLICK Query CLICK display s which mouse but ton was last pressed, the mouse pointer’s line and col umn positi on within the docu ment window when the button was pressed, MAR- GIN (if WINMARGIN ON is in effect and the mouse pointer was in the win dow mar - gin when the but ton was pressed) or NOMARGIN, and the line and colum n of the file at which the cursor was located when the button was pressed.

290 Chapter 5. QUERY and EXTRACT EXTract /CLICK/ sets these vari ables: T

click.0 6 C click.1 Num ber of the mouse but ton pressed A R

click.2 Line num ber of mouse pointer within docu m ent window T X

when the button was pressed E /

click.3 Col umn num ber of mouse pointer within docu m ent win- Y R

dow when the button was pressed E

click.4 MARGIN (if WINMARGIN ON in ef fect and mouse U pointer was in window mar gin when button was pressed) Q or NOMARGIN click.5 Line num ber within the file of cursor loca ti on when but - ton was pressed (or -1 if the cursor is not on a line of the file) click.6 Col umn num ber within the file of cursor loca ti on when button was pressed (or -1 if the cursor is not on some col - umn of the file)

CLIPBOARD Query CLIP board display s inform ati on about the Windows clipboard.

When there is no text in the clipboard, Query CLIPboard returns NONE. Other wise , Query CLIP board returns the follow ing inform ati on:

· The type of text in the clipboard: LINE if the text came from a line block, BOX if the text came from a box block, STREAM if the text came from a stream block, from a com mand line se lec tion, or from the CLIPBOAR D PUT com mand, and FOREIGN if the text came from an appli cati on other than KEDIT.

· If the clipboard text came from a box block, the width of the box block; other wise , this item is omit ted.

· The size of the clip board text, in char acters

· The size of the clipboard text, in lines

EXTract /CLIP board/ sets these variables:

clip board.0 5 clip board.1 LINE|BOX|STREAM|FOREIGN or NONE clip board.2 If CLIPBOAR D.1 = BOX, width of the box block; other - wise, the null string clip board.3 Size of clip board text, in char ac ters clip board.4 Size of clip board text, in lines clip board.5 Content s of the clipboard, if the length of the text is less than or equal to the WIDTH setti ng, and other wise the null string. The text may con tain mul tiple lines of data, with car riage re turn and line feed char acters marking the end of each line.

QUERY and EXTRACT Operands 291 CLOCK Query CLOCK display s whether display of the time of day on the status line is turned ON or OFF.

EXTract /CLOCK/ sets these vari ables: clock.0 1 clock.1 ON|OFF

CMDLINE Query CMDline display s whether CMDLINE is set to ON, OFF, TOP, or BOTT OM. EXTract /CMDline/ sets these variables : cmdline.0 3 cmdline.1 ON|OFF|TOP|BOT TOM cmdline.2 Line num ber within window of com mand line, or 0 if CMDLINE OFF cmdline.3 Content s of com mand line, in mixed case, or the null string, if CMDLINE OFF

COLMARK Query COLMark display s a list of the file col umns at which colum n markers are dis- played, or OFF if colum n marking is not active.

EXTract /COLMark/ sets these vari ables: colmark.0 1 colmark.1 List of one or more col umn num bers, or OFF

COLOR Query COLOR field display s the color set ting for field, where field is one of the follow - ing: Arrow, Block, BOUNDMark, CBlock, CHIghlight, Cmdline, COLMark, CTHIghlight, CTofeof, CUrline, CURRBox, Filearea, HIgh light, Idline, Msgline, Pending, PRefix, Scale, SHadow, Tabline, THIghlight, TOfeof, TOOLTip.

EXTract /COLOR field/ sets these vari ables: color.0 1 color.1 Field name fol lowed by the field’s color Query COLOR * or simply Query COLOR dis plays the color set ting for all of the fields that KEDIT uses, in al phabet i cal order .

If MONI T OR WINDOWS is in effect, KEDIT uses 18 field types: ARROW, BLOCK, BOUNDMARK, CMDLINE, COLMARK, CURRBOX, FILEAREA, HIGHLIGHT , IDLINE, MSGLINE, PENDING , PRE FIX, SCALE, SHADOW, TABLINE, THIGHLIGHT, TOFEOF, and TOOLTIP. If MONI T OR COLOR or MONI T OR MONO is in effect, KEDIT uses 5 additi onal field types: CBLOCK, CHIGHLIGHT, CURLINE, CTHIGHLIGHT, and CTOFEOF.

EXTract /COLOR/ or EXTract /COLOR */ sets the follow ing variables : color.0 18 (if MONI T OR WIN DOWS is in ef fect) or 23 (if MONI T OR COLOR or MONI T OR MONO are in ef fect)

292 Chapter 5. QUERY and EXTRACT color.i ith al pha bet ical field type, follow ed by its color T

COLORING Query COLOR ING display s whether the syn tax color ing facility is ON or OFF for the C A

current file and display s the name of the parser for the current file, or AUTO if KEDIT R deter mines the parser from the cur rent file extension. T X E /

EXTract /COL OR ING/ sets these vari ables: Y R E

col or ing.0 3 U

col or ing.1 ON|OFF Q col or ing.2 AUTO|parser (parser speci fied via SET COLOR ING) col or ing.3 parser (ac tual parser; same as COL OR ING.2 un less COL - ORING .2 is AUTO)

COLUMN Query COLum n display s the colum n num ber of the focus colum n.

EXTract /COL umn/ sets these vari ables:

col umn.0 1 col umn.1 Col umn num ber of the focus colum n

CURLINE Query CURLine display s the desired current line locati on, as speci fie d by SET CURLINE.

EXTract /CURLine/ sets the variables listed below. Note that CURLINE.1 and CURLINE.2 have inform ati on about the locati on of the current line, while CURLINE.3, CURLINE.4, CURLINE.5, and CURLINE.6 have inform ati on about the focus line.

curline.0 6 curline.1 Value of CURLINE set ting curline.2 Line num ber within window of current line curline.3 Content s of the focus line, in mixed case curline.4 ‘‘ON’’ if the focus line has been changed during the edit - ing session (the line’s new or change bit is set); other wise ‘‘OFF’’ curline.5 ‘‘NEW CHANGED’’ if the focus line has been added dur- ing the edit ing session, ‘‘OLD CHANGED’’ if the focus line has sim ply been changed during the edit ing session, and ‘‘OLD’’ other wise , as de ter mined from the line’s new and change bits curline.6 Se lection level of the fo cus line. (Same value as SELECT.1, but us ing CURLINE.6 is much more ef fi- cient) Relat ed infor m ati on: LINE.1 has the line num ber within the file of the focus line; LINE.2 has the line num ber within the file of the current line; LENGTH.1 has the length of the focus line; LINEFLAG.1, LINEFLAG.2, and LINEFL AG.3 have the flag

QUERY and EXTRACT Operands 293 bits for the focus line; NBSCOPE.2 has the line num ber within the current scope of the fo cus line.

CURRBOX Query CURRBox display s two values indicat ing whether display of a box around the current line is ON or OFF when the cursor is on the com mand line and when it is in the file area.

EXTract /CURRBox/ sets these vari ables: currbox.0 2 currbox.1 ON|OFF (for box drawn when cursor is on com mand line) currbox.2 ON|OFF (for box drawn when cur sor is in file area)

CURSOR Query CUR Sor dis plays inform ati on about the current loca tion of the cursor: the line and col umn loca tion in the win dow and also the line and colum n loca tion within your file (or -1 and -1 if the cursor is not in the file area). The same four num bers are also given for the positi on the cur sor occu pied when the last SOS EXECUTE com mand issued began execution.

EXTract /CUR Sor/ sets these vari ables: cur sor.0 8 cur sor.1 Line num ber of cur sor in window cur sor.2 Col umn num ber of cur sor in window cur sor.3 Line num ber of cur sor in file, or -1 cur sor.4 Col umn num ber of cur sor in file, or -1 cur sor.5 Previ ous line num ber of cur sor in window cur sor.6 Previ ous col umn num ber of cur sor in window cur sor.7 Previ ous line num ber of cur sor in file, or -1 cur sor.8 Previ ous col umn num ber of cur sor in file, or -1

CURSORSIZE Query CURSORSIze display s inform ati on about the size of the cursor , as a percent age of the height or width of a charac ter in the current font. Four num bers are display ed: the width used for a verti cal cursor when Overtype Mode and then when Insert Mode are in effect, and the height used for a hori zon tal cursor when Overtype Mode and then when Insert Mode are in effect.

EXTract /CURSORSIze/ sets these vari ables: cursorsize.0 4 cursorsize.1 Width (as per cent age of width of char ac ters in cur rent font) of verti cal cursor in Overtype Mode cursorsize.2 Width of verti cal cursor in Insert Mode cursorsize.3 Height of hori zon tal cursor in Overtype Mode cursorsize.4 Height of hori zon tal cursor in Insert Mode

CURSORTYPE Query CURSORType display s the type of cursor being used: VER TICAL, HORIZONTAL, or dependent on the INTERF ACE setti ng.

294 Chapter 5. QUERY and EXTRACT EXTract /CURSORType/ sets these variables : T

cursortype.0 1 C cursortype.1 VER TI CAL|HOR I ZON TAL|IN TER FACE A R T X E

DEBUGGING Query DEBUG Ging display s whether or not the debug ging win dow is ON or OFF, the /

height of the debugging win dow, and the trace set ting for macros run with the DEBUG Y R

comm and. E U

EXTract /DEBUG Ging/ sets these variables : Q

de bug ging.0 3 de bug ging.1 ON|OFF de bug ging.2 Height of the debug ging window in lines de bug ging.3 Initial trace set ting in effect for macro s run with the DEBUG com mand

DEFEXT Query DEFEXT display s whether DEFEXT is ON or OFF.

EXTract /DEFEXT/ sets these vari ables:

defext.0 1 defext.1 ON|OFF

DEFPROFILE Query DEFPROFile dis plays the fileid of the default pro file.

EXTract /DEFPROFile/ sets these variables :

defprofile.0 1 defprofile.1 Fileid of de fault pro file

DEFSORT Query DEFSORT display s inform ati on on how DIR.DIR files are sorted: either OFF or some com bina tion of DATE, EXTENSION, NAME, PATH, and SIZE.

EXTract /DEFSORT/ sets these vari ables:

defsort.0 1 defsort.1 OFF or one or more of DATE, EXTEN SION, NAME, PATH, and SIZE

DIRECTORY Query DIRectory [d:] display s the name of the current directory of the spec ifie d drive. If no drive is speci fie d, the current directory of the current drive is display ed.

EXTract /DIRec tory/ sets these variables:

di rec tory.0 2 di rec tory.1 Current direc tory of current drive, in upper cas e. di rec tory.2 Current direc tory of current drive, in mixed case

QUERY and EXTRACT Operands 295 EX Tract /DI Rec tory d:/ sets these vari ables:

di rec tory.0 2 di rec tory.1 Cur rent di rec tory of drive d:, in upper cas e di rec tory.2 Cur rent di rec tory of drive d:, in mixed case

DIRFILEID Query DIRFileid dis plays infor mation about a file in a direc tory list ing. The focus line is assumed to con tain a file descrip tion. If the cur rent file was created by the DIR com- mand or has an extension of .DIR, the descripti on is assumed to be in the usual DIR.DIR for mat. Oth er wise, the focus line is assumed to have a complete fileid, start - ing in colum n 1. Inform ati on returned is the full fileid involved, and then each of the four com ponents of the fileid: the drive specifier (with a trail ing colon; a null string is returned if the fileid is a UNC name), the direc tory spec ifi ca tion (with no trail ing back - slash added), the file name, and the file extension.

Note that invalid fileids yield unpre dict able results, except that if the focus line is the top-of-file or end-of-file line or has a blank in colum n 1, null strings will always be returned for all values.

EXTract /DIRFileid/ sets these variables : dirfileid.0 5 dirfileid.1 Full fileid dirfileid.2 Drive specifier, or null string if fileid is a UNC name dirfileid.3 Direc tor y speci fi ca tion dirfileid.4 File name dirfileid.5 File ex ten sion

DIRFORMAT Query DIRFORMat display s the num ber of col umns used to display a file’s name, exten sion, and year of last mod ifi ca tion in a DIR.DIR file.

EXTract /DIRFORMat/ sets these vari ables: dirformat.0 3 dirformat.1 The num ber of col umns used to display the file’s name dirformat.2 The num ber of col umns used to display the file’s exten - sion (or 0 if the name and exten sion are display ed in a sin gle com bined field) dirformat.3 The num ber of col umns used to display the year that the file was last mod ified

DISPLAY Query DIS Play dis plays the min i mum and max i mum dis play able selec tion levels.

EXTract /DIS Play/ sets these vari ables: dis play.0 2 dis play.1 Min i mum dis play able se lec tion level dis play.2 Max i mum dis play able se lec tion level

296 Chapter 5. QUERY and EXTRACT DOCSIZING Query DOCSIZing indicat es whether new and cascade d docu m ent windows are sized using STANDARD or EXTENDED rules, and display s the colum n width used for doc - T

um ent windows sized according to extended rules. C A

EXTract /DOCSIZing/ sets these vari ables: R T X E

docsizing.0 2 /

docsizing.1 STAN DARD|EX TENDED Y R

docsizing.2 Col umn width for docu m ent windows sized accord ing to E ex tended rules U Q DRAG Query DRAG display s the type of block marking or other opera ti on invoked by drag- ging the mouse (LINE, BOX, STREAM, CMDLINE, DRAGDROP, or NONE), whether a block to be marked is PER SISTENT or a SELECTION, the ANCHOR or WORD option in effect, and RESET if drag ging will reset any existing block.

EXTract /DRAG/ sets these vari ables: drag.0 1 if DRAG NONE or DRAG DRAGDROP in ef fect, oth- erwis e 4 drag.1 BOX|LINE|STREAM|CMDLINE|DRAGDROP|NONE drag.2 PER SIS TENT|SE LEC TION (this and the fol low ing items not set if DRAG NONE or DRAG DRAGDROP in ef - fect) drag.3 AN CHOR|WORD drag.4 RE SET or null string

ECOLOR Query ECOLOR c dis plays the ECOLOR set ting for the spec ified item, which must be in the range A—Z or 1—9.

EXTract /ECOLOR c/ sets these vari ables: ecolor.0 1 ecolor.1 The letter or num ber that you spec ifie d, followe d by the cor re spond ing color. Query ECOLOR * or simply Query ECOLOR dis plays the ECOLOR set ting for each of the charac ter s, A—Z and 1—9, used with ECOLOR.

EXTract /ECOLOR/ or EXTract /ECOLOR */ sets the fol low ing variables : ecolor.0 35 ecolor.i ith charac ter (A—Z or 1—9), followe d by the corre - spond ing color

EFILEID Query EFILEId display s the fileid that the current file had when it was added to the ring.

QUERY and EXTRACT Operands 297 EXTract /EFILEId/ sets these vari ables: efileid.0 2 efileid.1 Orig inal fileid of cur rent file, in up per case efileid.2 Orig inal fileid of cur rent file, in mixed case if FCASE ASIS in ef fect or lower case if FCASE LOWER in ef fect

EOF Query EOF display s whether or not the focus line locati on is ON or OFF the end-of-file (or end-of-range) line.

EXTract /EOF/ sets these vari ables: eof.0 1 eof.1 ON|OFF

EOFIN Query EOFIN display s the current setti ng of EOFIN: ALLOW or PREVENT .

EXTract /EOFIN/ sets these vari ables: eofin.0 1 eofin.1 AL LOW|PRE VENT

EOFOUT Query EOFOUT display s the current setti ng of EOFOUT: EOL, EOLEOF, EOF, or NONE.

EXTract /EOFOUT/ sets these vari ables: eofout.0 1 eofout.1 EOL|EOLEOF|EOF|NONE

EOL Query EOL display s whether or not the focus colum n is located ON or OFF the end-of-line colum n (which is one colum n to the right of the right zone colum n, by anal- ogy with the end-of-file line).

EXTract /EOL/ sets these vari ables: eol.0 1 eol.1 ON|OFF

EOLIN Query EOLIN dis plays the current setti ng for EOLIN: CR, CRORLF, LF, or NONE.

EXTract /EOLIN/ sets these vari ables: eolin.0 1 eolin.1 CR|CRORLF|LF|NONE

298 Chapter 5. QUERY and EXTRACT EOLOUT Query EOLOUT display s the current setti ng for EOLOUT: CR, CRLF, LF, or NONE. T

EXTract /EOLOUT/ sets these vari ables: C A

eolout.0 1 R T

eolout.1 CR|CRLF|LF|NONE X E / Y

FCASE Query FCASE dis plays whether KEDIT is keep ing fileids in all LOWER case, or R whether fileids are kept ASIS (‘‘as is’’). E U Q EXTract /FCASE/ sets these vari ables: fcase.0 1 fcase.1 ASIS|LOWER

FEXT Query FExt display s the extension of the current fileid.

EXTract /FExt/ sets these vari ables: fext.0 2 fext.1 Exten sion of current fileid in upper cas e fext.2 Exten sion of current fileid, in mixed case if FCASE ASIS is in ef fect or low er case if FCASE LOWER is in effect

FIELD Query FIELD displays the con tents of the cur sor field, the char acter at the cur sor loca - tion, the loca tion of the cursor within the data of the cursor field, and the type of field involved (COMMAND, TEXT, or PREFIX).

EXTract /FIELD/ sets these vari ables: field.0 4 field.1 Content s of cursor field field.2 Charac ter at curso r loca tion field.3 Loca ti on of cursor within data of cursor field field.4 COM MAND|TEXT|PRE FIX

FIELDWORD Query FIELDWORD display s the word nearest the cursor locati on in the cursor field. Two interpre ta ti ons of a word are display ed. For the first, KEDIT consid ers any group of consec uti ve alphanu m eric charac ter s, or any group of nonblank charac ter s that are all non-alphanu m eric, to be a word. For the sec ond, KEDIT consid ers any group of nonblank charac ter s to be a word.

EXTract /FIELDWORD/ sets these vari ables: fieldword.0 2 fieldword.1 Field word consis ting of any group of consec uti ve al pha- num eric charac ter s or a group of nonblank charac ter s that are not al pha nu meric fieldword.2 Field word consis ting of a group of nonblank charac ter s

QUERY and EXTRACT Operands 299 FILEID Query FILEId display s the fileid of the current file: drive specifier, path, name, exten sion.

EXTract /FILEId/ sets these vari ables: fileid.0 2 fileid.1 Fileid of current file, in upper cas e fileid.2 Fileid of cur rent file, in mixed case if FCASE ASIS is in ef fect or low er case if FCASE LOWER is in effect

FILESEARCH When you use QUERY FILESEARCH fileid, KEDIT searches for fileid in the same way that it would if you issued a KEDIT com mand using that spec ifie d fileid. QUERY FILESEARCH returns infor mati on about the result of that search, but does not actuall y edit the speci fie d file, as the KEDIT com mand would do. QUERY FILESEARCH fileid returns ERROR if an error is encounter ed in searching for the file, RING if the spec ified file is already in the ring, DISK if the file is on disk and would be loaded into the ring by a KEDIT com mand, or NEW if the file does not already exist and would be edited as a new file. When QUERY FILESEARCH fileid returns DISK, RING, or NEW, it also returns the fully-quali fie d name of the fileid involved, which can be affected by the path search KEDIT carrie s out for the file, and by set tings like FCASE and DEFEXT. For exam ple, if SAM PLE.FIL is found in the current directory , the current directory is C:\TEST, and SAMPLE. FIL is not cur rently in the ring, QUERY FILESEARCH SAMPLE.FIL would return

DISK C:\TEST\SAMPLE.FIL EXTract /FILESEARCH fileid/ sets these vari ables: filesearch.0 1 if FILESEARCH.1 is ER ROR, else 2 filesearch.1 DISK|RING|NEW|ER ROR filesearch.2 If FILESEARCH.1 is not ER ROR, set to fully qual ified fileid in the case (lower or mixed, as de ter mined by the FCASE set ting) that KEDIT would store the fileid in ter - nally

FILESTATUS Query FILESTATUS dis plays three items:

· The sharing mode under which the current file is locked: DENYWRITE or DENYREADWRITE, with NONE for a file that is not locked.

· The type of access KEDIT has to the file: READONLY or READWRITE. KEDIT con sid ers it self to have read-only ac cess to a file if the file’s di rec tory en try was marked as read-only when KEDIT be gan ed iting the file. Oth er wise, KEDIT con sid ers it self to have read-write ac - cess to the file.

300 Chapter 5. QUERY and EXTRACT · The third item is the end-of-line se quence KEDIT found at the end of the

first line of the file when it read the file in. This can be CR, LF, or CRLF, T

in di cat ing a car riage re turn, line feed, or car riage re turn-line feed pair. It C A

can also be NONE, in di cat ing that the file is a new file that did not ex ist R

on disk, that the file contai ned no end-of-line se quences, or that the file T X

was read in with EOLIN NONE in effect. E / Y

EXTract /FILESTATUS/ sets these vari ables: R E

filestatus.0 3 U Q filestatus.1 DENYWRITE|DENYREADWRITE|NONE filestatus.2 READONLY|READWRITE filestatus.3 CR|LF|CRLF|NONE

FLSCREEN Query FLscreen display s the line num bers of the first and last lines of the file that are visi ble in the current window (or which would be visi ble if the display were refreshed).

EXTract /FLscreen/ sets these vari ables: flscreen.0 2 flscreen.1 File line number of first file line in win dow flscreen.2 File line number of last file line in win dow

FMODE Query FMode display s the drive specifier of the current fileid as a drive letter followe d by a colon, or display s NONE if the current fileid is a UNC name.

EXTract /FMode/ sets these vari ables: fmode.0 2 fmode.1 Drive specifier of current fileid, in upper cas e, or the null string if the cur rent fileid is a UNC name. fmode.2 Drive specifier of cur rent fileid, in up per case if FCASE ASIS is in ef fect or lower case if FCASE LOWER is in ef - fect, or the null string if the cur rent fileid is a UNC name

FNAME Query FName displays the file name of the cur rent file.

EXTract /FName/ sets these vari ables: fname.0 2 fname.1 File name of cur rent file, in up per case fname.2 File name of cur rent file, in mixed case if FCASE ASIS is in ef fect or low er case if FCASE LOWER is in effect

FOCUSWORD Query FOCUSWORD display s the word on the focus line nearest the cursor or nearest the current colum n if the cursor is not on the focus line. Two interpre ta ti ons of a word are display ed. For the first, KEDIT consid ers any group of consec uti ve alphanu m eric charac ter s, or any group of nonblank charac ter s that are all non-alphanu m eric, to be a word. For the second, KEDIT consid ers any group of nonblank charac ter s to be a word.

QUERY and EXTRACT Operands 301 When the cursor is in the file area, QUERY FOCUSWORD returns the same inform a- tion as QUERY FIELDWORD.

EXTract /FOCUSWORD/ sets these vari ables: focusword.0 2 focusword.1 Focus word consis ting of any group of consec uti ve al pha- num eric charac ter s or a group of nonblank charac ter s that are not al pha nu meric focusword.2 Focus word consis ting of a group of nonblank charac ter s

FORMAT Query FOR MAT dis plays the val ues con trol ling para graph jus ti fi ca tion (JUS TIFY or NOJUSTIFY), how para graph bound aries are determ ined (BLANK or EXTENDED), and whether sentenc es are fol lowed by SINGLE or DOUBLE blanks when reformatted.

EXTract /FOR MAT/ sets these vari ables: for mat.0 3 for mat.1 JUS TIFY|NOJUSTIFY for mat.2 BLANK|EX TENDED for mat.3 DOU BLE|SIN GLE

FPATH Query FPath display s the directory path of the current fileid. No trail ing backsla sh is added to the directory path.

EXTract /FPath/ sets these vari ables: fpath.0 2 fpath.1 Direc tory path of current fileid, in upper cas e fpath.2 Di rec tory path of cur rent fileid, in mixed case if FCASE ASIS is in ef fect or lower case if FCASE LOWER is in ef - fect

FTYPE Query FType display s the extension of the current fileid.

EXTract /FType/ sets these variables: ftype.0 2 ftype.1 Exten sion of current fileid, in upper cas e ftype.2 Exten sion of current fileid, in mixed case if FCASE ASIS is in ef fect or low er case if FCASE LOWER is in effect

302 Chapter 5. QUERY and EXTRACT HELPDIR Query HELPDIR dis plays the Help file direc tory name if it has been speci fied via SET HELPDIR, or else dis plays *COM MAND. T C

EXTract /HELPDIR/ sets these variables : A R T

helpdir.0 2 X E helpdir.1 SET HELPDIR direc tory name, in mixed / Y

case, or * COMMAND R E U

HEX Query HEX display s whether HEX is ON or OFF. Q

EXTract /HEX/ sets these vari ables:

hex.0 1 hex.1 ON|OFF

HEXDISPLAY Query HEXDISPlay display s whether HEXDISPLAY is ON or OFF.

EXTract /HEXDISPlay/ sets these variables:

hexdisplay.0 1 hexdisplay.1 ON|OFF

HIGHLIGHT Query HIGHli ght dis plays the current setti ng of HIGH LIGHT: OFF, ALTERED, SELECT n m, or TAGGED.

EXTract /HIGH light/ sets these vari ables:

high light.0 3 if HIGHLIGHT SELEC T is in ef fect; other wise 1 high light.1 OFF|AL TERED|SE LECT|TAGGED high light.2 If HIGHLIGHT SELEC T is in ef fect, the low est selec tion level high lighted high light.3 If HIGH LIGHT SELECT is in ef fect, the high est selec - tion level highli ghted

IDLINE Query IDline display s whether IDLINE is ON or OFF.

EXTract /IDline/ sets these vari ables:

idline.0 1 idline.1 ON|OFF

IMPMACRO Query IMPMACro display s whether IMPMACRO is ON or OFF.

EXTract /IMPMACro/ sets these variables :

impmacro.0 1 impmacro.1 ON|OFF

QUERY and EXTRACT Operands 303 INISAVE Query INISAVE dis plays whether state inform ati on will be saved in the Windows registryat the end of the editing session (STATE|NOSTATE) and whether history infor- mation will be saved (HIST ORY|NOHISTORY).

EXTract /INISAVE/ sets these variables:

inisave.0 2 inisave.1 STATE|NOSTATE inisave.2 HIS TORY|NOHISTORY QUERY/EXTRACT REGSAVE, which returns the same inform ation as QUERY/EXTRACT INISAVE, is now the preferred form.

INITIALDIR Query INITIALDIR display s how the cur rent directory is determ ined at the start of an edit ing ses sion when no initial fileid is spec ified (PRE SERVE or RECALL) and when an initial fileid is spec ified (PRE SERVE, RECALL, or FIRSTFILE).

EXTract /INITIALDIR/ sets these variable s:

initialdir.0 2 initialdir.1 PRE SERVE|RE CALL initialdir.2 PRE SERVE|RE CALL|FIRSTFILE

INITIALDOCSIZE Query INITIALDOCsize dis plays whether the ini tial doc u ment win dow cre ated at the start of a session is MAXI MIZE D, NORMAL (non-maxi m ized) or RECALL (maxi - mized or non-maxi m ized depending on the state of the last docu m ent window in the pre ced ing editing session).

EXTract /INITIALDOCsize/ sets these variable s:

initialdocsize.0 1 initialdocsize.1 MAX I MIZED|NOR MAL|RE CALL

INITIALFRAMESIZE Query INITIALFRAMEsize display s whether KEDIT’s frame window is initi ally MAX I MIZED, NOR MAL (non-max i mized) or RECALL (max i mized or non-max i- mized depending on its state at the end of the preced ing editing session). EXTract /INITIALFRAMEsize/ sets these variables :

initialframesize.0 1 initialframesize.1 MAX I MIZED|NOR MAL|RE CALL

INITIALINSERT Query INITIALINSert display s whether Insert Mode is ON or OFF at the start of a KEDIT session.

EXTract /INITIALINSert/ sets these vari ables:

initialinsert.0 1 initialinsert.1 ON|OFF

304 Chapter 5. QUERY and EXTRACT INITIALWIDTH Query INITIALWidth display s the WIDTH value that KEDIT puts into effect by default at the start of an editing ses sion. T C

EXTract /INITIALWidth/ sets these vari ables: A R T

initialwidth.0 1 X E initialwidth.1 INITIALWIDTH value / Y R E

INPUTMODE Query INPUTMode display s the current setti ng of INPUTMODE: OFF, FULL, or U

LINE. Q

EXTract /INPUTMode/ sets these vari ables:

inputmode.0 1 inputmode.1 OFF|FULL|LINE

INSERTMODE Query INSERTmode display s whether INSERTMODE is ON or OFF.

EXTract /INSERTmode/ sets these vari ables: insertmode.0 1 insertmode.1 ON|OFF

INSTANCE Query INSTANCE display s the cur rent setting of INSTANCE: SINGLE if only a sin- gle instance of KEDIT will run at a time, or else MUL TI PLE.

EXTract /INSTANCE/ sets these vari ables:

in stance.0 1 in stance.1 SIN GLE|MUL TI PLE

INTERFACE Query INTER FACE display s the type of inter face conven ti ons in effect, either CUA or CLAS SIC.

EXTract /INTER FACE/ sets these vari ables:

in ter face.0 1 in ter face.1 CUA|CLAS SIC

INTERNATIONAL Query INTER NA Tional display s the values con trol ling whether inter nati onal case con- venti ons are in use (CASE or NOCASE) and whether inter nati onal sorting conven ti ons are in use (SORT or NOSORT).

EXTract /INTER NA Tional/ sets these vari ables:

in ter na tional.0 2 in ter na tional.1 CASE|NOCASE in ter na tional.2 SORT|NOSORT

QUERY and EXTRACT Operands 305 KEYSTYLE Query KEYSTYLE display s whether the STAN DARD or ADJUSTED behavior of the of the Enter, Home, Delete, Back space, and Alt keys will be used when INTER FACE CUA is in effect.

EXTract /KEYSTYLE/ sets these variables:

keystyle.0 5 keystyle.1 STAN DARD|AD JUSTED (En ter key) keystyle.2 STAN DARD|AD JUSTED (Home key) keystyle.3 STAN DARD|AD JUSTED (De lete key) keystyle.4 STAN DARD|AD JUSTED (Back space key) keystyle.5 STAN DARD|AD JUSTED (Alt key) The de fault def ini ti ons for these keys test the rele vant KEYSTYLE set ting and use it to decide how they will op erate . In fact, none of KEDIT’s ‘‘hard-coded’’ behav ior de - pends on the value of KEYSTYLE; KEYSTYLE is only used within these defaul t key definitions.

LASTKEY Query LASTKEY display s inform ati on about the last key read from the keyboard by KEDIT’s key board handler . (This is norm ally the key that KEDIT is current ly proces s- ing. For exam ple, if you press the F4 key and the macro assigned to that key issues the QUERY LASTKEY com mand, it is F4 that is reported on.) QUERY LASTKEY does not report on keys read with the READV CMDLINE, DIALOG , or ALERT com mands, but does report on keys read via READV KEY.

KEDIT gives you the name of the last key read (as described in Chapter 7, “Built-in Macro Handling”), the charac ter associ ate d with the key (or a null string for functi on keys, etc.), the scan code (a dec im al num ber from 0 to 255) of the key, and the Shift Sta- tus at the time KEDIT read the key. See the descrip tion of the READV KEY comm and for more inform ati on on the inform ati on returned.

Query LASTKEY n, where n can range from 1 to 8, gives sim ilar inform ati on for the nth most recently read key. That is, Query LASTKEY 1 gives inform ati on on the most recently read key (this is the same as Query LASTKEY), Query LASTKEY 2 gives inform ati on on the second most recently read key, etc.

If no keys (or not enough keys) have been read yet by KEDIT, null strings are returned for the key name and charac ter code 0 is returned for the scan code and Shift Status.

EXTract /LASTKEY [n]/ sets these vari ables:

lastkey.0 5 under Windows XP/2000/Vista; 4 under Windows 98/Me lastkey.1 Key name (in up per case, with pos sible "C-", "S-", "A-", "S-C-", or"A-C-" pre fix; "-" is al ways used in the pre fix rather than "+" for compat ibil ity with ear lier ver sions of KEDIT) lastkey.2 Char ac ter (or null string) lastkey.3 Scan code

306 Chapter 5. QUERY and EXTRACT lastkey.4 Shift Sta tus (see the ta ble given with the READV com- mand on page 111) T

lastkey.5 Extende d Shift Status (see the ta ble given with the C READV com mand on page ; not set on Windows 98/Me) A R T X

LASTMSG Query LASTmsg dis plays the text of the last mes sage or error message gen er ated for E /

display in the current window . If MSGMODE OFF is in effect, the message may not Y actu ally have been displayed. KEDIT trun cates the text of messages that are lon ger R E

than 160 characters. U Q EXTract /LASTmsg/ sets these vari ables: lastmsg.0 1 lastmsg.1 Text of last message, in mixed case

LASTOP Query LASTOP command display s the operand used when command was last issued from the com mand line. The com mand can be ALter, Change, CLocate, COUnt, Find, Locate, SCHange, or TFind.

EXTract /LASTOP com mand/ sets these vari ables: lastop.0 1 lastop.1 name of the com mand and, in mixed case, its last oper and Query LASTOP * or sim ply QUERY LASTOP display s a list of the names and last operands for all eight com mands that have rem em bered operands.

EXTract /LASTOP */ sets these variables: lastop.0 8 lastop.1 AL TER and, in mixed case, its last op er and lastop.2 CHANGE and, in mixed case, its last op er and lastop.3 CLOCATE and, in mixed case, its last op er and lastop.4 COUNT and, in mixed case, its last op er and lastop.5 FIND and, in mixed case, its last op er and lastop.6 LO CATE and, in mixed case, its last op er and lastop.7 SCHANGE and, in mixed case, its oper and lastop.8 TFIND and, in mixed case, its last op er and

LASTRC Query LASTRC display s the return code gener ate d by the last com mand issued from the com mand line (that is, the return code in effect when an SOS EXECUTE com mand last com pleted exe cu tion).

EXTract /LASTRC/ sets these vari ables: lastrc.0 1 lastrc.1 Return code from last com mand line com mand. (The macro vari able RC, set af ter each comm and to the re turn code from that com mand, is more frequentl y use ful.)

QUERY and EXTRACT Operands 307 LENGTH Query LENgth display s the length of the focus line, with trail ing blanks ignored.

EXTract /LENgth/ sets these variables :

length.0 1 length.1 Length of focus line

LINE Query LIne display s the line num ber within the current file of the focus line.

EXTract /LIne/ sets these vari ables:

line.0 2 line.1 Line num ber within current file of focus line. (See NBSCOPE.2 for line num ber within current scope) line.2 Line num ber within current file of the current line

LINEFLAG Query LINEFLAG dis plays the flags asso ci ated with the focus line: NEW|NONEW, CHANGE|NOCHANGE, and TAG|NOTAG.

EXTract /LINEFLAG/ sets these vari ables: lineflag.0 3 lineflag.1 NEW|NONEW lineflag.2 CHANGE|NOCHANGE lineflag.3 TAG|NOTAG

LINEND Query LINENd display s whether LINEND is ON or OFF, and dis plays the linend character. EXTract /LINENd/ sets these variables: linend.0 2 linend.1 ON|OFF linend.2 Linend charac ter

LOCKING Query LOCKING display s whether LOCKING is ON or OFF.

EXTract /LOCKING/ sets these vari ables:

lock ing.0 1 lock ing.1 ON|OFF

LRECL Query LRecl dis plays the LRECL (log ical record length) value.

EXTract /LRecl/ sets these vari ables:

lrecl.0 1 lrecl.1 LRECL value

308 Chapter 5. QUERY and EXTRACT LSCREEN Query LScreen display s the height in lines and width in colum ns of the current window . T

EXTract /LScreen/ sets these vari ables: C A

lscreen.0 4 R T

lscreen.1 Height in lines of current docu m ent window X E /

lscreen.2 Width in col umns of current docu m ent window Y

lscreen.3 Seria l num ber of cur rent docu m ent window (same as R E

UNIQUEID.3) U

lscreen.4 Seria l num ber of cur rent docu m ent window (same as Q UNIQUEID.3) LSCREEN.3 and LSCREEN.4 are sup plied for compat ibil ity with text mode KEDIT. In text mode KEDIT these give the line and colum n of the upper left corner of the win - dow. This specif ic infor m ati on is not rel evant under Windows, but some macros use it only to uniquely identi fy a parti cu lar window . Re turning the window’ s seria l num ber in LSCREEN.3 and LSCREEN.4 lets these macros work without change in KEDIT for Windows.

MACRO Query MACRO macroname display s the defi ni ti on of the spec ifie d in-mem ory macro.

EXTract /MACRO/ is not cur rently sup ported.

MACROPATH Query MACROPath display s ON, OFF, the name of the envi ron ment variable used for macro searches, or the directory list used for macro searches.

EXTract /MACROPath/ sets these variables :

macropath.0 1 macropath.1 ON|OFF|envvar|dirlist

MACROSEARCH Query MACROSEARCH fileid [defaultextension] causes KEDIT to look for a file in the same directo rie s it looks in when searching for a macro. It then dis plays the fully quali fie d name of the result ing file, or the null string if an error is encounter ed or the file can’t be found. If fileid has no extension then defaultextension, if spec ified , is assumed.

EXTract /MACROSEARCH fileid [defaultextension]/ sets these vari ables:

macrosearch.0 1 macrosearch.1 Fully qual ified file name, or the null string

MARGINS Query MAR gins display s the current mar gin setti ngs: left mar gin, right mar gin, and paragra ph indent.

EXTract /MAR gins/ sets these vari ables:

mar gins.0 3 mar gins.1 Left mar gin col umn

QUERY and EXTRACT Operands 309 mar gins.2 Right mar gin col umn mar gins.3 Para graph in dent value

MARKSTYLE Query MARKSTYLE display s whether line blocks, box blocks, and stream blocks marked with the mouse under INTER FACE CUA are marked as persis tent blocks or as selec tions.

EXTract /MARKSTYLE/ sets these vari ables:

markstyle.0 3 markstyle.1 SE LEC TION|PER SIS TENT (Line blocks) markstyle.2 SE LEC TION|PER SIS TENT (Box blocks) markstyle.3 SE LEC TION|PER SIS TENT (Stream blocks) KEDIT’s de fault mouse mac ros test the rel e vant MARKSTYLE set ting and use it to decide how they will oper ate . In fact, none of KEDIT’s ‘‘hard-coded’’ behav ior de - pends on the value of MARKSTYLE; MARKSTYLE is only used within these defaul t mouse macros.

MEMORY Query MEM ory display s inform ati on about KEDIT’s mem ory usage.

Seven values are display ed; most of them are present only for com pati bil ity with earli er versions of KEDIT.

EXTract /MEMor y/ sets these vari ables, with all val ues in kilo bytes:

mem ory.0 7 mem ory.1 0 mem ory.2 0 mem ory.3 Al ways 10 (for com pat i bil ity with ear lier ver sions of KEDIT) mem ory.4 Ap prox i mate amount of mem ory, in ki lo bytes, be ing used by KEDIT to hold the content s of your files and relat ed in ter nal data struc tures. mem ory.5 0 mem ory.6 0 mem ory.7 Ap prox i mate amount of mem ory, in ki lo bytes, hold ing undo in for ma tion

MONITOR Query MONi tor dis plays whether MONI T OR is set to WIN DOWS, COLOR, or MONO.

EXTract /MON itor / sets these vari ables: mon i tor.0 1 mon i tor.1 WIN DOWS|COLOR|MONO

MOUSEBEEP Query MOUSEBEEP display s whether MOUSEBEEP is ON or OFF.

310 Chapter 5. QUERY and EXTRACT EXTract /MOUSEBEEP/ sets these vari ables: T

mousebeep.0 1 C

mousebeep.1 ON|OFF A R T X

MSGLINE Query MSGLine display s whether MSGLINE is ON or OFF (it is currentl y always E /

ON), your speci fi ca ti on for the first line used for message s, the num ber of lines that can Y

be used for mes sages, and OVERLA Y if the first message line can over lay a file line. R E U

EXTract /MSGLine/ sets these vari ables: Q msgline.0 4 msgline.1 ON msgline.2 Message line loca tion msgline.3 Num ber of message lines msgline.4 OVER LAY|null string

MSGMODE Query MSGMode display s whether MSGMODE is ON or OFF.

EXTract /MSGMode/ sets these variables : msgmode.0 1 msgmode.1 ON|OFF

NBFILE Query NBFile display s both the num ber of files in the ring and the maxi m um num ber of files allowed in the ring.

EXTract /NBFile/ sets these variables : nbfile.0 2 nbfile.1 Num ber of files in the ring nbfile.2 The maxi m um num ber of files allowed in the ring (cur- rently 500)

NBSCOPE Query NBScope dis plays the num ber of lines within the current scope (which is the num ber of lines in the current range if SCOPE ALL is in effect, and the num ber of lines selected for dis play if SCOPE DIS PLAY is in effect), and the line number within the current scope of the focus line.

EXTract /NBScope/ sets these vari ables: nbscope.0 2 nbscope.1 Num ber of lines in cur rent scope nbscope.2 Line num ber of focus line within cur rent scope

QUERY and EXTRACT Operands 311 NBWINDOW Query NBWindow display s the num ber of docu ment windows that cur rently exist.

EXTract /NBWindow/ sets these vari ables: nbwindow.0 1 nbwindow.1 Num ber of doc u ment win dows

NEWLINES Query NEWLines dis plays where new lines are input into your file: SAMELINE, BELOW, or BELOWCURR.

EXTract /NEWLines/ sets these variables: newlines.0 1 newlines.1 SAMELINE|BE LOW|BELOWCURR

NOVALUE Query NOVALUE display s ON or OFF, depending on whether use of uninitialized vari ables in KEXX macros causes an error.

EXTract /NOVALUE/ sets these vari ables: novalue.0 1 novalue.1 ON|OFF

NUMBER Query NUMber display s whether display of line num bers in the prefix area is ON or OFF.

EXTract /NUM ber/ sets these vari ables: num ber.0 1 num ber.1 ON|OFF

OFPW Query OFPW display s ON or OFF, depending on whether ‘‘one-file-per-window’ ’ mode, in which each file added to the ring gets its own docu m ent window , is in effect.

EXTract /OFPW/ sets these vari ables: ofpw.0 1 ofpw.1 ON|OFF

OPENFILTER Query OPENFilter display s the current open filter string, which can be used in the File Open dialog box to determ ine the types of files listed.

EXTract /OPENFilter/ sets these vari ables: openfilter.0 1 openfilter.1 Open filter string

OPMODE Query OPMODE display s inform ati on on the mode in which KEDIT is running. The result can be: FULLSCREEN (OS/2 KEDIT in fullscreen session), TEXTWINDOW (OS/2 KEDIT in Presen ta tion Manager text window), DETACHED (OS/2 KEDIT in detached session), REAL (DOS KEDIT), WINDOWS (DOS KEDIT running under

312 Chapter 5. QUERY and EXTRACT Windows 3.0 or above), GUI (Graphi cal -User-Interface version of KEDIT, in partic u - lar KEDIT for Windows), or UNKNOWN. For the GUI version of KEDIT, additiona l T

inform ati on is display ed: the window ing system involved (for KEDIT for Windows, C

this is “Windows”), the version of the win dowing system (for exam ple, under Win- A R

dows Vista, 6.00), and possi bly some additional identifying text. T X E EXTract /OPMODE/ sets these vari ables: / Y R

opmode.0 4 (for KEDIT for Windows) or 1 (for text mode versions E

of KEDIT) U opmode.1 GUI (for KEDIT for Windows); or else Q FULLSCREEN|TEXTWINDOW|DET ACHED| REAL|WINDOWS|UN KNOWN opmode.2 WIN DOWS (for KEDIT for Windows); this and the fol- lowing val ues are not set in text mode versions of KEDIT opmode.3 Win dows ver sion (for ex am ple, 6.00) opmode.4 Ad di tional iden ti fy ing text or null string A macro can deter mine whether it is running under a graphi cal version of KEDIT by testing whether OPMODE.1 equals GUI. Once it has been es tabli shed that OPMODE.1 is GUI, OPMODE.2, OPMODE.3, and OPMODE.4 can be checked to get further infor m ati on about the win dow ing system involved. Note that OPMODE.2, OPMODE.3, and OPMODE.4 are not set in text mode versions of KEDIT, so macros intende d to run under both text mode and GUI versions of KEDIT should refer ence them only af ter es tab lish ing that OPMODE.1 equals GUI. Note also that if OPMODE.1 equals WIN DOWS, it does not mean that you are running KEDIT for Windows; it means that the DOS version of KEDIT is running under Windows.

If you sim ply want to test from within a macro whether you are running under KEDIT for Windows, we recom mend that you test whether VERSION.1 is equal to ‘‘KEDIT/WIN DOWS’’.

OPSYS Query OPSYS display s the name of the operat ing system KEDIT is running under and the operat ing system version num ber. For exam ple, running under Windows Vista, KEDIT would display “Windows Vista 6.00”.

EXTract /OPSYS/ sets these variables: opsys.0 3 opsys.1 Name of op er at ing sys tem opsys.2 Ver sion num ber of op er at ing sys tem opsys.3 Ad di tional iden ti fy ing text or null string If you want to test in a macro whether you are running under KEDIT for Windows, we recom mend that you test whether VERSION.1 is equal to ‘‘KEDIT/WINDOWS’ ’.

PARSER Query PARSER parser display s the fileid of the KEDIT Language Defi ni ti on file from which the speci fie d parser was loaded, as spec ifie d on the SET PARSER com mand that defined the parser.

QUERY and EXTRACT Operands 313 EXTract /PARSER parser/ sets these vari ables:

parser.0 2 parser.1 Parser name parser.2 Fileid of .KLD file Query PARSER * or sim ply Query PARSER display s, for each defined parser, the name of the parser and the fileid of the asso ciated KLD file.

EXTract /PARSER/ or EXTRACT /PARSER */ sets the fol low ing variables :

parser.0 Num ber of parsers currentl y defined parser.i Name of ith parser, and fileid of as so ciated KLD file

PATH Query PATH dis plays ON, OFF, the name of the envi ronm ent variable used for file searches, or the direc tory list used for file searches.

EXTract /PATH/ sets these variables:

path.0 1 path.1 ON|OFF|envvar|dirlist

PCOLOR Query PCOLOR c dis plays the PCOLOR set ting for the spec ified item, which must be in the range A—Z or 1—9.

EXTract /PCOLOR c/ sets these vari ables:

pcolor.0 1 pcolor.1 The letter or num ber that you spec ifie d, followe d by the cor re spond ing color. Query PCOLOR * or simply Query PCOLOR dis plays the PCOLOR set ting for each of the charac ter s, A—Z and 1—9, used with PCOLOR.

EXTract /PCOLOR/ or EXTract /PCOLOR */ sets the fol low ing variables :

pcolor.0 35 pcolor.i ith charac ter (A—Z or 1—9), followe d by the corre - spond ing color

POINT Query Point display s names current ly assigned to the focus line.

EXTract /Point/ sets these vari ables:

point.0 0 if focus line is not a named line; other wise , 1 point.1 Line num ber and names of the focus line, if focus line is named Query Point * display s the line num ber and assigne d names of all named lines in the cur rent file.

314 Chapter 5. QUERY and EXTRACT EXTract /Point */ sets these variables : T

point.0 Num ber of named lines C point.i Line num ber and names of the ith named line A R T X E

PREFIX Query PRE fix display s whether the prefix area is ON or OFF or display ing NULLS, /

and whether the prefix area display s on the LEFT or RIGHT of the window . Y R E

EXTract /PRE fix/ sets these vari ables: U Q pre fix.0 2 pre fix.1 ON|OFF|NULLS pre fix.2 LEFT|RIGHT Query PRE fix Synonym display s, for each define d prefix synonym , the newname and oldname of the prefix com mand.

EXTract /PRE fix Syn onym/ sets these vari ables:

pre fix.0 Num ber of pre fix com mand synonym s pre fix.i Newname and oldname for ith pre fix synonym

PREFIXWIDTH Query PREFIXWIDTH display s the width of the prefix area.

EXTract /PREFIXWIDTH/ sets these variable s:

prefixwidth.0 1 prefixwidth.1 Width of prefix area

PRINTCOLORING Query PRINTCOLORing display s whether PRINTCOLORING is ON or OFF.

EXTract /PRINTCOLORing/ sets these vari ables:

printcoloring.0 1 printcoloring.1 ON|OFF

PRINTER Query PRINTER display s whether printer output is being sent to WINDOWS, LPT1:, LPT2:, LPT3:, COM1:, or COM2:. It also dis plays whether the CLOSE|NOCLOSE option, the FORM|NOFORM option, and the CON VERT|NOCONVERT options are in effect.

EXTract /PRINTER/ sets these variables :

printer.0 4 printer.1 WIN DOWS|LPT1:|LPT2:|LPT3:|COM1:|COM2: printer.2 CLOSE|NOCLOSE printer.3 FORM|NOFORM printer.4 CON VERT|NOCONVERT

QUERY and EXTRACT Operands 315 PRINTPROFILE Query PRINTPROFile dis plays the fileid of the default printer pro file macro.

EXTract /PRINTPROFile/ sets these variables : printprofile.0 1 printprofile.1 Fileid of de fault printer pro file macro

PRINTSIZE Query PRINTSIZE display s the num ber of lines per page, and the num ber of col umns per page, used for print opera ti ons, based on the current ly selected printer, font, and mar gins. If KEDIT cannot determ ine the result, -1 will be returned for the lines and/or colum ns. -1 will always be returned if PRINTER WINDOWS is not in effect, and can also be returned if, for exam ple, no print ers are installed.

EXTract /PRINTSIZE/ sets these variables : printsize.0 2 printsize.1 Num ber of lines per printed page, or -1 printsize.2 Num ber of col umns per printed page, or -1

QUICKFIND Query QUICKFIND display s inform ati on on the search string display ed in the Quick Find toolbar item: whether, if that string is searched for, case will be respected or ignored, whether the search will be lim ited to whole words only, and whether the string is a regu lar expres sion, followed by the string itself.

EXTract /QUICKFIND/ sets these vari ables: quickfind.0 4 quickfind.1 IG NORE|RE SPECT quickfind.2 WORD|NOWORD quickfind.3 REGEXP|NOREGEXP quickfind.4 Quick Find search string

RANGE Query RANge dis plays the line number s within the cur rent file of the first and last lines in the current range.

EXTract /RANge/ sets these vari ables: range.0 2 range.1 Line num ber of first line in range range.2 Line num ber of last line in range. (Equal to one less than RANGE.1 if no lines in cur rent range)

RECENTFILES Query RECENTFiles the maxi mum number of recently-edited files that KEDIT will display on the File menu.

EXTract /RECENTFiles/ sets these variables : recentfiles.0 1 recentfiles.1 RECENTFILES value

316 Chapter 5. QUERY and EXTRACT RECFM Query RECFm display s whether the current record form at is FIXED or VARYING . T

EXTract /RECFm/ sets these variables : C A

recfm.0 1 R T

recfm.1 FIXED|VARY ING X E / Y

REPROFILE Query REPROFile dis plays whether REPROFILE is ON or OFF. R E U

EXTract /REPROFile/ sets these vari ables: Q reprofile.0 1 reprofile.1 ON|OFF

REGSAVE Query REGSAVE dis plays whether state inform ati on will be saved in the Windows registryat the end of the editing session (STATE|NOSTATE) and whether history infor- mation will be saved (HIST ORY|NOHISTORY).

EXTract /REGSAVE/ sets these vari ables: regsave.0 2 regsave.1 STATE|NOSTATE regsave.2 HIS TORY|NOHISTORY

RESERVED Query RESERved display s a list of lines within the current window occupied by reserved lines.

EXTract /RESERved/ sets these variables : re served.0 0 if no re served lines; other wise 1 re served.1 List of re served line num bers, if any

RIGHTCTRL Query RIGHTCTRL display s whether RIGHTCTRL is ON or OFF.

EXTract /RIGHTCTRL/ sets these vari ables: rightctrl.0 1 rightctrl.1 ON|OFF

RING Query RING display s the num ber of files in the ring and gives inform ati on on each file’s fileid, current line, cur rent colum n, size, and alterati on counts. EXTract /RING/ sets these vari ables: ring.0 Num ber of files in the ring ring.i In for ma tion on the ith file in the ring: fileid (in up per case and possi bly contai ning blanks), current line, cur rent column, size, and alter ation count Query RING FILEID display s the num ber of files in the ring and the fileid of each of the files in the ring.

QUERY and EXTRACT Operands 317 EXTract /RING FILEID/ sets these variable s:

ring.0 Num ber of files in the ring ring.i The fileid of the ith file in the ring, in mixed case and pos si bly con tain ing blanks. QUERY/EXTRACT RING and QUERY/EXTRACT RING FILEID consider the cur- rent file to be the first file in the ring.

SCALE Query SCALe dis plays whether SCALE is ON or OFF, and the scale line’s spec ified loca tion in the window .

EXTract /SCALe/ sets these vari ables:

scale.0 2 if SCALE OFF, 3 if SCALE ON scale.1 ON|OFF scale.2 Scale line loca tion speci fi ca tion scale.3 Line num ber within window occu pied by scale line (set only if SCALE ON)

SCOPE Query SCOPE dis plays the current scope set ting, either DISPLA Y or ALL.

EXTract /SCOPE/ sets these vari ables:

scope.0 1 scope.1 DIS PLAY|ALL

SCROLLBAR Query SCROLLbar display s whether SCROLLBAR is ON or OFF and whether, if SCROLLBAR ON is in effect, the HOR IZON T AL scrollbar only, the VER TICAL scrollbar only, or BOTH kinds are display ed.

EXTract /SCROLLbar/ sets these vari ables:

scrollbar.0 2 scrollbar.1 ON|OFF scrollbar.2 HOR I ZON TAL|VER TI CAL|BOTH

SELECT Query SELect dis plays the selec tion level of the focus line, and the maxi m um selection level of all lines in the cur rent file.

EXTract /SELect/ sets these variables:

se lect.0 2 se lect.1 Se lection level of fo cus line. (Same value as CURLINE.6, but using CURLINE.6 is much more ef ficie nt) se lect.2 Max imum se lec tion level of all lines in cur rent range in cur rent file

318 Chapter 5. QUERY and EXTRACT SHADOW Query SHADow display s whether SHADOW is ON or OFF. T

EXTract /SHADow/ sets these vari ables: C A R

shadow.0 1 T X

shadow.1 ON|OFF E / Y R

SHARING Query SHARING dis plays the file sharing modes used by KEDIT when it reads a file E into mem ory (DENYWRITE or DENYNONE), and when it locks a file U (DENYWRITE or DENYREADWRITE). Q EXTract /SHAR ING/ sets these vari ables:

shar ing.0 2 shar ing.1 DENYWRITE|DENYNONE shar ing.2 DENYWRITE|DENYREADWRITE

SIZE Query SIze display s the num ber of lines in the current file.

EXTract /SIze/ sets these vari ables:

size.0 1 size.1 Num ber of lines in cur rent file. (See NBSCOPE.1 for num ber of lines in cur rent scope)

STARTUP Query STARTUP display s inform ati on about how KEDIT was invoked:

· The fully quali fie d name of the KEDIT module that is exe cut ing

· The com mand line ar gum ents passed to KEDIT or, if there were none, ‘‘(none)’’

· The value of the KEDITW envi ron m ent variable , or ‘‘(none)’’

· The fully quali fie d name of the profil e exe cute d at the start of the current edit ing session, or ‘‘(none)’’

EXTract /STARTUP/ sets these vari ables:

startup.0 4 startup.1 The fully quali fie d name of the KEDIT module that is ex- e cut ing startup.2 The com mand line ar gum ents passed to KEDIT, or the null string startup.3 The value of the KEDITW envi ron m ent variable , or the null string startup.4 The fully quali fie d name of the ini tial profil e, or the null string

QUERY and EXTRACT Operands 319 STATUSLINE Query STATUSLine dis plays whether the sta tus line dis play is ON or OFF.

EXTract /STATUSLine/ sets these vari ables: statusline.0 2 statusline.1 ON|OFF statusline.2 BOT TOM

STAY Query STAY display s whether STAY is ON or OFF.

EXTract /STAY/ sets these variables: stay.0 1 stay.1 ON|OFF

STREAM Query STReam display s whether STREAM is ON or OFF.

EXTract /STReam/ sets these variables: stream.0 1 stream.1 ON|OFF

SYNONYM Query SYNonym display s whether SYNONYM is ON or OFF.

EXTract /SYN onym/ sets these vari ables: syn onym.0 1 syn onym.1 ON|OFF Query SYNonym * display s, for all define d synonym s, the newname, the mini m al trun - cat ion, and the synony m defi ni t ion.

EXTract /SYN onym */ sets these vari ables: syn onym.0 Num ber of synonym s define d syn onym.i Newname, trun ca tion, and def i ni tion of ith synonym

TABLINE Query TABLine dis plays whether TABLINE is ON or OFF, and its spec ified loca tion in the win dow.EXTract /TABLine/ sets these vari ables: tabline.0 2 if TABLINE OFF, 3 if TABLINE ON tabline.1 ON|OFF tabline.2 Tabline lo ca tion spec i fi ca tion tabline.3 Line num ber within window occu pied by tab line (set only if TABLINE ON)

320 Chapter 5. QUERY and EXTRACT TABS Query TABs dis plays the cur rent tab setting (a list of spe cific tab col umns, INCR n, or both) T C

EXTract /TABs/ sets these vari ables: A R T

tabs.0 2 X E tabs.1 Cur rent tab setting (a list of spe cific tab col umns, INCR / Y

n, or both) R tabs.2 Current tab colum ns (up to a maxi m um response length of E U

ap prox i mately 1000 char ac ters) Q

TABSAVE Query TABSAVE display s whether the TABSAVE facil ity is ON or OFF.

EXTract /TABSAVE/ sets these vari ables: tabsave.0 1 tabsave.1 ON|OFF

TABSIN Query TABSIn display s whether TABSIN is ON, OFF, or set to TABQUOTE, and the tab increm ent used for TABSIN proces sing.

EXTract /TABSIn/ sets these variables : tabsin.0 2 tabsin.1 ON|OFF|TABQUOTE tabsin.2 Tab incre ment

TABSOUT Query TABSOut display s whether TABSOUT is ON or OFF, and the tab increm ent used for TABSOUT proces sing.

EXTract /TABSOut/ sets these variables : tabsout.0 2 tabsout.1 ON|OFF tabsout.2 Tab incre ment

TARGET Query TAR Get dis plays infor mation about the tar get of the last CLOCATE, LOCATE, or TFIND com mand issued for any file in the ring: the line and colum n num ber within the file of the start of the matching tar get, and the line and colum n num ber of the end of the matching tar get. If the tar get was not a string tar get, the colum n pointer value is returned for both colum n num bers. In the current version of KEDIT, the line num ber of the start and end of the matching tar get will always be the same.

EXTract /TAR Get/ sets these variables : tar get.0 5 tar get.1 Line num ber of start of tar get tar get.2 Col umn num ber of start of tar get

QUERY and EXTRACT Operands 321 tar get.3 Line num ber of end of tar get tar get.4 Col umn num ber of end of tar get tar get.5 Set equal to the text of the last string target. Valid only if your macro is sues EX TRACT /TAR GET/ im me di ately (that is, no inter vening KEDIT com mands) after succes s- ful use of the LOCA TE, CLOCATE, or TFIND com - mands to search for a string target

THIGHLIGHT Query THIGHlight dis plays whether THIGHLIGHT is ON or OFF.

EXTract /THIGHlight/ sets these variables :

thighlight.0 1 thighlight.1 ON|OFF

TIME Query TIME display s the current date and time.

EXTract /TIME/ sets these variables :

time.0 5 time.1 Date in coun try-de pend ent for mat time.2 Time in hh:mm form at time.3 Date in mm-dd-yy form at time.4 Time in hh:mm:ss.hh form at time.5 Date in yyyy-mm-dd for mat

TIMECHECK Query TIMECHECK display s whether TIMECHECK is ON or OFF.

EXTract /TIMECHECK/ sets these vari ables:

timecheck.0 1 timecheck.1 ON|OFF

TOF Query TOF dis plays whether the focus line locati on is ON or OFF the top-of-file (or top-of-range) line.

EXTract /TOF/ sets these vari ables:

tof.0 1 tof.1 ON|OFF

TOFEOF Query TOFEOF display s whether display of the top-of-file and end-of-file lines is ON or OFF.

EXTract /TOFEOF/ sets these vari ables:

tofeof.0 1 tofeof.1 ON|OFF

322 Chapter 5. QUERY and EXTRACT TOL Query TOL display s whether or not the focus colum n is located ON or OFF the top-of-line colum n (which is one colum n to the left of the left zone col umn, by analogy T

with the top-of-file line). C A R

EXTract /TOL/ sets these variables: T X E

tol.0 1 / Y

tol.1 ON|OFF R E U

TOOLBAR Query TOOLBAR display s toolbar display is ON or OFF, and whether toolbars are set Q to appear at the TOP of the frame win dow, the BOTT OM, or BOTH.

EXTract /TOOLBAR/ sets these vari ables: toolbar.0 2 toolbar.1 ON|OFF toolbar.2 TOP|BOT TOM|BOTH

TOOLBUTTON Query TOOLButton name display s inform ati on about the speci fie d toolbutton: the but- ton name, how it appears on the toolbar (bitmap name or delim ited text string), any con - diti ons under which the button is dis abled, and the tooltip and status line help for the button. EXTract /TOOLButton name/ sets these vari ables: toolbutton.0 4 toolbutton.1 But ton name toolbutton.2 Built-in or on-disk bitmap file, or de limited string used for button text toolbutton.3 COND ccc (condi ti ons under which button is dis abled, if any), or null string toolbutton.4 De limited text of tooltip and sta tus line help for but ton, if any, or null string Query TOOLButton * or sim ply Query TOOLButton display s a line of infor m ati on for each of the current ly-define d toolbuttons: the button name, bitmap name or deli m ited text string, condi ti ons under which button is dis abled, deli m ited text of tooltip and sta- tus line help.

EXTract /TOOLButton */ or simply EXTract /TOOLButton/ sets these vari ables: toolbutton.0 Num ber of toolbuttons toolbutton.i In for ma tion about the ith toolbutton

QUERY and EXTRACT Operands 323 TOOLSET Query TOOLSet or Query TOOLSet TOP gives inform ati on about the top toolbar; Query TOOLSet BOTT OM gives inform ati on about the bottom toolbar. TOP or BOTTOM is dis played, fol lowed by DEFAULT or USER, followed by the content s of the toolset.

EXTract /TOOLSet [TOP|BOTT OM]/ (where TOP is the default) sets these variable s: toolset.0 3 toolset.1 TOP|BOT TOM toolset.2 DE FAULT|USER toolset.3 Content s of defaul t or user-define d toolset

TRAILING Query TRAILING display s the current setti ng of TRAILING: ON, OFF, SINGLE, or EMPTY.

EXTract /TRAILING/ sets these vari ables: trail ing.0 1 trail ing.1 ON|OFF|SIN GLE|EMPTY

TRANSLATEIN Query TRANSLATEIn dis plays the cur rent setting of TRANSLATEIN, which is either NONE or OEMTOANSI.

EXTract /TRANSLATEIn/ sets these vari ables: translatein.0 1 translatein.1 NONE|OEMTOANSI

TRANSLATEOUT Query TRANSLATEOut display s the current setti ng of TRANSLATEOUT, which is either NONE or ANSITOOEM.

EXTract /TRANSLATEOut/ sets these vari ables: translateout.0 1 translateout.1 NONE|ANSITOOEM

TRUNC Query TRunc display s the colum n num ber of the trun cati on colum n.

EXTract /TRunc/ sets these vari ables: trunc.0 1 trunc.1 Trun ca tion col umn

324 Chapter 5. QUERY and EXTRACT UNDO Query UNDO dis plays, for the current file, how many levels of changes can be undone, how many levels of changes can be redone, and the amount of stor age (in kilo bytes) T

being used to hold the file’s undo inform ati on. C A R

EXTract /UNDO/ sets these variables: T X E undo.0 3 / Y

undo.1 Levels of undoable changes for current file R undo.2 Levels of redoable changes for current file E U

undo.3 Amount of mem ory, in ki lobyt es, holding undo infor m a- Q tion for current file

UNDOING Query UNDOING display s whether UNDOING is ON or OFF, the maxi m um num ber of undo levels that will be kept when it is ON, and the maxi m um amount of mem ory (in Kbytes) that KEDIT will set aside to hold undo inform ati on.

EXTract /UNDOING/ sets these vari ables:

un do ing.0 3 un do ing.1 ON|OFF un do ing.2 The maxi m um num ber of undo levels KEDIT will at tempt to keep in mem ory un do ing.3 The maxi m um amount of mem ory (in Kbytes) that KEDIT will use to hold undo infor m ati on.

UNIQUEID Query UNIQueid display s the unique serial num bers corre spond ing to the current file, view, and window .

EXTract /UNIQueid/ sets these vari ables:

uniqueid.0 3 uniqueid.1 Seria l num ber of cur rent file uniqueid.2 Seria l num ber of cur rent view uniqueid.3 Seria l num ber of cur rent window KEDIT as signs a unique serial number to each new file that it creates, to each new view of a file that it creates, and to each new win dow that it cre ates. You can use this in for ma - tion to tell if a file, view, or window is the ‘‘same’’ one that you worked with at some earli er point, de spite changes to the fileid involved, window posi ti on, etc.

VARBLANK Query VARblank display s whether VARBLANK is ON or OFF. EXTract /VARblank/ sets these vari ables:

varblank.0 1 varblank.1 ON|OFF

VERIFY Query Verify display s the current VERIFY set ting, as a list of one or more col umn pairs, each pos sibly pre ceded by an H if they are displayed in hex adec im al.

QUERY and EXTRACT Operands 325 EXTract /Ver ify/ sets these vari ables: ver ify.0 1 ver ify.1 VER IFY col umn pairs

VERSHIFT Query VERShift display s the num ber of col umns the VERIFY set ting has been offset by the LEFT or RIGHT com mands, or by autoscrolling.

EXTract /VERShift/ sets these variables : vershift.0 1 vershift.1 VERSHIFT offset

VERSION Query VERSION display s KEDIT’s version string. The first word of the version string identi fies the product (‘‘KEDIT/Windows’ ’). Next is the version num ber in the form of a major version num ber, a dec im al point, and a two digit minor version num ber (for exam ple, 1.50). Next is a two charac ter revi sion level (for exam ple, W1) and possi ble addition al iden tify ing text. Finally, there is the date of this ver sion of KEDIT, in the form ‘‘Mmm dd yyyy’’.

EXTract /VER SION/ sets these variables : ver sion.0 4 ver sion.1 ‘‘KEDIT/WINDOWS’ ’ (this is re turned for KEDIT for Windows; the DOS and OS/2 text mode versions of KEDIT return ‘‘KEDIT’’). ver sion.2 Ver sion num ber ver sion.3 Re vi sion level and pos si ble ad di tional iden ti fy ing text ver sion.4 Date of this KEDIT version, in the form ‘‘MMM dd yyyy’’ If you want to test in a macro whether you are running under KEDIT for Windows, we recom mend that you test for VER SION.1 equal to ‘‘KEDIT/WINDOWS’ ’.

WIDTH Query Width display s the value of the WIDTH set ting, which is set via the WIDTH ini - tial iza tion option. It is the length of the lon gest line that KEDIT can pro cess in this edit - ing session.

EXTract /Width/ sets these vari ables: width.0 1 width.1 Value of the WIDTH set ting

WINDIR Query WINDIR dis plays the fully-quali fie d name of your Windows directory , and of your Windows system directory . EXTract /WINDIR/ sets these variables : windir.0 2 windir.1 Fully-qual i fied name of Win dows di rec tory windir.2 Fully-qual i fied name of Win dows sys tem di rec tory

326 Chapter 5. QUERY and EXTRACT WINDOWNAME Query WINDOWNAME tells you the name of the current docu m ent window . This is usuall y sim ply the name of the file that you are edit ing, for exam ple T

"C:\MyDir\MyFile.txt". But if you have multi ple views of the same file in differ ent C windows (these are norm ally create d with the Window/Ne w Window menu item), the A R

title bars of the windows involved include a colon (":") followed by a window num ber. T And the output from Query WINDOWNAME includes this window num ber, giving X E for example "C:\MyDir\MyFile.txt:2". / Y R

EXTract /WINDOWNAME/ sets these variable s: E U

windowname.0 1 Q windowname.1 Name of the current docu m ent window , in mixed case

WINMARGIN Query WINMARgin display s whether the abilit y to drag the mouse in the window mar - gin area to mark line blocks is turned ON or OFF, and display s the width in pixels of the win dow mar gin area.

EXTract /WINMARgin/ sets these vari ables: winmargin.0 2 winmargin.1 ON|OFF winmargin.2 Width of window mar gin area, in pixels

WORD Query WORD display s whether “words” are strings of NONBLANK charac ters or strings of ALPHANU Me ric charac ters ,, and TRAILING or NOTRAILING depending on whether word selec tion does or does not include trail ing blanks.

EXTract /WORD/ sets these vari ables: word.0 2 word.1 NONBLANK|ALPHANUM word.2 TRAIL ING|NOTRAILING

WORDWRAP Query WORDWrap dis plays whether WORDWRAP is ON or OFF.

EXTract /WORDWrap/ sets these vari ables: wordwrap.0 1 wordwrap.1 ON|OFF

WRAP Query WRap display s whether WRAP is ON or OFF.

EXTract /WRap/ sets these vari ables: wrap.0 1 wrap.1 ON|OFF

QUERY and EXTRACT Operands 327 ZONE Query Zone display s the current left and right zone colum ns.

EXTract /Zone/ sets these vari ables: zone.0 2 zone.1 Left zone column zone.2 Right zone colum n

= Query = dis plays the content s of the equal buffer for the current file.

EXTract /=/ sets these vari ables: equalsign.0 1 equalsign.1 Content s of equal buffer, in mixed case

328 Chapter 5. QUERY and EXTRACT Chapter 6. Macro Reference

This chapter presents a somewhat form al descripti on of the KEXX macro language. A tutoria l introduc ti on to KEXX is given in User’s Guide Chapter 10, “Using Macros”. Other aspects of how to use KEDIT’s macro facili ties, such as the DEFINE comm and, .KEX and .KML files, and the KEXX debugging facil ity, are also discusse d there.

If you want more inform ati on about KEXX, you may want to look at books about the REXX language, since KEXX includes a large enough subset of REXX for these to be helpful. The defini ti ve refer ence for the REXX language is The REXX Language: A Prac ti cal Approach to Program ming by Michael Cowlishaw (Second Editi on, Prentice-Hall, 1990), which is recom mended for all ‘‘power users’’ of KEDIT’s macro facili ties. Sev eral IBM REXX man u als include somewhat simi lar reference e

information. c n e r e

See also User’s Guide Chapter 10, “Using Macros”, User’s Guide Chapter 11, “Sample f Macros”, DEFINE, IMMEDI A TE, MACRO, MAC ROS, SET IMPMACRO, SET e R MACROPATH o r c a

6.1 Program Structure M

Each line of a KEXX macro can be up to 250 charac ter s long, and you can have up to 4000 lines in a KEXX macro.

Except within literal strings, case is not sig nif icant in the text of KEXX macro s. The names of variable s, keywords, and functi ons can be given in upper case, in lower cas e, or in mixed case.

KEXX clauses are the equiva lent of statem ents in other languages . You can have one or more clauses on a line. If you have more than one clause on a line, you must use a semi- co lon (‘‘;’’) to sep arate each pair of clauses. The last or only clause on a line can optionall y be followed by a semico lon. Clauses must fit on a single line; you cannot have a clause that extends over two or more lines.

Comments There are two ways to indi cate comm ents within a KEXX macro:

· When a line of a KEXX macro has an as ter isk (‘‘*’’) as its first nonblank char acter , the en tire line is taken as a com ment.

* this is a com ment line

· You can also use REXX style com ments, enclos ing com ment text be tween slash-as ter isk (‘‘/*‘‘) aster isk-slash (‘‘*/’’) pairs. This type of com ment must be gin and end on the same line, but need not occupy the enti re line.

/* this is a comment */ X = 17 /* this comment fol lows a clause */ /* and this com ment pre cedes one */ N = 19

Program Structure 329 6.2 Tokens

The clauses in a KEXX macro are built up from tokens, which fall into these groups:

Symbols Sym bols are used as the names of KEXX vari ables, as the names of func tions that KEXX macros can call, and as keywords for instructi ons like IF, DO, and EXIT. Sym - bols are made up of groups of alpha betic char acters (‘‘a—z‘‘, ’’A—Z’’), numeric char - acters (‘‘0—9’’) and specia l charac ters (‘‘!’’, ‘‘?’’, ‘‘_’’, and ‘‘.’’). Examples:

EXIT WRAP.1 VarName _x .A1

Numbers Num bers are a specia l type of sym bol. They are com posed of one or more digit s and can optionall y include a dec im al point. Num bers are optionall y pre ceded by a plus sign or a minus sign. You can use floating point notati on by appending to a num ber ‘‘E’’ or ‘‘e’’, an optional plus or minus sign, and one or more addi tional digit s to repre sent the power of ten involved.

Exam ples:

24 -54 +081 1234.5678901 142.36e12 15E-5 This doc u men ta tion will some times refer to whole numbers . These are numbers that can be expressed within the current num ber of NUMERIC DIGITS (which is norm ally nine digit s) without a deci m al point and without using exponen ti al notation.

Literal strings Lit eral strings are strings that are delim ited by single or double quotes. For exam ple,

'Er ror in data entry' "Please enter your name" '' If you have a lit eral string delim ited by single quotes that contai ns single quotes the embedded single quotes must be doubled, as in this exam ple:

'Mary''s book' And sim ilar ly, with any lit eral string delim ited by double quotes that contai ns double quotes, the embedded double quotes also must be doubled:

"He said, ""Hello"" to Bob."

A spe cial type of lit eral string is a hex a dec i mal string. When used in a KEXX macro, a hexa dec i m al string is equiva lent to a string consis ting of the charac ter s whose charac ter codes are given in the string. For instance, the hexa dec i m al string '0C'x speci fie s a one-char acter string con tain ing the char acter whose char acter code in hexadecimal is 0C.

Hexa dec i m al strings are made up of pairs of hexa dec i m al digit s (‘‘0—9’’, ‘‘a—f’’, ‘‘A—F’’), with each pair rep re sent ing one char acter . Mul tiple pairs can be con cate - nated together or can be sepa rat ed by blanks. The entire string must be delim ited by sin- gle or double quotes and followe d by the charac ter ‘‘x’’ or ‘‘X’’.

330 Chapter 6. Macro Reference Binary strings are also available . They consis t of strings of binary digit s (‘‘0‘‘ or ’’1’’), with each group of four binary digit s repre sent ing one hexa dec i m al digit. Binary strings are delim ited by single or double quotes and are fol lowed by the charac ter ‘‘b’’ or ‘‘B’’.

'0C'X '01ecf8'x "01 ec f8"x '0010 0100'b '11010111'B

Operators Opera tors, such as ‘‘+’’ and ‘‘*’’, are used in KEXX expressions and are discusse d below in Section 6.5, “Operators and Expressions”.

Miscellaneous KEXX also uses parenthe ses (for grouping within expres sions and in functi on calls), com mas (to sepa rat e argum ents to func tions), equal signs (in assignm ents), and colons (to indicate labels). e

6.3 Symbols and Variables c n e r e

As dis cussed above, sym bols are made up of groups of alphabeti c charac ter s (‘‘a—z’’, f ‘‘A—Z’’), numeric charac ters (‘‘0—9’’) and specia l charac ters (‘‘!’’, ‘‘?’’, ‘‘_’’, and e R ‘‘.’’). o r c Constant Sym bols that begin with a period or with a num ber are known as con stant sym bols. The a M symbols value of a consta nt sym bol is always the name of the sym bol in uppercas e, and cannot be changed. Exam ples of consta nt symbols:

0 19 .ABC 54321 9g 4.2

Variable All other sym bols (that is, sym bols whose first charac ter is non-numeric and is not a symbols period) are known as vari able sym bols, and can be used to refer to vari ables. The value of all variable s is ini tially equal to the name of the vari able, in uppercas e, but vari ables can be assigned new values when used on the left side of assignm ents, as discusse d in the next section.

There are three types of variable symbols: sim ple sym bols, stem symbols , and com - pound symbols , and they can be used to refer to the three types of vari ables: sim ple vari ables, stem vari ables, and com pound vari ables.

Simple Sim ple sym bols are vari able sym bols that contai n no peri ods. They are used to name variables sim ple variable s, which corre spond most closely to ordi nary vari ables in other lan- guages. Examples:

A WRAP CDe7

Stem variables Stem sym bols are vari able sym bols that contai n a single period, which is the last char- acter of the sym bol. Exam ples:

A. WRAP. CDe7. Stem sym bols, which corre spond most closely to the names of arrays in other lan- guages, can be used in expres sions just as sim ple sym bols and com pound sym bols can,

Symbols and Variables 331 but when used on the left side of an assignm ent, specia l handli ng applies, as dis cussed in the next section.

Compound Com pound sym bols are formed by taking a stem sym bol and concat enat ing a sym bol variables that contai ns no peri ods. Exam ples:

A.12 A.I In these exam ples, A. is known as the stem com po nent of the com pound sym bol and 12 and I are known as the com po nent. When you use a com pound sym bol, KEXX derives the name of the vari able referred to (known as the derived name of the vari able) by taking the stem com ponent of the sym bol as is, but replacing the sym bol in the tail by its value. So the com pound sym bol A.12 refers to the variable A.12, since the stem A. is taken as is, and 12 is a consta nt sym bol with the value 12. Assum ing that I has the value 9, A.I refers to the variable A.9, since A. is taken as is, and the variable I is replaced by its value, 9.

Com pound vari ables corre spond most closely to array ele ments in other languages . You can think of A.12 as refer ring to the twelfth ele ment of the array A, and you can think of A.I, where I is a vari able whose value can vary, as letti ng you loop through the elem ents of the array A.

You can use multi ple sym bols in the tail of a com pound sym bol, sepa rat ing them by peri ods, to make com pound vari ables act like arrays with two or more dimensions . Examples:

A.11.12 B.I.J C.I.J.1 KEXX derives the name of the com pound vari able referred to in these cases by substi - tut ing, for each sym bol in the tail, the value of the sym bol. So if I is 3 and J is 5, the derived name of A.11.12 is A.11.12, the derived name of B.I.J is B.3.5, and the derived name of C.I.J.1 is C.3.5.1.

Com pound vari ables are actuall y more general than arrays in most other languages , because the val ues of the sym bols in the tail need not be numeric. For exam ple, if NAME has the value ‘‘Fred’’, A.NAME refers to A.Fred.

The values of sym bols in the tail can contai n any charac ter s, including blanks and spe- cial charac ter s. However , KEXX does not properl y han dle sym bols in the tail whose val ues are null or con tain the null char acter (char acter code 0).

332 Chapter 6. Macro Reference 6.4 Assignments

You can use assign ments to change the values of variable s. Assignm ents have the form

variable = expres sion Exam ples of assignm ents:

X.1 = 17 A = SUBSTR(B, 1, 2) CH2 = C || D || E Stem assign ment is a spe cial case. When you assign a value to a stem, that value is also assigned to all possi ble com pound vari ables whose name begins with that stem. (If you think of com pound vari ables as corre spond ing to the array ele ments found in other lan- guages, you can think of stem assignm ent as initializing an entire array to a given e c

value.) For example, n e r e

A. = 'XYZ' f e R assigns ‘‘XYZ’’ to A.0, A.1, A.2, etc. KEXX uses spe cial inter nal logic to han dle stem o assignm ents, and they use no more time or mem ory than assignm ents to other vari ables. r c a

All vari ables always have val ues. If you use a vari able that your macro has not yet M assigned a value to, the value of the vari able is the name of the vari able in upper case.

The val ues of all vari ables (simple, compou nd, and stem) are always char acter strings. Even numeric values are stored by KEXX as char acter strings.

6.5 Operators and Expressions

A KEXX expres sion can con sist of a sin gle vari able, literal string, or func tion call. You can also use oper a tors (along with parenthe ses for grouping) to com bine these together into more com plex expressions . This sec tion discusse s the dif ferent types of opera tors that you can use in KEXX: arith me tic oper a tors, com par i son oper a tors, con cat e na tion opera tors, and logical operators.

Arithmetic Arith me tic oper a tions per formed by KEXX are: operators · Ad di tion (‘‘+’’)

· Sub trac tion (‘‘-’’)

· Mul ti pli ca tion (‘‘*’’)

· Di vi sion (‘‘/’’)

· In te ger di vi sion (‘‘%’’)

· Re main der (‘‘//’’)

Operators and Expressions 333 · Exponentiation (‘‘**’’)

· Unary plus (‘‘+’’)

· Unary minus (‘‘-’’)

Some exam ples:

5 + 3 Þ '8' 5 - 3 Þ '2' 5 * 3 Þ '15' 5 / 3 Þ '1.66666667' 5 % 3 Þ '1' 5 % -3 Þ '-1' 5 // 3 Þ '2' 5 // -3 Þ '2' 5 ** 3 Þ '125' +(-5) Þ '-5' -(-5) Þ '5'

Some rules that KEXX fol lows when proces sing arithm eti c opera ti ons:

· KEXX stores all val ues, in clud ing those that ap pear to be “nu meric”, as char acter strings. As a re sult, all val ues can take part in “char acter” op er ations like con cate - nati on and substring. When KEXX needs to do an arithm eti c oper a ti on, it convert s the operands from charac ter to num eric form, giving you an error if the operands cannot be convert ed. Then KEXX does the oper a ti on and convert s the result back to charac ter form. For exam ple, all of the follow ing as signm ents have the ef fect of set ting X to the string ‘‘103’’.

X = '99' + '4' X = 99 + 4 X = 99 + '4'

· The NUMER IC DIGITS instruc tion control s how many signif i cant digit s are re- tained in arith metic re sults. The de fault for NU MERIC DIG ITS is 9, and re sults involv ing more digit s than this are rounded to 9 digit s. You can use NUMER IC DIGITS to spec ify up to 1000 significant digits.

numeric digits 9 say 123456 + .123456 /* result is 123456.123 */ say 123456**3 /* result is 18816403E+15 */ numeric digits 50 say 123456 + .123456 /* result is 123456.123456 */ say 123456**3 /* result is 1881640295202816 */

· Su per flu ous lead ing ze ros are re moved from all results. Trailing ze ros af ter a dec i- mal point are rem oved from the result s of divi sion and exponentiation but are re - tained af ter other arith me tic op er a tions. How ever, arith me tic re sults that are equal to zero al ways return '0', with no leading ze ros, trailing zeros, or decimal point.

334 Chapter 6. Macro Reference say 4.00 * 2 /* result is 8.00 */ say 4.00 / 2 /* result is 2 */ say 4.00 * 0 /* result is 0 */

· Expo nen ti al nota ti on is used for result s that would other wise require a large num - ber of digit s before or af ter the deci m al point. Spe cif ical ly, if the num ber of digit s before the dec im al point would be greater than the current NUMER IC DIGITS value (norm ally 9) or the num ber of digit s after the deci m al point would be more than twice that value (that is, more than 18 digit s), KEXX express es the result in exponential notation.

/* as sum ing de fault of NU MERIC DIG ITS 9 */ say 1234567*100 /* result is 123456700 */ say 1234567*10000 /* result is 1.23456700E+10 */ say .1234567/1E2 /* result is 0.001234567 */ say .1234567/1E20 /* result is 1.234567E-21 */ e c

Comparison The com pari son opera tors com pare two val ues to see if the first is equal to the second, n e operators greater than the sec ond, etc., yielding 1 if so and 0 if not. r e f e

KEXX has two sets of com pari son opera tors. The nor mal com par i son oper a tors ignore R

leading and trailing blanks in the strings to be com pared and, if the strings to be com - o r

pared contai n valid KEXX num bers, do numeric com pari sons. Strict com par i son com- c a

pares two strings charac ter by charac ter , without any specia l handli ng of blanks and M num bers. Here are some exam ples using the norm al equalit y opera tor (‘‘=’’) and the strict equalit y opera tor (‘‘==’’, consisting of two equal signs):

'abc' = 'abc' Þ '1' 'abc' == 'abc' Þ '1'

'ABC' = 'abc' Þ '0' 'ABC' == 'abc' Þ '0'

' abc ' = 'abc' Þ '1' ' abc ' == 'abc' Þ '0'

'abc ' = ' abc' Þ '1' 'abc ' == ' abc' Þ '0'

'99' = '99' Þ '1' '99' == '99' Þ '1'

'099' = '99' Þ '1' '099' == '99' Þ '0'

Normal The nor mal com par i son oper a tors are: comparison operators · Equal (‘‘=’’)

· Greater than (‘‘>’’)

Operators and Expressions 335 · Less than (‘‘<’’)

· Not equal (‘‘\=’’, ‘‘<>’’, ‘‘><’’)

· Greater than or equal to (‘‘>=‘‘, ’’\<’’)

· Less than or equal to (‘‘<=‘‘, ’’\>’’)

Strict The strict com par i son oper a tors are: comparison operators · Strictly equal (‘‘==’’)

· Strictly greater than (‘‘>>’’)

· Strictly less than (‘‘<<’’)

· Not strictly equal (‘‘\==’’)

· Strictly greater than or equal to (‘‘>>=”, “’\<<’’)

· Strictly less than or equal to (‘‘<<=”, “\>>’’)

Some exam ples:

'abc' < 'cde' Þ '1' 'abc' << 'cde' Þ '1'

'012' >= '9' Þ '1' '012' >>= '9' Þ '0'

' abc ' \< 'abc' Þ '1' ' abc ' \<< 'abc' Þ '0'

Concatenation The concat ena ti on opera tors join two strings together to form a longer string. The con- operators cat e na tion oper a tors are:

· Blank When KEXX encoun ter s, within an expres sion, two val ues sepa rat ed by one or more blanks, KEXX concat enate s the two values, placing a single blank betwee n them.

· Abuttal When KEXX en coun ters, within an ex pres sion, two val ues im me di ately ad ja cent to each other, KEXX concat enate s the two values, with no blank betwee n them.

· || Two val ues that you want to concat enate cannot al ways be unam bigu ously placed im medi ately adja cent to each other. For ex am ple, if the vari able name X is placed im me di ately ad ja cent to the vari able name Y, KEXX does not concat enate the val- ues of X and Y, but in stead takes this as a ref er ence to the vari able XY. For these

336 Chapter 6. Macro Reference cases, KEXX pro vides the con cat e na tion op er a tor ||, which also con cat e nates two val ues, plac ing no blanks be tween them. (The con cat e na tion op er a tor con sists of two oc currence s of charac ter code 124, which appears on most U.S. key boards as a split vertical bar, located on the backslash key.) In the follow ing exam ples, assume that X has the value ‘‘Hello’’ and Y has the value ‘‘there.’’, while XY has the value ‘‘Goodbye’ ’:

X Y Þ 'Hello there.' X Y Þ 'Hello there.' X'='Y Þ 'Hello=there.' XY Þ 'Goodbye' X||Y Þ 'Hellothere.' X || Y Þ 'Hellothere.' e

Logical Only the values 1 and 0, repre sent ing logi cal true and false values, are valid as operands c operators n of the logi cal opera tors. The results of the logi cal opera ti ons are them selves either 1 or e r

0. e f e R

· Ne ga tion (‘‘\’’) o

Nega ti on, a unary oper a tor , yields 0 if its oper and has the value 1, and yields 1 if its r c

oper and has the value 0. a M · And (‘‘&’’) And takes two operands, yielding 1 if both operands have the value 1, and yielding 0 if either oper and has the value 0.

· In clu sive or (‘‘|’’) Inclu sive or takes two operands, yielding 1 if ei ther oper and has the value 1, and yielding 0 if both operands have the value 0. (The inclu sive or oper a tor has charac - ter code 124, and appears on most U.S. key boards as a split verti cal bar, locat ed on the backslash key.)

· Ex clu sive or (‘‘&&’’) Exclu sive or takes two operands, yielding 1 if exact ly one of the operands has the value 1, and yielding 0 if both operands have the value 0 or both operands have the value 1.

Some exam ples:

\'1' Þ '0' '1' & '0' Þ '0' '1' | '0' Þ '1' '1' && '0' Þ '1' '1' && '1' Þ '0' (4 < 6) & (7 > 0) Þ '1' \('012' == '12') Þ '1'

Operator Oper ators of higher prece dence are eval u ated before oper ators of lower pre cedence. precedence When oper ators of equal pre cedence are encoun tered, KEXX evalu ates expres sions

Operators and Expressions 337 left-to-right. You can use parenthe ses to group subexpressions together if you need to change the nor mal order of evalu a ti on. Opera tor pre cedence , from highest to lowest:

· Unary plus, unary minus, nega ti on

· Exponentiation

· Mul ti pli ca tion, di vi sion, in te ger di vi sion, re main der

· Ad di tion, sub trac tion

· Con cat e na tion

· Com par i son

· And

· Or, ex clu sive or

6.6 Commands

Any clause that is not recog nize d as an assignm ent and is not one of the key word instructi ons dis cussed in the next sec tion is taken as an expression that is to be eval u - ated and passed to KEDIT as a com mand. It is only by issuing com mands to KEDIT that a macro can cause KEDIT to take any action (for example, move the cur sor, locate a string, or delete a line).

When the content of a KEDIT com mand string that you want to issue from a macro is fixed in advance, it should appear in the macro as a lit eral string enclosed in quotes. This prevents KEXX from interpret ing parts of the com mand as KEXX keywords, vari ables, or opera tors. Some exam ples:

'save \to tal.dat' ':17' 'i 27' Note the problem s that could occur if you left out the quotes in these exam ples. The first two exam ples would be invalid KEXX expres sions. The third exam ple would cause unexpect ed results in a macro that happened to use I as a vari able.

A com mand string passed to KEDIT from a KEXX macro need not be determ ined in advance. The result of evalu at ing any KEXX expression can be passed to KEDIT as a com mand. For exam ple:

'i' date() time() 'fileid' fn'.'fext ':'n After a com mand issued from a macro com pletes, a return code is placed in the vari able RC indi cat ing suc cess or failure of the com mand. Chapter 9, “Error Messages and Return Codes”, has a discus sion of the return codes set by KEDIT com mands.

338 Chapter 6. Macro Reference 6.7 Keyword Instructions

If a clause is not an assignm ent, KEXX checks to see if it begins with a KEXX keyword and is a KEXX key word instruc tion. (A clause that is nei ther an assignm ent nor a key - word instructi on is taken as an expression whose value is passed to KEDIT as a com mand.)

Below are the key word instructi ons that you can use.

ARG [template] The ARG instruc tion takes the ar gum ents of a KEXX macro, inter nal routi ne, or exter - nal routi ne and parses their val ues, in upper cas e, ac cording to the speci fie d tem plate.

ARG is a shorthand equiva lent of PARSE UPPER ARG. See Section 6.9, “The Parse e c

Instruction”, for a discus sion of the PARSE instruction. n e r e When execute d from a KEXX macro while no inter nal routi ne is active, ARG parses f e

the argum ent string passed to the macro when it was invoked. When exe cuted from an R

internal routi ne within a KEXX macro, or from an external routi ne, ARG parses the o r

argum ents to that routine. c a

* ARG ex am ple M call test 2,4,6 exit test: * this in ter nal rou tine ex pects three argu ments arg a,b,c say a*b*c re turn This exam ple would out put the value 48.

CALL name [ [,expr ...]] CALL ON condition [NAME trapname] CALL OFF condition The first form of the CALL instruc tion invokes a KEXX functi on as a subrou ti ne. The values of any ex pressions that you specify are passed as ar gum ents to the function.

See Section 6.8, “Functions”, for more about KEXX functi ons.

If KEXX finds a label within the current ly execut ing macro equal to the name of the functi on you want to call, KEXX sets the vari able SIGL equal to the line num ber of the CALL instructi on and then passes control to the internal routi ne beginning at that label. (This step is bypassed if the name is speci fie d in quotes.)

If name is not an internal routi ne, KEXX looks for a built-in functi on by that name, then (although in practi ce this would rarely be useful) for a KEDIT Boolean func tion or Implied EXTRACT functi on, and finally for an external routi ne, giving an error if the functi on cannot be found.

Keyword Instructions 339 The variable RESULT is set equal to the value returned by the functi on; if no value is returned, the vari able RESULT is dropped.

* CALL Ex am ple * call in ter nal rou tine to in put 5 lines call multi 'This is one',5 * call in ter nal rou tine to in put 10 lines call multi 'This is another',10 exit multi: parse arg s,n do i = 1 to n 'in put' s end return Two other forms of the CALL instructi on are

CALL ON con di tion [NAME trapname] and

CALL OFF con di tion They are dis cussed in Section 6.10, “Conditions”.

DO [repetitor] [conditional] clause(s) END The DO in struc tion ex ecutes a set of clauses as a unit. There are sev eral ways to specify how many times the clauses are to ex ecute:

DO A sim ple DO group is exe cute d once. This construc t al lows you to group togethe r sev eral clauses that are to be ex ecuted as a unit, nor mally within IF—THEN—ELSE con structs. For example: if x > 100 then do 'down 20' 'de lete' end

DO expr You can give an expres sion speci fy ing the num ber of times the loop is to be exe - cuted. For exam ple: * move the cursor three char ac ters to right do 3; 'cur sor right'; end

DO var = initexpr [TO toexpr] [BY byexpr] [FOR forexpr] This construc t is closest to the “DO loop” in other languages . A control vari able (var), which must be a sim ple variable and not a stem or com pound vari able, is given an ini tial value (initexpr). While the value of var is less than or equal to the

340 Chapter 6. Macro Reference value of toexpr, the loop is exe cute d and then the var is incre m ented by the value of byexpr (or by 1, if this is not speci fie d). (If byexpr is nega ti ve, the loop repeat s while var is greater than or equal to toexpr.) An opti onal forexpr ex pres sion spec i- fies the maxi m um num ber of times that the loop will be executed. For example:

* up percase ev ery sec ond line of the file do i = 2 to size.1() by 2 'lo cate :'i 'up percase' end

On a DO loop involv ing a control vari able, the ter minat ing END can opti onall y be followed by the name of the control vari able (END var). This forces an error if the vari able name does not cor respond to the control vari able for the loop being ended, helping you track down mism atched DO/END pairs. e c n e

DO FOREVER r e

You can spec ify that a loop re peat in def initely , un til it is ter minated by a LEAVE, f EXIT, or RE TURN in struc tion within the loop. e R

o r

* loop un til user en ters a num ber c

do for ever a

say 'En ter a num ber' M 'readv cmdline' if datatype(readv.1) = 'NUM' then leave end

DO WHILE expr You can use DO WHILE to spec ify that a loop repeat for as long as some speci fie d expres sion is true (that is, evalu ate s to 1). The expres sion will be evalu ate d at the start of each iter a ti on of the loop, and the loop will term inate if the expres sion is false.

* loop while file has < 1000 lines do while size.1() < 1000 'get data.fil' end

DO UNTIL expr You can use DO UNTIL to specify that a loop repeat unti l an expres sion be comes true. The expres sion will be evalu ate d at the end of each iter a ti on of the loop, and the loop will ter minate if the ex pres sion is true.

* loop un til user en ters a num ber do un til datatype(readv.1) = 'NUM' say 'En ter a num ber' 'readv cmdline' end

You can also com bine repet i ti ve DO loops with condi ti onal loops:

Keyword Instructions 341 * read 10 files, stopping af ter any er ror do i = 1 to 10 un til rc \= 0 'get file.'i end

DROP var1 [var2 ...] The DROP in struc tion re sets the spec ified variables to their de fault val ues (that is, the name of the vari ables in upper cas e), freeing up any space used to hold the variable s and their current values. If you DROP a stem, the values of all com pound vari ables whose names be gin with the speci fie d stem are also dropped.

The list of vari ables can also in clude variable names in pa ren the ses. When a vari able name in pa renthe ses is encoun ter ed, the vari able it self is not dropped, but its value is taken as a list of variable s that should them selves be dropped. For example:

list = 'a b c.19' drop v1 v2 (list) xyz

would drop the vari ables V1, V2, A, B, C.19, and XYZ.

EXIT [expr] The EXIT instruc tion ter minate s exe cu ti on of a KEXX macro. If expr is given, it spec i - fies a num eric return code in the range -32767 to 32767 to be passed back from the macro. (A return code of 0 is passed back if expr is not spec ifie d or has an invali d value.)

'locate /abc/' if rc \= 0 then exit rc else 'in put def'

IF expr THEN clause [ELSE clause] The IF instruc tion looks at the value of the speci fie d expres sion, which must evalu ate to 0 or 1. If the expres sion is true (eval uate s to 1), KEXX exe cute s the THEN clause. If the ex pres sion is false (eval u ates to 0), KEXX eval u ates the op tional ELSE clause. The THEN and ELSE clauses can be assign m ents, instruc tions, or com mands; multi ple clauses can be exe cute d by em bedding them in a DO—END pair. You can be gin a new line before or af ter THEN and before or af ter ELSE. If you want to have both a THEN clause and an ELSE clause on the same line, though, a semico lon (‘‘;’’) must follow the THEN clause.

Some exam ples:

342 Chapter 6. Macro Reference if size.1() = 0 then 'qquit'; else say 'File is not empty’ if size.1() = 0 then 'qquit' else say 'File is not empty' if x < 100 then do 'down 20' 'de lete' end else 'top'

INTERPRET expr The INTER PRET instruc tion takes the value of the expres sion expr and ex ecutes it, as

if it were one of the lines of your macro. This lets you construc t and exe cute KEXX in - e c

struc tions ‘‘on the fly’’ while your macro is running. n e r e

The text that you exe cute can con sist of a sin gle clause or mul tiple clauses sep arated by f e

semico lons. It can contai n DO instructi ons if it contai ns the com plete DO construc t, R

includ ing the ter mi nat ing END instruction. o r c

* INTER PRET Exam ple a

a = 'say 5' M b = '+ 6' * the next line would output 11 in ter pret a b v = 'test' * the next line would set the variable test to 17 in ter pret v '= 17' Note that the KEDIT IMMEDI A TE com mand works much like the INTER PRET instructi on. The dif ference is that INTER PRET execute s instruc tions as part of the cur- rent macro, while IMMEDI ATE exe cutes instructions as a sep arate one-line macro. When your macro uses INTERPRET , the instructions that are executed can access and change vari ables in your macro and, if they con tain syn tax errors, can ter minate exe cu - tion of your macro. If your macro instead uses the IMMEDI A TE com mand, the instruc - tions that are executed can not access or change variables in your macro, and if they contai n syntax errors, a bad return code will be passed back to your macro, but the macro will continue to execute.

ITERATE [var] The IT ERA TE instruc tion can be used only within a repet i ti ve DO loop (as opposed to a sim ple DO group). If var is not spec ifie d, ITER A TE ends exe cu ti on of the current it - era ti on of the inner m ost DO loop. If var is spec i fied, IT ER ATE ends ex e cu tion of the current it era ti on of the inner m ost DO loop using var as its con trol variable. Con trol re - turns to the top of the loop for exe cu ti on of the next iteration, if any.

Keyword Instructions 343 * ITER ATE Exam ple do i = 1 to 10 if i = 3 then iter ate * next line skipped when i is 3 say i 'is not equal to 3' end

LEAVE [var] The LEAVE instruc tion can be used only within a repet i ti ve DO loop (as opposed to a sim ple DO group). If var is not spec ifie d, LEAVE ends exe cu ti on of the inner m ost DO loop. If var is speci fie d, LEAVE ends exe cu ti on of the inner m ost DO loop using var as its control vari able. Control passes to the clause after the END instruc tion at the end of the loop.

* LEAVE Ex am ple do i = 1 to 10 'down' i * loop ter mi nates on non zero return code if rc \= 0 then leave 'change /abc/def/' end 'add 5'

NOP NOP (“no op er a tion”) is a dummy instruc tion that does noth ing.

NUMERIC DIGITS [expression] NUMERIC FUZZ [expression] With NUMER IC DIGITS ex pres sion, the value of ex pres sion, which must be a posi ti ve whole num ber, de ter mines the pre ci sion used in arith me tic op er a tions. By de fault, 9 signif i cant digit s will be used for re sults of arithm eti c oper a ti ons, but you can specify that KEXX should use up to 1000 signif i cant digit s. NUMER IC DIGITS values of less than 9 can be speci fie d but are gener all y not useful. If ex pres sion is omitted, the de fault of NUMERIC DIGITS 9 is put into effect.

Less often used than NUMERIC DIG ITS is NUMERIC FUZZ. With NUMERIC FUZZ expres sion, the value of expres sion, which must be a non-nega ti ve whole num - ber less than the current NUMERIC DIGITS setti ng, determ ines how many low-order digit s are ignored during numeric com pari sons. By default, NUMERIC FUZZ is 0 and no digit s are ignored. But if, for exam ple, NUMERIC DIGITS 9 and NUMERIC FUZZ 1 are in effect and two nine-digit num bers are com pared, KEXX actuall y rounds these num bers to 8 digit s and com pares the two eight-digit num bers. This allows for com par- isons that yield useful results when com paring num bers that are only approxi m ately equal due to rounding that occurs during arithm eti c opera ti ons. If NUMERIC FUZZ is used and no expres sion is spec ified , the default of NUMERIC FUZZ 0 is put into effect.

The NUMERIC set tings are preserve d and restored across calls to inter nal routi nes.

344 Chapter 6. Macro Reference OPTIONS expression OP TIONS is a REXX in struc tion that al lows you to pass spe cial op tions to the lan - guage proces sor. KEXX does not use any such spe cial opti ons, so the OPTIONS in - struc tion is allowed within KEXX program s, but is ignored.

PARSE [UPPER] origin [template] The PARSE instruc tion takes charac ter strings and assigns porti ons of their values to a set of KEXX variable s ac cording to a tem plate that you provide.

UPPER is optional and speci fie s that the strings are to be convert ed to uppercas e before being parsed according to the tem plate.

Origin speci fie s where the PARSE instructi on is to obtain the data to be parsed. e Template is a set of pat tern spec ifi ca tions that con trols the pars ing pro cess, inter mixed c n e

with lists of vari ables to which the parse data is to be assigned. r e f

The PARSE instruc tion is dis cussed in detail in Section 6.9, “The Parse Instruction”. e R

o r c

PROCEDURE [EXPOSE var1 var2 ...] a

The PRO CE DURE in struc tion is valid only at the start of a KEXX in ter nal rou tine; it M must be the first instruc tion encoun ter ed after the label that be gins the inter nal routi ne. The PRO CE DURE in struc tion tells KEXX to make all vari ables used in the rou tine lo - cal to the routi ne. Vari ables in the routi ne do not inheri t val ues from the call ing routi ne and vari ables set in the routi ne do not af fect the values of variable s of the same name in the calling rou tine. In con trast, when PRO CE DURE is not the first in struc tion of an in - ter nal routi ne, all variable s used in the routine are shared with the calling routine.

* PROCE DURE Exam ple do i = 1 to 10 say sum(i) end exit sum: proce dure * i in this proce dure does n’t affect i in main routine to tal = 0 do i = 1 to arg(1) to tal = to tal + i end re turn total PROCE DURE can optionall y be followed by the key word EXPOSE and a list of vari - ables that should not be local to the proce dure, but should instead be shared with the caller of the pro cedur e. That is, ref er ences to vari ables in the list are treated as ref er - ences to vari ables of the same name in the call ing pro cedur e. For example:

Keyword Instructions 345 x = 1 y = 2 call test say x y exit test: proce dure expose x x = 55 y = 66 re turn

would display ‘‘55 2’’, because changes made within TEST to the value of X are exposed to the caller, while changes made to Y are not.

The list of vari ables to be exposed can include sim ple variable s, com pound vari ables, and stem vari ables. Items in the list can also be vari able names in paren the ses. In this case, the vari able in parenthe ses is first exposed, and then its value is taken to be a list of additi onal variable s to be exposed. For example:

height = 12 width = 13 depth = 14 globals = 'height width' call test exit test: proce dure expose (globals) say height width depth re turn

would display ‘‘12 13 DEPTH’’, since height and width are exposed, but depth is not.

PULL [template] The PULL instruc tion waits for a line of input to be enter ed on the KEDIT com mand line, uppercases it, and then parses it ac cord ing to the spec ified template. PULL is a shorthand equiva lent of PARSE UPPER PULL. See Section 6.9, “The Parse Instruction”, for a discus sion of the PARSE instruction.

RETURN [expr] The RETURN instruc tion ends exe cu ti on of an inter nal or exter nal KEXX routi ne and returns control to the caller. If the routi ne was invoked as a functi on, expr is re quired and its value is used as the result of the functi on. If the routi ne was invoked through the CALL instruc tion as a subrou ti ne, expr is op tional and, if it is spec ified , the spe cial vari able RE SULT is set equal to its value. If no in ter nal rou tine is ac tive and RE TURN is exe cute d from the main body of a macro, RETURN is equiva lent to EXIT and serves to terminate execution of the macro.

SAY [expr] The SAY instruc tion display s the value of the spec ifie d expres sion on the KEDIT mes- sage line. If no expres sion is given, a blank line is display ed. When the KEXX

346 Chapter 6. Macro Reference debugger is ac tive, SAY instruc tions is sued from the de bugging com mand line send output to the de bugging window rather than the KEDIT message line.

say 'There are' size.1() 'lines in this file.'

SELECT WHEN expr THEN clause ... [OTHERWISE instructionlist] END The SE LECT instruc tion lets you exe cute one se quence of instruc tions out of a set of possi ble alter nati ves. SELEC T of fers a cleaner way of speci fy ing what would other - wise be a sequence of IF—THEN—ELSE instructions. e

An exam ple of a SELECT instructi on: c n e r

se lect e when op tion = 'A' then call optiona f e

when op tion = 'B' then call optionb R

when op tion = 'C' then do o say 'Op tion C se lected' r c

call optionc a

end M oth er wise say 'Un known op tion spec i fied' re turn end

SELECT construc ts begin with a SELECT instructi on and end with an END instruc- tion. In between, you use one of more instruc tions of the form

WHEN expres sion THEN instruc tion Each WHEN expres sion is tested in sequence. As soon as one is found to be true (that is, has the value 1), the corre spond ing THEN instructi on is execute d. To execute more than one instructi on when an expression is found to be true, group them together within a DO—END pair. After the THEN instruc tion corre spond ing to the true expression has been execute d, no addi tional WHEN expressions are evalu ate d, and exe cuti on conti n - ues with the instruc tion follow ing the END that ter minates the SELECT construct.

OTHER WISE instructionlist The set of WHEN—THEN instruc tions can be fol lowed by the key word OTHER WISE and a sequence of zero or more instruc tions to be execute d if none of the WHEN expres sions are true. If you know that at least one of the WHEN expres sions will always be true you can omit the OTHER WISE construc t, but KEXX gener ate s an error if none of the WHEN expres sions are true and OTHER WISE is not present.

Keyword Instructions 347 SIGNAL label SIGNAL ON condition [NAME trapname] SIGNAL OFF condition Use the SIG NAL in struc tion to imme di ately trans fer con trol to some other lo ca tion within a KEXX program . To do this, use

SIGNAL label where label is the label to which you want to transfer control . Execu ti on of any active DO, IF, SELECT, and INTER PRET instruc tions in the cur rent rou tine is ter minated , and exe cu tion con tin ues at the spec i fied label.

Also available are

SIG NAL ON con di tion [NAME trapname] and

SIGNAL OFF condi tion They are dis cussed in Section 6.10, “Conditions”.

TRACE setting The TRACE instruc tion control s the type of trace output display ed while you are de - bugging a KEXX macro and whether tracing is done inter acti vely or non-inter acti vely. The TRACE instruc tion has no ef fect when the KEXX de bugging window , control led by the SET DEBUG GING com mand, is not active.

The level of trace out put produced by the debugger is control led by the KEXX TRACE instructi on. The TRACE instruc tion can appear within a KEXX macro and it can be entered when the debugger pauses for interac ti ve trace input. When interac ti ve debug- ging is active, TRACE instruc tions issued from your macro are ignored so that inter ac- tive debugging will not be unexpect edly interrupted.

The tracing level is pre served and restored across calls to inter nal routi nes, so changes to the tracing level in a subrou ti ne do not affect the tracing level in the call ing routi ne.

Here are the trac ing lev els that you can use. Note that only the first char acter of the TRACE set ting is sig nif i cant: TRACE Off No trace out put is produced. (TRACE Off also turns off inter acti ve tracing if it is in ef fect.) TRACE Error Any com mand passed to KEDIT that yields a nonzero re turn code is traced, along with its re turn code. TRACE Command All clauses that cause com mands to be is sued to KEDIT are traced, as well as the com mands them selves and any nonzero re turn codes.

348 Chapter 6. Macro Reference TRACE All All clauses are traced as they are ex ecuted, as well as all com mands is sued to KEDIT and any nonzero re turn codes. TRACE Results Same as TRACE All, ex cept that the fi nal re sults of all ex pres sions evalu ated are also traced. TRACE In ter me di ates Same as TRACE All, ex cept that both the in ter medi ate and final re sults of all ex - pres sions evalu ated are also traced. TRACE Labels Traces la bels in the macro as they are en coun tered dur ing ex ecu tion of the macro.

In addi tion to control ling the level of trace out put, you can also use the TRACE instruc -

tion to turn interac ti ve tracing on or off. e c n e

TRACE + turns in ter ac tive trac ing on. r e f TRACE - turns in ter ac tive trac ing off. e R

o TRACE ? tog gles the in ter ac tive trac ing on if it is off, or off if it is on. r c a

You can use +, -, or ? in com bina ti on with one of the trace set tings dis cussed above. For M exam ple,

TRACE +R turns on inter acti ve tracing of re sults, while

TRACE -C causes noninteractive tracing of com mands.

You can also use the TRACE instruc tion to tell the debugger to tem porari ly stop paus- ing for inter acti ve input, or to tem porari ly stop display ing trace output. To do this, spec ify a numeric value with the TRACE instruc tion:

TRACE nnnn A posi ti ve num ber tells the debugger to conti nue exe cut ing your macro, and to conti nue dis play ing trace output, but that at the next nnnn places where it would ordi nari ly pause for inter acti ve input, it should inste ad conti nue without a pause.

TRACE -nnnn A nega ti ve num ber works like a posi ti ve num ber, in that the next nnnn pauses for inter acti ve input are skipped. The dif ference is that during this pe riod the dis play of trace out put is also suppressed.

6.8 Functions

To call a functi on from within a KEXX expression, use the name of the functi on, followed by a left parenthe sis , followe d by any argum ents to the functi on (the argu - ments are themselves KEXX expres sions, and are sep arated from each other by commas), fol lowed by a right parenthe sis . There can be no interven ing blanks between the name of the functi on and the left parenthe sis that follows it. All func tions invoked

Functions 349 in this manner return a value, which KEXX uses to eval uate the expression involving the function. Some examples:

lastchr = substr(s, length(s)) if size.1() = 0 then say 'File is empty' if af ter() then 'sos endchar' Instead of using the value of a functi on within an expression, you can use the CALL instructi on to invoke a func tion as a subrou ti ne. This is usuall y done when the functi on is called for its side effects, and the functi on either does not return a value or the returned value is of sec ondary importanc e. If a functi on invoked via the CALL instruc- tion does return a value, the value is assigned to the spe cial variable RESULT. Note that while parenthe ses are required around the param eter list when invoking a functi on from within an expression, parenthe ses are not allowed around the param eter list passed with the CALL instruction.

call time r call pro cess 'Some data', 'More data' When searching for a functi on, KEDIT looks first for an internal routi ne with the speci - fied name, then for a built-in func tion, an implied EXTRACT functi on, a Boolean functi on, and finally an external routi ne. (The search for an internal routi ne is bypassed if the name of the functi on is in quotes.)

Internal You can write your own functi ons, place them inside a KEXX macro as internal rou - routines tines, and call them from elsewher e in the same KEXX macro.

An internal routi ne must begin with a label—the name of the routi ne fol lowed by a colon. Control is returned from the inter nal routi ne to the call ing routi ne with a RETURN instruc tion. The inter nal rou tine can return a value to its caller (and is required to do so if it was invoked as a func tion) by speci fy ing a result expression with the RETURN instruction.

Here is an exam ple of an internal routi ne:

say sum3(2,4,6) say sum3(6,8,10) exit sum3: * add up three numbers and re turn the sum arg n1, n2, n3 re turn n1+n2+n3 This sam ple macro would output 12 and 24 on the KEDIT message line.

An inter nal rou tine can nor mally access all of the caller’s vari ables, and all vari ables set in the inter nal rou tine are nor mally acces si ble to the caller after the inter nal rou tine returns. With PRO CE DURE as the first instruc tion of an inter nal rou tine, variables used in the inter nal routi ne will instead be local to the routi ne and the routi ne will not have access to the vari ables of its caller. You can use PRO CEDURE EXPOSE to share spe cific vari ables between the caller and the inter nal rou tine, leav ing all other vari ables as local to the internal routine.

350 Chapter 6. Macro Reference The current NUMERIC and TRACE setti ngs, and the value of the elapsed-time clock used with the TIME() functi on, are saved whenever an internal routi ne is invoked and are restored on return from that routi ne, so that changes made to these setti ngs by an internal routi ne do not affect the environ m ent of its caller.

Built-in Some functi ons are “built into” KEXX in the sense that they perform generic opera - functions tions on their argum ents, inde pendent of the status of your KEDIT session. KEXX’s built-in functi ons are docu m ented in the next section.

Implied KEXX macros can use KEDIT’s EXTRACT com mand to obtain inform ati on about the EXTRACT sta tus of KEDIT, with the results placed into KEXX vari ables. Implied EXTRACT functions func tions, doc u mented in Section 5.2, “EXTRACT and Implied EXTRACTs”, gener - ally pro vide a more direct and efficient way to access this infor mation within a KEXX expression. e c

Boolean KEXX macros can obtain additi onal inform ati on about the status of KEDIT by using n e functions KEDIT’s Boolean func tions, which return 1 or 0 depending on whether certai n condi - r e tions within KEDIT are true or false. Boolean func tions are docu m ented in f e

Section 6.8.3, “Boolean Functions”. R

o r c

External A KEXX macro can call another KEXX macro as an exter nal sub rou tine. The exter nal a

routines subrou ti ne can use PARSE ARG to access the argum ents passed to it, and can use the M RETURN instruc tion to pass a result back to the caller.

When searching for an external routi ne, the order of searching is the same as it is with the MACRO com mand: in-mem ory macros loaded via the DEFINE com mand are searched for first, and then macros in disk files (with a default extension of .KEX) are searched for, with the search order control led by the current SET MACROPATH setting.

External routi ne names with drive or path com ponents , or including spe cial charac ter s, must be spec ifie d as quoted names.

For exam ple,

CALL 'F:\MAC ROS\SAM PLE' X, Y, Z or

SAY '&&&'(17)

6.8.1 Built-in Functions

KEXX supports all of the built-in functi ons described in Cowlishaw’s The REXX Language: A Practi cal Approach to Program ming (Sec ond Editi on, Prentice-Hall, 1990), with the excepti on of the STREAM() functi on. It also supports the fol lowing functi ons, which are not included in Cowlishaw’s book: BEEP(), DATECONV(), DELIMIT(), DOSENV(), DOSDIR(), ANSIUPPER(), ANSILOWER(), ANSIDATATYPE(), ANSITOOEM(), OEMTOANSI(), UPPER(), LOWER(), COUNTSTR(), CHANGESTR(). LONGNAME(), and SHORTNAME().

Functions 351 Some general rules for the argum ents to these built-in functi ons:

· Where a func tion ac cepts an op tion ar gu ment, only the first char acter of op tion is sig nif icant and it may be spec ified in up per case or in lowercase.

· Where a func tion ac cepts a pad ar gu ment, the argu ment must be a sin gle char acter .

· Where an opti onal ar gum ent is omit ted, you should spec ify nothing, not even a null string, in its place. For ex ample, to omit the third ar gu ment to the SUBSTR() functi on, you could use

t = substr(s,3,,'.') The two ad ja cent comm as in the above ex am ple are re quired to in di cate that it is the third ar gum ent that is omit ted and that the fourth is suppli ed. However , if the fi - nal ar gu ment or argu ments are omitted, trail ing comm as are not nec es sary and are usuall y not suppli ed. So here is a valid way of omit ting the third and fourth arguments for SUBSTR():

t = substr(s,3,,) But here is the form in which this functi on call would norm ally appear:

t = substr(s,3)

ABBREV(string1,string2[,length]) Returns 1 if string2 is equal to the first char acters in string1; other wise , 0 is returne d. If length is spec ified , string2 must be at least length charac ter s long or 0 will be returne d.

abbrev('clocate','cl') Þ 1 abbrev('clocate','clo',2) Þ 1 abbrev('clocate','c',2) Þ 0

ABS(number) Returns the abso lut e value of num ber, form atted accord ing to the current NUMER IC set tings.

abs(-3.2) Þ 3.2 abs(0) Þ 0 abs(' +32760') Þ 32760

ANSIDATATYPE(string[,option]) ANSIDATATYPE() works in exact ly the same way as the more-com monly-used DATATYPE() function, ex cept that the “A”,“L”, “M”, and “U” op tions as sume that string uses the ANSI char acter set and they treat all alpha betic char acters, in clud ing ac - cented let ters with char acter codes above 127, as al pha betic. DATATYPE(), on the other hand, treats only the 26 charac ter s of the Engli sh al phabet as alphabetic.

352 Chapter 6. Macro Reference If op tion is not speci fied, ANSIDATATYPE() returns ‘‘NUM’’ if string is a valid KEXX num ber or ‘‘CHAR’’ if it is not. If op tion is spec ified , it is han dled as follow s:

A (‘‘Al pha nu meric’’) Re turns 1 if string consis ts enti rely of ANSI alpha beti c and/or nu meric (‘‘0—9’’) char acters, else re turns 0;

B (‘‘Binary’ ’) Returns 1 if string con sists en tirely of the char acters ‘‘0’’ and ‘‘1’’, else re turns 0;

L (‘‘Low er case’’) Re turns 1 if string con sists en tirely of low er case ANSI alpha betic char acters , else re turns 0;

M (‘‘Mixed case’’) Returns 1 if string con sists en tirely of ANSI al pha betic char ac - ters, else re turns 0; e c n

N (‘‘Nu meric’’) Returns 1 if string is a valid KEXX num ber, else re turns 0; e r e f

S (‘‘Sym bol’’) Returns 1 if string con sists en tirely of char acters that are valid in e R

KEXX sym bols, else returns 0; o r

U (‘‘Up per case’’) Re turns 1 if string consis ts enti rely of upper cas e ANSI alpha beti c c a

char ac ters, else re turns 0; M

W (‘‘Whole num ber’’) Re turns 1 if string is a whole num ber. That is, 1 is re turned if string is a valid KEXX num ber that can be express ed as an inte ger , with no deci - mal point or expo nen ti al nota ti on, under the current NUMER IC DIGITS setti ng. Oth er wise returns 0;

X (‘‘heX a dec i mal’’) Re turns 1 if string is the null string or con sists en tirely of valid hexa dec i m al digit s (‘‘a—f’’, ‘‘A—F’’, ‘‘0—9’’), with opti onal blanks be tween pairs of hex a dec i mal dig its. Oth er wise returns 0.

ANSILOWER(string) Returns the value of string with any up per case letters trans lated to low er case. String is as sumed to be in the ANSI char acter set and char acters ‘‘A—Z’’, as well as accented up per case char acters with ANSI char acter codes above 127, are affected.

ansilower('AbCd123') Þ 'abcd123'

ANSITOOEM(string) Returns the result of convert ing string, which is as sumed to be in the ANSI char acter set, to the OEM char acter set.

Functions 353 ANSIUPPER(string) Returns the value of string with any low er case letters trans lated to up per case. String is as sumed to be in the ANSI char acter set and char acters ‘‘a—z’’, as well as accented low er case char acters with ANSI char acter codes above 128, are affected.

ansiupper('AbCd123') Þ 'ABCD123'

ARG([n[,option]]) ARG() re turns infor m ati on about the ar gum ents passed to a macro or, when used within an inter nal routi ne, about ar gum ents to the inter nal routine. ARG() with no param eter s returns the num ber of argum ents passed to the macro or internal routi ne. Macros can have either 0 or 1 argum ents. Internal routi nes can have 0 to 10 argum ents. ARG(n) returns the value of the nth argum ent, or returns a null string if the nth argu- ment was omitted. ARG(n,option) accepts the option ‘‘E’’ (‘‘Exist s’’), return ing 1 if the nth argu ment to the macro or inter nal rou tine is present and 0 if it was omit ted, and accepts the option ‘‘O’’ (‘‘Omitted’ ’), returning 1 if the nth argum ent was omit ted and 0 if it is present. In the first group of exam ples, assume that the macro TEST is invoked via the follow - ing KEDIT com mand:

macro test I think, therefore, I am.

arg() Þ 1 arg(1) Þ 'I think, there fore, I am.' arg(2) Þ '' arg(1,'e') Þ 1 arg(1,'o') Þ 0

In the next group of exam ples, assume that ARG() is used within an internal routi ne INTEST invoked by

call intest 'I think', 'therefore', 'I am.'

arg() Þ 3 arg(1) Þ 'I think' arg(2) Þ 'therefore' arg(3) Þ 'I am.' arg(1,'e') Þ 1 arg(1,'o') Þ 0

354 Chapter 6. Macro Reference BEEP() Causes the PC’s speaker to beep and returns a null string as its value.

call beep

BITAND(string1[,string2[,pad]]) Re turns the re sult of the log ical ANDing of the bits in string1 with those in string2, which defaul ts to the null string. The shorter string is padded with the pad char ac ter, if spec ifie d, prior to the ANDing. If pad is not speci fied, the rem ain ing char acters of the re sult are the rem ain ing char acters in the longer string.

bitand('31ff'x, 'ff30'x) Þ '10' /* (‘3130’x) */ bitand('ABC','abc') Þ 'ABC' e

bitand('0011'x, '0101'x) Þ '0001'x c n

bitand('ABC','abcef') Þ 'ABCef' e r e

bitand('ABCEF','abc') Þ 'ABCEF' f e R

o r c

BITOR(string1[,string2[,pad]]) a Re turns the re sult of the log ical ORing of the bits in string1 with those in string2, which M defaul ts to the null string. The shorter string is padded with the pad char acter , if spec i- fied, prior to the ORing. If pad is not speci fied, the rem ain ing char acters of the re sult are the re main ing char acters in the longer string.

bitor(135,222) Þ 337 bitor('313335'x, '323232'x) Þ '333337'x bitor(’ABC’,’’,’ ’) Þ ’abc’ bitor('0011'x, '0101'x) Þ '0111'x

BITXOR(string1[,string2[,pad]]) Re turns the re sult of the log ical eX clu sive ORing of the bits in string1 with those in string2, which defaul ts to the null string. The shorter string is padded with the pad character, if spec ified, prior to the op er ation. If pad is not spec ified , the re maining char acters of the re sult are the rem ain ing char acters in the longer string.

bitxor('abc', ' ') Þ 'ABC' bitxor(3579,,'01'x) Þ 2468 bitxor('0011'x, '0101'x) Þ '0110'x

B2X(binary-string) Convert s a string in binary nota ti on (that is, consis ting of zeroes and ones) into the equiva lent hexa dec i m al string. Blanks may be include d in bi nary-string, at four char - ac ter boundaries.

Functions 355 b2x('1101') Þ 'D' b2x('00001101') Þ '0D' b2x('1011010011111') Þ '169F'

CENTER(string,length[,pad]) CENTRE(string,length[,pad]) Returns a string of length length with string cen tered within it, pad ded if neces sary with the pad char acter , which de faults to a blank.

center('ti tle',12) Þ ' ti tle ' center('ti tle',12,'*') Þ '***title****' cen ter('ti tle ',12) Þ ' ti tle ' cen ter('ti tle ',12,'*') Þ '**ti tle **'

CHANGESTR(needle, haystack, newneedle) Returns the result of changing all occur rence s of the string nee dle in the string hay stack into occur rence s of the string newneedle.

changestr('a', 'abABab', 'x') Þ 'xbABxb' changestr('aa', 'aaabbaa', 'x') Þ 'xabbx' changestr(’3’, ’123123123’, ’’) Þ ’121212’

CHARIN(fileid[,[start][,length]]) Reads data from a file. The read posi ti on for the file is first moved to the speci fie d start posi ti on in the file, and up to length char acters are read in and returned as CHARIN’s re sult. Fewer than length char acters may be read if the file does not ex ist, if end-of-file is reached, or if an I/O error occurs. If length is zero, then the read posi ti on is moved to the spec i fied start posi ti on, but no data is read.

Start defaults to the current read positi on for the file and length defaults to 1. If fileid is not already open, it is first opened and the read positi on is set to 1 (the beginning of the file). On com pleti on of the read opera ti on, the read positi on for the file is then moved just beyond the last char acter read.

The maxi m um allowable value for start and for length is 999999999.

See page 374 for some general notes on KEXX’s I/O functi ons.

charin('sample.fil',,14) Þ 'Data from file’ charin('sample.fil',100,19) Þ '100 bytes into file’

CHAROUT(fileid[,[string][,start]]) Writes data to a file. The write po si tion for the file is first moved to the spec ified start posi ti on in the file, and the content s of string are writ ten to the file. CHAROUT re turns

356 Chapter 6. Macro Reference as its value the number of char acters from string that were not writ ten out; this value will be 0 unles s an I/O error or disk full condi ti on is encountered.

Start defaults to the cur rent write posi tion for the file. If fileid is not already open, it is first opened and the write posi tion is ini tially set to the end of the file, so that the file will be appended to. After the write opera ti on com pletes, the write positi on for the file is moved just beyond the last charac ter writ ten. If start is speci fie d but string is omitted, the write posi tion for the file is updated but no data is written.

The maxi m um allowable value for start is 999999999.

If both string and start are omitted, the file is closed.

See page 374 for some general notes on KEXX’s I/O functi ons. e c

charout('name.ext','Some data') Þ 0 /* if no error */ n e

charout('name.ext','Data for byte 100',100) Þ 0 /* if no error */ r e f e R

CHARS(fileid) o r

Returns the number of char acters re main ing to be read in the spec ified file, starting c a

from the current read posi ti on. M

The maxi m um value returne d is 999999999, regard les s of the actual size of the file in - volved.

chars('name.ext') Þ 1234 /* per haps */ chars('nonexist.ent') Þ 0 /* per haps */

COMPARE(string1,string2[,pad]) Returns 0 if string1 equals string2. Oth er wise, the po si tion of the first mis matched charac ter is re turned. The shorter string is padded with pad, which defaul ts to a blank.

com pare('this is it', 'this is it') Þ 0 com pare('this is it', 'this is not it') Þ 9

CONDITION([option]) Re turns in for ma tion about the cur rently trapped con di tion. For in for ma tion about con- di tion han dling, see Section 6.10, “Conditions”. If no condi ti on is current ly being han- dled, the CONDI TION() func tion returns the null string.

Pos si ble val ues for option, which defaults to ‘‘I’’, are:

C (‘‘Condi ti on name’’) Re turns the name of the current condi ti on, which can be ER- ROR, FAILURE, HALT, SYNT AX, or NOVALUE.

Functions 357 D (‘‘Descri pti on’’) Re turns a descri pti on of the current condi ti on. For HALT and SYNT AX condi ti ons, this is the null string. For the ER ROR or FAILURE condi - tion, this is the com mand string that led to the error or failure. For the NOVALUE condi ti on, this is the de rived name of the variable involved.

I (‘‘Instruc tion’’) Re turns CALL or SIGNAL, depend ing on the method used to in - voke the signal handler .

S (‘‘State’’) Re turns the state of the cur rent con di tion: ON, OFF, or DE LAY.

COPIES(string,n) Re turns n copies of string con cat e nated to gether.

copies('-',10) Þ '—————' copies('abc',3) Þ 'abcabcabc' copies('',5) Þ ''

COUNTSTR(needle, haystack) Returns the num ber of occur rence s of the string nee dle in the string hay stack.

COUNTSTR('a', 'abABab') Þ 2 COUNTSTR('aa', 'aaabbaa') Þ 2 COUNTSTR('3', '123123123') Þ 3

C2D(string) Re turns the dec i mal value of the in ter nal rep re sen ta tion of string. String is most of ten one charac ter long, in which case this amounts to return ing the dec im al value of the char acter code for the spec ified char acter . An er ror oc curs if the re sult can not be ex - pressed as a whole num ber ac cording to the current NUMERIC DIGITS setting.

c2d('a') Þ 97 c2d(1) Þ 49 c2d('ff'x) Þ 255 c2d('yz') Þ 31098

C2X(string) Re turns a string con sist ing of the two-char ac ter hex a dec i mal val ues of the char ac ter codes for each of the char acters in string.

c2x('a') Þ 61 c2x(1) Þ 31 c2x('ff'x) Þ 'FF' c2x('yz') Þ '797A'

358 Chapter 6. Macro Reference DATATYPE(string[,option]) If op tion is not spec ified , re turns ‘‘NUM’’ if string is a valid KEXX num ber or ‘‘CHAR’’ if it is not. If op tion is spec ified , it is han dled as follow s:

A (‘‘Al pha nu meric’’) Re turns 1 if string con sists en tirely of al pha betic (‘‘A—Z’’, ‘‘a—z’’) and/or nu meric (‘‘0—9’’) char acters, else re turns 0;

B (‘‘Binary’ ’) Returns 1 if string con sists en tirely of the char acters ‘‘0’’ and ‘‘1’’, else re turns 0;

L (‘‘Low er case’’) Re turns 1 if string con sists en tirely of low er case al pha betic char - acters (‘‘a—z’’), else returns 0;

M (‘‘Mixed case’’) Returns 1 if string con sists en tirely of al pha betic char ac ters (‘‘A—Z’’, ‘‘a—z’’), else returns 0; e c n e

N (‘‘Nu meric’’) Returns 1 if string is a valid KEXX num ber, else re turns 0; r e f e

S (‘‘Sym bol’’) Returns 1 if string con sists en tirely of char acters that are valid in R

KEXX sym bols, else returns 0; o r c U (‘‘Up per case’’) Re turns 1 if string con sists en tirely of up per case al pha betic char - a acters (‘‘A—Z’’), else returns 0; M

W (‘‘Whole num ber’’) Re turns 1 if string is a whole num ber. That is, 1 is re turned if string is a valid KEXX num ber that can be express ed as an inte ger , with no deci - mal point or expo nen ti al nota ti on, under the current NUMER IC DIGITS setti ng. Oth er wise returns 0;

X (‘‘heX a dec i mal’’) Re turns 1 if string is the null string or con sists en tirely of valid hexa dec i m al digit s (‘‘a—f’’, ‘‘A—F’’, ‘‘0—9’’), with opti onal blanks be tween pairs of hex a dec i mal dig its. Oth er wise returns 0.

For each of these options except ‘‘X’’ (which returns 1), 0 is returned if string is the null string. datatype(16) Þ 'NUM' datatype(16YY) Þ 'CHAR' datatype(16,'N') Þ 1 datatype(16.0,'N') Þ 1 datatype('Kexx','A') Þ 1 datatype('Kexx','L') Þ 0 datatype('Kexx','U') Þ 0 datatype('Kexx','M') Þ 1 datatype('KEXX 5.5','A') Þ 0 datatype('KEXX55','A') Þ 1 datatype('KEXX','L') Þ 0 datatype('KEXX','U') Þ 1 datatype('KEXX','M') Þ 1 datatype(‘‘,'M') Þ 0

Functions 359 datatype('KEXX','S') Þ 1 datatype('1010','B') Þ 1 datatype('10 10 ','B') Þ 0 datatype('4e4f','X') Þ 1 datatype('4e 4f','X') Þ 1 datatype('4.3','W') Þ 0

DATE([option]) Re turns in for ma tion about the cur rent date. Pos si ble val ues for op tion, which defaul ts to ‘‘N’’, are:

B (‘‘Base’’) Re turns a unique seria l num ber for each day (based on the num ber of days since 1 Janu ary 0001);

D (‘‘Days’’) Returns the day of the year;

E (‘‘Euro pean’ ’) Re turns the date in the form dd/mm/yy;

J (‘‘Julian’’) Re turns the date in the form yyddd;

M (‘‘Month’’) Re turns the name of the current month;

N (‘‘Nor mal’’) Returns the date in the form dd mmm yyyy, with no lead ing zero on the day of the month;

O (‘‘Or dered’’) Returns the date in the form yy/mm/dd;

S (‘‘Standard’ ’) Re turns the date in the form yyyymmdd;

U (‘‘USA’’) Returns the date in the form mm/dd/yy;

W (‘‘Weekday’ ’) Re turns the Engli sh name of the current day of the week.

Here are the val ues returned by the DATE() func tion on August 23, 1994:

date() Þ '23 Aug 1994' date('b') Þ 728162 date('d') Þ 235 date('e') Þ '23/08/94' date('j') Þ 94235

date('m') Þ 'August' date('n') Þ '23 Aug 1994' date('o') Þ '94/08/23' date('s') Þ 19940823 date('u') Þ '08/23/94' date('w') Þ 'Tuesday'

360 Chapter 6. Macro Reference DATECONV(date,input,[output]) DATECONV converts date from one form at to another and returns the result . The in put ar gu ment spec i fies the cur rent for mat of date, which can be ‘‘B’’, ‘‘D’’, “E”, “J”, “N”, ‘‘O’’, “S”, or “U’’. The out put for mat can be ‘‘B’’, ‘‘D’’, ‘‘E’’, ‘‘J’’, ‘‘M’’, ‘‘N’’, ‘‘O’’, ‘‘S’’, ‘‘U’’, or ‘‘W’’ and defaul ts to ‘‘N’’. The form ats involved are based on those used with the DATE() func tion. A null string is re turned if date is not a valid date ac cording to the spec ified in put format.

dateconv('25 Dec 1994','n','w') Þ 'Sunday' dateconv('19940823','s','u') Þ '08/23/94' dateconv('19950201','s') Þ '1 Feb 1995’

When DATECONV() is used to convert a date that is spec ifie d using a 2-digit year, it assum es that the date falls within a 100 year sliding window starting at e c n

(cur rent year - 50) e r e f

and ending at e R

o

(cur rent year + 49) r c For exam ple, in 2007, DATECONV would convert 2-digit years to 4-digit years in the a M range 1957–2056. So, in 2007, DATECONV would yield these results:

dateconv('12/17/02','u','n') Þ '17 Dec 2002' dateconv('11/22/57','u','n') Þ '22 Nov 1957'

But in 2008, the sliding window would move by a year to cover 1958–2057. So, in 2008, DATECONV would yield these results:

dateconv('12/17/02','u','n') Þ '17 Dec 2002' dateconv('11/22/57','u','n') Þ '22 Nov 2057'

DELIMIT(string1[,string2]) Searches an in ter nal list of valid KEDIT de lim iter char acters for a char acter that does not appear in string1 and returns a string consis ting of the deli m iter charac ter , string1, and the de lim iter char ac ter. If string2 is also spec ified, looks for a de lim iter char acter that appears in nei ther string and returns a string consis ting of the deli m iter, string1, the de lim iter, string2, and the deli m iter. In the very rare sit ua ti on where no valid deli m iter is available, a null string is returned.

delimit('Hello') Þ '/Hello/' delimit('///') Þ '!///!' delimit('a/b','c/d') Þ '!a/b!c/d!'

Several KEDIT com mands, like LOCATE and DIALOG , require as an operand a string delim ited by specia l charac ter s that do not appear in the string. Com mands like the CHANGE com mand involve two strings and a delim iter that appears in nei ther string.

Functions 361 In a macro where the strings involved are vari able and no ‘‘safe’’ delim iter can be deter - mined in advance, you can use the DELIMIT() functi on to supply one.

* Build CHANGE command from two strings say "En ter a string" parse pull s1 say "En ter an other" parse pull s2 'CHANGE' de limit(s1,s2) 'ALL *'

DELSTR(string,n[,length]) Returns the value of string af ter de let ing the char ac ters start ing at po si tion n for a length of length. If length is not speci fied, the rem ain ing char acters of string are deleted.

delstr('I think, therefore, I am', 8) Þ 'I think’ delstr('I think, therefore, I am', 8, 12) Þ 'I think I am’

DELWORD(string,n[,length]) Returns the value of string after delet ing the words starting at word n for length words. If length is not spec ifie d, the rem aining words are delet ed. Trailing blanks after the last word delet ed are also delet ed. Any string of consec uti ve nonblank charac ter s is consid - ered to be a word.

delword('I think, therefore, I am', 3) Þ 'I think, ’ delword('I think, therefore, I am', 3, 1) Þ 'I think, I am’

DIGITS() Returns the current NUMER IC DIGITS set ting.

digits() Þ 9 /* de fault value */

DOSDIR([fileid][,[output][,search]]) Re turns di rec tory in for ma tion for fileid.

· The first argu ment is the fileid involved. If fileid include s a drive and/or path spec i- fica ti on, DOSDIR() looks in the speci fie d drive and direc tory ; other wise DOSDIR() looks in the current di rectory of the current drive. If fileid contai ns wildcards in the name or exten sion, infor m ati on about the first matching file is re- turned and you can make subse quent calls to DOSDIR() in which fileid is omitted to proces s additional matching files.

· If fileid is not found, a null string is returne d. Other wise the second ar gum ent, out- put, spec ifie s the type of infor m ati on to be returne d and the order in which to re - turn it. You can specify one or more of the fol lowing: 'N' to re turn the file's name and exten sion, 'S' to re turn its size, 'D' for its date, 'T' for its time, and 'A' for the

362 Chapter 6. Macro Reference file's at trib utes; by de fault out put is 'NSDTA' and all of this information is returned.

Infor m ati on is re turned in the fol lowing form at: the name and exten sion of the file in the form name.ext, the size of the file in bytes, the file’s date in the form mm/dd/yyyy, the file’s time in the form hh:mm:ss, and the files at trib ute char acters (one or more of ‘‘R’’ for a Read-only file, ‘‘H’’ for a Hidden file, ‘‘S’’ for a Sys tem file, ‘‘D’’ for a Di rectory , and ‘‘A’’ if the Archive bit is set; or a minus sign if none of these at trib utes applies).

The maxi m um value returne d for the size of a file is 999999999, regard les s of the ac tual size of the file in volved.

· The third ar gum ent, search, con trols whether DOSDIR() pro cesses cer tain spe cial

files. If search is omitted or is null, DOSDIR() omits di rec to ries, sys tem files, and e hidden files from its search and looks only for ‘‘norm al’’ files. You can specify c n

search as one or more of ‘‘D’’ (for direc to ries ), ‘‘S’’ (for system files), or ‘‘H’’ (for e r e

hidden files) to include these types of files in the search. This ar gum ent is ignored f when the fileid ar gum ent is omit ted and DOSDIR is searching for the next match e R for a pre vi ously-spec i fied fileid pattern. o r c

dosdir('test.c') Þ 'TEST.C 5907 07/14/94 15:47:54 A’ a dosdir('test.c','nd') Þ 'TEST.C 07/14/94’ M

* to tal the sizes of all .TXT files in current dir to tal = 0 size = dosdir('*.txt','s') do while size \= ’’ to tal = to tal + size size = dosdir(,'s') end say to tal

DOSENV(envvar) Returns the value of the speci fie d sys tem envi ron m ent variable envvar, or a null string if envvar is not present in the envi ron m ent. A typi cal usage:

dosenv('path') Þ 'C:\DOS;D:\UTIL;C:\KEDIT'

D2C(whole-number) Re turns the char ac ter string that cor re sponds to the in ter nal bi nary rep re sen ta tion of whole-num ber. Most of ten, whole-num ber is in the range 0 to 255 and this amounts to re turn ing the char ac ter that has whole-num ber as its character code.

d2c(97) Þ 'a' d2c(255) Þ 'ff'x d2c(1234) Þ '04D2'x

Functions 363 D2X(whole-number) Con verts whole-num ber to hexa dec i m al and returns the result .

d2x(0) Þ 0 d2x(80) Þ 50 d2x(255) Þ 'FF' d2x(1234) Þ '4D2'

ERRORTEXT(n) Returns the text of KEXX error message n. If n is not the num ber of a KEXX error mes- sage, ERRORTEXT() re turns the null string. KEXX error messages are currentl y in the range 93—134.

errortext(100) Þ 'Con trol stack full' errortext(500) Þ ’’

FORMAT(number[,[before][,[after]]]) Forma ts num ber to have a speci fie d num ber of digit s be fore and af ter the deci m al point and returns the result . The num ber is first rounded accord ing to the current NUMER IC DIGITS setting.

If before is omitted, num ber is for matted with as many dig its as nec es sary before the dec i mal point. If before is smaller than nec es sary, an error results; if before is larger than neces sary , the result is padded on the left with blanks.

If after is omitted, num ber is for matted with as many dig its as nec es sary after the deci - mal point. If after is smaller than nec es sary, num ber is rounded to the num ber of dec i- mal places that you specify; if after is larger than nec essary , the result is padded on the right with zeros. If after is zero, the result will be rounded to an integer and there will be no decimal point.

format(123.456) Þ '123.456' format(123.456,5,0) Þ ' 123' format(-123.456,5,2) Þ ' -123.46' format(-123.456,,4) Þ '-123.4560'

FUZZ() Re turns the cur rent NU MERIC FUZZ set ting.

fuzz() Þ 0 /* de fault value */

INSERT(new,target[,[n][,[length][,pad]]]) Re turns the re sult of in sert ing string new into string tar get af ter po si tion n. The default for n is 0 (that is, the begin ning of the string tar get). If nec essary , prior to the inser ti on,

364 Chapter 6. Macro Reference new will be truncat ed to a length of length or will be padded to that length with the pad char acter , which de faults to a blank.

in sert('ti tle', '************',6) Þ '******ti tle******'

LASTPOS(string1,string2[,end]) Returns the start ing posi ti on of the last occur rence of string1 in string2. LASTPOS() only con sid ers oc cur rences of string1 that end at or before the end po si tion of string2, where end defaul ts to the length of string2. Re turns 0 if there are no such occurrences.

lastpos('I', 'I think, therefore, I am') Þ 21 lastpos('I', 'I think, therefore, I am',10) Þ 1 e c n

LEFT(string,length[,pad]) e r

Re turns the leftmost length char ac ters of string. If string has less than length char ac- e f

ters, the result will be padded on the right with the pad char acter , which de faults to a e R blank. o r c left('123',2) Þ '12' a M left('123',5,'0') Þ '12300'

LENGTH(string) Returns the length of string.

length('314159') Þ 6 length('a . b') Þ 5 length('') Þ 0

LINEIN(fileid[,[line][,count]]) Returns the content s of a line of data read in from a file.

Input lines in the file are assumed to be ter minated by a line feed or by a car riage return-linefeed pair; this end-of-line sequence is not part of the value returned by LINEIN. After com pleti on of the read opera ti on, the read positi on for the file is moved to just beyond the end-of-line sequence. LINEIN returns the null string if no data can be read because the file does not exist, the read positi on for the file is at the end of the file or at an end-of-file char acter (char acter code 26), or because an I/O error is encountered.

Line and count are usu ally omitted. By default, LINEIN starts read ing at the file’s cur - rent read positi on, but you can specify line as 1 to indi cate that LINEIN should begin reading at the start of the file; no other values are perm it ted for line. Count spec i fies the num ber of lines to be read in; it can be either 1, in which case 1 line is read in, or 0, in which case no data is read but the read positi on is reset to the start of the file if line is 1.

Functions 365 If fileid is not already open, it is first opened and the read positi on is set to the beginning of the file.

See page 374 for some general notes on KEXX’s I/O functi ons.

linein('twoline.fil') Þ 'First line of 2 line file’ linein('twoline.fil') Þ 'Sec ond line of 2 line file’ linein(’twoline.fil’) Þ ’’

LINEOUT(fileid[,[string]]) Writes a line of data to a file. Returns 0 if succes sful and returns 1 if an I/O error or disk full con di tion oc curs.

LINEOUT starts writ ing at the cur rent write posi tion for the file. If fileid is not already open, it is first opened and the write posi tion is ini tially set to the end of the file, so that the file will be appended to. After the write oper a tion completes , the write posi tion for the file is moved just beyond the last char ac ter written.

If string is omitted, the file is closed.

See page 374 for some general notes on KEXX’s I/O functi ons.

lineout('name.ext','Line of data') Þ 0 /* if no er ror */

LINES(fileid) Returns 1 if there are any rem aining lines to be read in fileid and 0 if there are no re- maining lines. That is, LINES re turns 0 if fileid does not exist , or if the read posi ti on for fileid is po sitioned at the end of the file or at an end-of-file char acter (char acter code 26).

lines('name.ext') Þ 0 /* if at eof, 1 if not */

LONGNAME(fileid) Takes the fileid of an exist ing file and returns the long filenam e equiva lent . That is, all com po nents of fileid that are 8.3 MS-DOS short for mat aliases are con verted to their long filenam e equiva lent s, and all com ponents of fileid are con verted to the cor rect case. If fileid does not exist , the null string is returned.

LONGNAME('C:\PROGRA~1\KEDITW\README.TXT') Þ 'C:\Pro gram Files\KEDITW\ReadMe.txt' /* perhaps */

366 Chapter 6. Macro Reference LOWER(string) Returns the value of string with any up per case letters trans lated to low er case. The char - acters ‘‘A—Z’’ are af fected; ac cented char acters with codes above 127 are not affected.

lower('ABCDEF') Þ 'abcdef' lower('1F3De5') Þ '1f3de5'

MAX(n1[,n2 ... n10]) Returns the maxi m um num ber in the given list of up to ten num bers.

max(-1,3.2,4,5,0,-200,100) Þ 100 max(-1,-2,-4,-8.53,-16,-32.6,-64,-128) Þ -1 e c n e r e

MIN(n1[,n2 ... n10]) f e

Returns the mini m um num ber in the given list of up to ten num bers. R

o r c

min(-1,3.2,4,5,0,-200,100) Þ -200 a

min(-1,-2,-4,-8.53,-16,-32.6,-64,-128) Þ -128 M

OEMTOANSI(string) Returns the result of convert ing string, which is as sumed to be in the OEM char acter set, to the ANSI char acter set.

OVERLAY(new, target[,[n][,[length][,pad]]]) Returns the result of overlay ing the string tar get with the string new start ing at po si tion n, which defaul ts to 1. If nec essary , prior to the oper a ti on, new is padded to a length of length with the pad char acter , which de faults to a blank.

over lay('dark', 'edge of night') Þ 'dark of night’ over lay('dark', 'edge of night',9,5) Þ 'edge of dark ’

POS(string1,string2,[start]) Returns the posi ti on of the first occur rence of string1 in string2. The search starts at po - si tion start, which defaul ts to the be ginning of string2.

pos('heat','in the heat of the night') Þ 8 pos('heat','in the heat of the night',10) Þ 0 pos('sleet','in the heat of the night') Þ 0 pos('heat of','in the heat of the night') Þ 8

Functions 367 RANDOM(max) RANDOM([min][,[max][,seed]]) Returns a pseudo-random num ber.

If only a single ar gum ent is given it spec ifie s the maxi m um possi ble result , and the re- sult will be in the range 0 through that num ber. Other wise you can specify min and max (which defaul t to 0 and 999), and the result will be in the range min through max.

If seed is spec ified, it will be used as the seed for a re peat able se quence of ran dom num- bers; other wise an ini tial seed based on inter nal system counter s is gener ate d the first time that RAN DOM() is called af ter the start of each comm and-level macro.

All ar gum ents must be non-nega ti ve whole num bers, max minus min can not ex ceed 100,000, and the result will al ways be a non-nega ti ve whole number.

random() Þ 942 /* range 0..999 */ random(16384) Þ 8453 /* range 0..16384 */ random(400,500,123) Þ 467 /* re peat able, 400..500 */

REVERSE(string) Returns the re sult of revers ing the char acters in string.

re verse('123456789') Þ '987654321'

RIGHT(string,length[,pad]) Returns the rightmost length char ac ters of string. If string has less than length char ac - ters, the re sult will be pad ded on the left with the pad char acter , which de faults to a blank.

right('123',2) Þ '23' right('123',4,'0') Þ '0123' right('123',10,'.') Þ '...... 123'

SHORTNAME(fileid) Takes the fileid of an exist ing file and returns the short, MS-DOS style, form of fileid. That is, all com ponents of fileid are uppercased and are convert ed to their corre spond - ing 8.3 MS-DOS short form at . If fileid does not exist , or Windows is unable to proces s the conver sion, the null string is re turned.

SHORTNAME('C:\Program Files\KEDITW\ReadMe.txt') Þ 'C:\PROGRA~1\KEDITW\README.TXT' /* perhaps */

368 Chapter 6. Macro Reference SIGN(number) Returns -1, 0, or 1 indi cat ing re spec tively that num ber (after rounding ac cording to the current NUMER IC DIGITS set ting) is nega tive , zero, or positive.

sign(-3451) Þ -1 sign(3451.22E14) Þ 1 sign(0) Þ 0

SOURCELINE([n]) SOURCELINE(), with no ar gum ents, returns the num ber of lines in the current ly-exe - cuting KEXX macro.

SOURCELINE(n), where n can be no greater than the num ber of lines in the current e c

macro, returns the text of the nth line of the macro. n e r e f e R

SPACE(string[,[n][,pad]]) o

Replac es any strings of one or more inter-word blanks in string with n copies of the pad r c

char acter and returns the re sult. The default value of n is 1 and the de fault value of pad a

is a blank. Leading and trailing blanks in string are removed. M

space(' edge of night ') Þ 'edge of night’ space(' edge of night ',0) Þ 'edgeofnight' space(' edge of night ',2,'-') Þ 'edge—of—night'

STRIP(string[,[option][,char]]) De pend ing on whether op tion is ‘‘L’’ (‘‘Leading‘ ‘), ’’T‘‘ (‘‘Trail ing’’), or ‘‘B’’ (‘‘Both’’, the defaul t), all leading, trailing, or both leading and trailing occur rence s of char are de leted and the re sult is re turned. The default for char is a blank.

(' ti tle ') Þ 'title' strip(' ti tle ','L') Þ 'ti tle ' strip(' ti tle ','T') Þ ' ti tle' strip('—-title—-',,'-') Þ 'title'

SUBSTR(string,start[,[length][,pad]]) Returns the substring of string begin ning at the start posi ti on for a length of length char acters. If nec es sary, the value is pad ded with the pad char acter , which de faults to a blank. The de fault for length is the rem aining length of string begin ning at the start position.

substr('in the heat of',4) Þ 'the heat of’ substr('intheheatof',3,7) Þ 'theheat'

Functions 369 substr('intheheatof',15,2) Þ ' ' substr('intheheatof',15,2,'-') Þ '—'

SUBWORD(string,n[,length]) Returns the substring of string start ing at the nth blank-deli m ited word for a length of length blank-deli m ited words. The defaul t for length is the rem aining num ber of words in string. For example

subword('red blue green', 1, 2) Þ 'red blue’ subword('red blue green', 3) Þ 'green' subword(’red blue green’, 4, 3) Þ ’’ subword(' red blue green', 1, 2) Þ 'red blue'

SYMBOL(name) Returns ‘‘BAD’’ if name is not a valid KEXX sym bol, re turns ‘‘VAR’’ if name is a vari - able to which a value has been assigne d, and other wise returns ‘‘LIT’’.

After

x = 17 a. = 'Hello' drop a.17 drop y the SYMBOL() functi on would yield:

symbol('==') Þ 'BAD' symbol('y') Þ 'LIT' /* y has no assigned value */ symbol('a.x') Þ 'LIT' /* a.17 has no assigned value */ symbol('x') Þ 'VAR' /* x has an assigned value */ symbol(x) Þ 'LIT' /* 17 is a literal */

TIME([option]) Returns a form of the current time depend ing on op tion. The value of op tion, which de- faults to ‘‘N’’, may be one of the fol lowing:

C (‘‘Civil’’) Re turns the time in the for mat hh:ssam or hh:sspm, where the hour does not have a leading zero;

H (‘‘Hours’’) Re turns the num ber of hours since midnight , from 0 to 23;

L (‘‘Long’’) Re turns the time in the form at hh:mm:ss.uuuuuu, where uuuuuu is in micro sec onds, but is accu rat e only to the res olu ti on of the sys tem clock;

M (‘‘Minutes ’’) Re turns the num ber of minutes since midnight , from 0 to 1439;

N (‘‘Nor mal’’) Returns the time in the form at hh:mm:ss;

370 Chapter 6. Macro Reference S (‘‘Sec onds’’) Re turns the num ber of seconds since midnight , from 0 to 86399.

At one o’clock in the afternoon, the TIME() functi on would return these values:

time() Þ 13:00:00 time('c') Þ 1:00pm time('h') Þ 13 time('l') Þ 13:00:00.000000 time('m') Þ 780 time('n') Þ 13:00:00 time('s') Þ 46800

The TIME() functi on provides two other options, used to control an elapsed timer facil ity: e

E (‘‘Elapsed’’) If the elapsed timer has not been started in the cur rent macro, starts c n

the timer and re turns 0. Oth er wise, re turns the elapsed time since the timer was e r

started in the for mat ssss.uuuuuu (sec onds, with no leading ze ros, and micro sec - e f

onds, ac curat e to the res olu ti on of the system clock). e R

o

R (‘‘Re set’’) If the elapsed timer has not been started in the cur rent macro, starts the r c

timer and re turns 0. Oth er wise, re turns the elapsed time since the timer was started a

and resets the timer to 0. M

When ever execu tion of a macro begins, a new elapsed timer, local to that macro, is avail able. The value of the elapsed timer is pre served and restored across calls to inter - nal routi nes.

* Time an op er a tion with the elapsed timer call time 'r' do i = 1 to 10 'get datafile.'i end say 'The elapsed time was' time('e') 'seconds'

TRACE([setting]) TRACE() with no argu ments re turns the trace set ting cur rently in effect. That is, it re - turns 'A', 'C', 'E', 'F', 'I', 'L', 'N', 'O', or 'R', pos si bly pre ceded by '?'.

If spec i fied, set ting is a new trace set ting to put into effect, and can be '?', or one of 'A', 'C', 'E', 'F', 'I', 'L', 'N', 'O', or 'R', option ally pre ceded by '?'.

TRANSLATE(string[,[tableo][,[tablei][,pad]]]) In for mally, TRANS LATE() takes two lists of char ac ters, an in put list and an out put list, searches a string for occur rences of char acters in the in put list and trans lates these oc - currence s to the corre spond ing charac ter in the output list.

TRANSLA TE() returns the value of string with the char acters in tablei trans lated to the cor re spond ing char ac ters in tableo. If tableo is shorter than tablei, it is pad ded with

Functions 371 pad, which has a default value of blank. If tableo is longer than tablei, it is trun cated to the length of tablei. The default value of tablei is the 256-charac ter string beginning with '00'x and ending with 'FF'x. The default value of tableo is the null string. If tablei and tableo are omitted, string is translat ed to uppercas e, as if you had used the UPPER() function.

translate('abcdwxyz') Þ 'ABCDWXYZ' trans late('abxyze', '12345', 'abcde') Þ '12xyz5' trans late('56/12/34', 'mmddyy', '123456') Þ 'yy/mm/dd'

TRUNC(number[,n]) Trun cates num ber to an inte ger fol lowed by n digit s after the deci m al point and returns the re sult; n must be a non-nega ti ve num ber and de faults to 0. Be fore the trunca ti on op - er a tion takes place, num ber is first rounded accord ing to the current NUMERIC DIGITS setting.

trunc(12345.6789) Þ 12345 trunc(12345.6789,2) Þ 12345.67 trunc(12345,3) Þ 12345.000

UPPER(string) Returns the value of string with any low er case letters trans lated to up per case. The char - acters ‘‘a—z’’ are af fected; ac cented char acters with codes above 127 are not affected.

upper('abcdwxyz') Þ 'ABCDWXYZ' upper('90a1ff') Þ '90A1FF'

VALUE(name [,newvalue]) Returns the value of the sym bol speci fie d by name, and opti onall y as signs to the sym - bol the value speci fie d by newvalue.

After

a = 's' a9 = 17 s = '9'

the VALUE() func tion would yield:

value('a') Þ 's' value(a) Þ 9 value('a'||s) Þ 17 value('a', 'Tom') Þ 's' /* and sets a = 'Tom' */

372 Chapter 6. Macro Reference VERIFY(string,reference[,[option][,start]])

If op tion is ‘‘N’’ (‘‘Nomatch’’) or is omitted, re turns the po si tion of the first char ac ter in string that does not match any charac ter in the string ref er ence, or returns 0 if there is no such char ac ter. If op tion is ‘‘M’’ (‘‘Match’’), re turns the po si tion of the first char ac ter in string that does match some char acter in the string ref er ence, or 0 if there is no such char ac ter. Char ac ters in string before the start posi ti on, which defaul ts to 1, are not considered.

verify('$1,000.00', '0123456789$,.') Þ 0 verify('1000 Dollars', '0123456789$,.') Þ 5 ver ify('1000.00', '$,.', 'm') Þ 5 ver ify('1000.00', '$,.', 'm' ,6) Þ 0 e c n e

WORD(string,n) r e Re turns the nth blank-deli m ited word in string, or the null string if string contai ns less f e R

than n words. o r c

word('red blue green yel low', 1) Þ 'red' a

word('red blue green yel low', 4) Þ 'yellow' M word(' red blue green yellow', 1) Þ 'red' word(’red blue green yel low’, 10) Þ ’’

WORDINDEX(string,n) Returns the charac ter posi ti on of the begin ning of the nth blank-deli m ited word in string, or returns 0 if string contai ns less than n words.

wordindex('red blue green yellow', 1) Þ 1 wordindex('red blue green yellow', 4) Þ 16 wordindex(' red blue green yellow ', 1) Þ 4 wordindex('red blue green yellow', 10) Þ 0

WORDLENGTH(string,n) Returns the length of the nth blank-deli m ited word in string, or returns 0 if string con- tains less than n words.

wordlength('red blue green yellow',1) Þ 3 wordlength('red blue green yellow',3) Þ 5 wordlength('red blue green yellow',5) Þ 0

WORDPOS(phrase,string[,start]) If phrase is found in string, returns the word num ber in string of the first word of phrase. Oth er wise, re turns 0. Start, which defaul ts to 1, spec ifie s the word within string

Functions 373 at which the search is to start. The blank-deli m ited words in phrase and string are com- pared, and the num ber of blanks sepa rat ing the words does not af fect the comparisons.

wordpos('red', 'blue green red yellow') Þ 3 wordpos('green red', 'blue green red yellow') Þ 2 wordpos('green red', 'blue green red yellow') Þ 2 wordpos('green red', 'blue green red yellow',3) Þ 0 wordpos('black', 'blue green red yellow') Þ 0

WORDS(string) Returns the num ber of blank-deli m ited words in string.

words('in the heat of the night') Þ 6 words(' in the heat of the night ') Þ 6 words('intheheatofthenight') Þ 1

XRANGE([start][,end]) Returns a string consis ting of the start charac ter (which defaul ts to '00'x) and, in order , the charac ter s whose codes follow it, through the end char acter (which de faults to 'FF'x). If start is greater than end, the sequence will wrap at 'FF'x, which will be fol- lowed by '00'x.

xrange(1,9) Þ '123456789' xrange('w','z') Þ 'wxyz' xrange() Þ '00 01 02 ... fd fe ff'x length(xrange()) Þ 256 xrange('fe'x,'01'x) Þ 'fe ff 00 01’x

X2B(hex-string) Convert s a string in hexa dec i m al nota ti on to bi nary nota ti on and returns the result . Blanks may be include d in hex-string, at byte boundaries.

x2b('0d') Þ '00001101' x2b('E2') Þ '11100010' x2b(d2x(4095)) Þ '111111111111'

X2C(hex-string) Takes a string con tain ing a set of char acter codes ex pressed in hex adec im al no tation and returns a string consis ting of the corre spond ing charac ter s. Blanks may be include d in hex-string, at byte boundaries.

374 Chapter 6. Macro Reference x2c('7a') Þ 'z' x2c(‘‘) Þ ’’ x2c('ff') Þ 'ff'x x2c('61 62 63') Þ 'abc'

X2D(hex-string) Con verts a string in hex a dec i mal no ta tion to dec i mal no ta tion and re turns the re sult. Blanks may be include d in hex-string, at byte boundari es. An error occurs if the result cannot be express ed as a whole num ber ac cording to the current NUMER IC DIGITS setting.

x2d('7a') Þ 122

x2d(0) Þ 0 e c

x2d('abcd') Þ 43981 n e

x2d('ab cd') Þ 43981 r e f e R

o r

6.8.2 Notes on I/O Functions c a

It is someti mes use ful for a macro to directly read and write files on disk, as opposed to M files that are in mem ory and being edited by KEDIT. KEXX includes I/O functi ons that you can use for this purpose. You can access disk files on a line-ori ented basis by using the LINEIN(), LINES(), and LINEOUT() func tions, or access files on a charac ter -ori- ented basis by using the CHARIN(), CHARS() and CHAROUT() functions .

Line-oriented The line-oriente d functi ons assume that the files you are working with are organize d functions into lines, with each line ended by a line feed or by a car riage return-line feed pair. Fur - ther more, the KEXX version of these functi ons works properl y only with lines whose length is less than or equal to KEDIT’s WIDTH value (which by default is 1024). For com pat i bil ity with other REXX imple men ta tions, these func tions treat char ac ter code 26 as a special char acter indi cating the end-of-file.

LINEIN(fileid) reads a line from the speci fie d file and returns the content s of the line (with the end-of-line indi cators removed) as its value. Data is read starting from the current read positi on for the file, which starts out at the beginning of the file and is updated after each input opera ti on.

LINES(fileid) returns 1 if there are more lines of data in the speci fie d file and 0 if there are not. That is, 0 is returned if the file does not exist, the read pointer is positi oned at the end of the file, or the read pointer is posi tioned at an end-of-file char acter (char acter code 26).

LINEOUT(fileid,string) writes string (plus a carria ge return-linefeed end-of-line sequence) to fileid. Output from LINEOUT() is nor mally appended to the end of the spec ified file; if you want to replace the exist ing con tents of a file with new data, your macro should first use KEDIT’s ERASE com mand to delete the existing file.

Functions 375 Character-oriented The char acter -oriented func tions treat the file as a con tin u ous stream of char acters and functions do no specia l proces sing of carria ge returns, linefeeds, or end-of-file (charac ter code 26) characters.

CHARIN(fileid[,[start][,length]]) reads data of a spec ified length (by default, 1 char ac - ter) from fileid. If start is spec ified , data is read start ing at that byte offset into the file; other wise , data is read starting from the current read positi on in the file.

CHARS(fileid) returns the num ber of bytes of data remaining to be read in the speci fie d file, start ing from the current read positi on in the file, or 0 if you are positi oned at the end of the file.

CHAROUT(fileid[,[string][,start]]) writes string to fileid. If start is spec ified, data is outpu t start ing at that byte offset into the file; oth er wise data is writ ten start ing at the cur rent write posi tion in the file.

Read and write Each file has a read positi on and a write positi on. The read posi tion starts out at 1 (the positions beginning of the file) and is updated after each read opera ti on to point just beyond the last charac ter read. There is a single read positi on, updated by both CHARIN() and LINEIN(). You can use the start argum ent of CHARIN() to reposi ti on the read pointer any where in the file.

The write posi tion starts out at the end of the file, so that by default write oper a tions will append to an existing file. If you instead want to replace the existing content s of a file with new data, your macro should first use KEDIT’s ERASE com mand to delete the existing file. You can use the start argum ent of CHAROUT() to reposi ti on the write pointer any where in the file, but reposi ti oning the write pointer earli er in the file does not delete the exist ing content s of the file. There is a single write posi tion, updated by both CHAROUT() and LINEOUT().

Opening and You do not need to explicit ly open a file to begin using it; whenever you use an I/O closing files func tion to refer to a file that is not cur rently open, the file will be auto mati cally opened. Up to 10 files at a time can be open for use by the KEXX I/O functi ons.

Files are auto mati cally closed when the macro in which they were opened ter minates. You can explic itly close a file by call ing the LINEOUT() or CHAROUT() func tions and spec i fy ing the fileid argum ent but no other argum ents. It is good prac tice for a macro to close a file explic itly when the macro has fin ished with it. In par tic u lar, you should be sure that any file that has been used with a KEXX I/O func tion within a macro is closed before you issue, from that same macro, any com mand (such as the KEDIT, GET, PUT, SAVE, or FILE com mand) that accesses the same file.

File size limits The KEXX I/O func tions cannot properl y handle files larger than 2**32-1 (that is, 4294967295) bytes in size. Further , the CHARS() functi on will never return a value for the remaining bytes in a file larger than 999999999, and the largest allowable value for the start argu ment of the CHARIN() and CHAROUT() function, and for the length argum ent of the CHARIN() func tion, is 999999999.

376 Chapter 6. Macro Reference Examples Here are two sample macros that illustrate how the I/O func tions are typ ically used.

The first sam ple macro reads a disk file and inserts every non-blank line of that disk file into the cur rent file:

fileid = 'test.fil' do while lines(fileid) \= 0 line = linein(fileid) if line \= ’’ then ’input’ line end call lineout fileid /* close the file */

The sec ond sample macro cre ates a disk file con tain ing each of the words in the cur rent file, with one word writ ten to each line of the disk file:

fileid = 'words.fil' 'nomsg erase' fileid /* erase file if it exists */ e c

'top' n e

'down 1' r

do while rc = 0 e f

line = curline.3() e R

do j = 1 to words(line)

call lineout fileid,word(line,j) o r

end c

'down 1' a

end M call lineout fileid /* close the file */

6.8.3 Boolean Functions

Boolean func tions are functi ons that test a condi ti on within KEDIT and return 1 if the condi ti on is true and 0 if it is false. An exam ple:

if af ter() then 'sos firstch'

Here, if the cur sor is located after the last nonblank char acter of the cur sor line, the cur - sor is moved to the first nonblank charac ter of that line.

The results from several Boolean func tions depend on the content s of the current field. If the cursor is located on the top-of-file or end-of-file line, or on a shadow line, KEDIT will act as if the cur rent field were empty.

Here are the avail able Boolean functions:

AFTER() Returns 1 if the cursor is positi oned after the last nonblank charac ter of the cursor field or if the cursor field is empty.

ALT() Returns 1 if the cur rent file has been altered since the last SAVE (that is, returns 1 if the sec ond num ber display ed by QUERY ALT is nonzero).

Functions 377 ALTKEY() Returns 1 if, at the time of the last keystroke or mouse action proces sed by KEDIT, either Alt key was down.

BEFORE() Returns 1 if the cursor is positi oned before the first nonblank charac ter of the cursor field or if the cur sor field is empty.

BLANK() Returns 1 if the cursor field is com pletely blank.

BLOCK() Returns 1 if a block is marked in the current file.

BOTTOMEDGE() Returns 1 if the cursor is in the bottom most line of the file area.

BUTTON1() Returns 1 if mouse but ton 1 is down. Should only be used while proces sing a mouse click (that is, while the BUTTON1DOWN, BUTTON2DOWN, BUTTON1DBLCLK, or BUTTON2DBLCLK macros are active).

BUTTON2() Returns 1 if mouse but ton 2 is down. Should only be used while proces sing a mouse click (that is, while the BUTTON1DOWN, BUTTON2DOWN, BUTTON1DBLCLK, or BUTTON2DBLCLK macros are active).

CLASSIC() Returns 1 if INTER FACE CLAS SIC is in effect.

CLIPTEXT() Returns 1 if any text is current ly stored in the Windows clipboard for possi ble use in a Paste oper a tion.

CMDSEL() Returns 1 if any text on the com mand line is current ly selected.

COMMAND() Returns 1 if the cursor is on the com mand line.

CTRL() Returns 1 if, at the time of the last keystroke or mouse action proces sed by KEDIT, either Ctrl key was down.

CUA() Returns 1 if INTER FACE CUA is in effect.

CURRENT() Returns 1 if the cursor is on the current line.

378 Chapter 6. Macro Reference DELSEL() If INTERF ACE CUA is in effect, returns 1 when a selec tion or comm and line selec tion is marked, and when a persis tent block is marked and no cursor movem ent has taken place since it was marked. Always returns 0 when INTERF ACE CLAS SIC is in effect. The default Delete and Back space def ini tions use DELSEL() to deter mine whether they should use SOS DELSEL to delete the current block or com mand line selec tion, or should instead delete only a single charac ter . DELSEL() returns 1 under the same con- diti ons that the block indi cati on on the status line is followed by an asterisk.

DIR() Returns 1 if the cur rent file is the DIR.DIR file cre ated via the KEDIT DIR command, or if .DIR is the extension of the current file.

END() Returns 1 if the cursor is on the last nonblank charac ter of the cursor field. e c n

EOF() Returns 1 if the cursor is on the end-of-file line. e r e f e R

FILELINE() Returns 1 if the cursor is not on the com mand line. o r c a

FIRST() Returns 1 if the cursor is positi oned in colum n 1 of the cursor field. M

FOCUSEOF() Returns 1 if the focus line is the end-of-file line.

FOCUSTOF() Returns 1 if the focus line is the top-of-file line.

FULLINP() Returns 1 if KEDIT is in Input Mode with INPUTMODE FULL in effect.

INBLOCK() Returns 1 if the cursor is in a marked block.

INITIAL() Returns 1 if the func tion is called while the pro file for the first file in the ring is exe cut ing.

INPREFIX() Returns 1 if the cursor is in the prefix area.

INSERTMODE() Returns 1 if KEDIT is in In sert Mode.

INTRUNC() Returns 1 if the cursor is not to the right of the trunca ti on colum n.

LEFTEDGE() Returns 1 if the cursor is in the leftmost colum n of the file area.

Functions 379 LINEINP() Returns 1 if KEDIT is in Input Mode with INPUTMODE LINE in effect.

MODIFIABLE() Returns 1 if the cursor is located in an area of the file that can be modi fie d (that is, not on top-of-file, end-of-file, a shadow line, or to the right of the trunca ti on colum n.)

MOUSEPOSMODIFIABLE() Returns 1 if, at the time of the last mouse but ton click or double- click, the mouse pointer was in the file area (that is, not in the prefix area or on the com mand line) and was in a posi ti on where it would be le gal to type a charac ter .

MOUSEPOSVALID() Returns 1 if, at the time of the last mouse but ton click or double- click, the mouse pointer was in a posi ti on where it would be le gal to place the cursor .

MULTWINDOW() Returns 1 if more than one doc um ent window current ly exist s.

NOQUEUE() Returns 1 if no keystroke s are queued up within Windows waiting to be proces sed.

OEMFONT() Returns 1 if the font current ly being used in KEDIT’s docu m ent windows is an OEM font.

PENDING() Returns 1 if there are any pending pre fix com mands.

PREFIX() Returns 1 if PREFIX ON or PREFIX NULLS is in effect.

PREFIXLEFT() Returns 1 if the prefix area is dis played on the left of the window .

PROFILE() Returns 1 if the functi on is called while the profil e for a file being added to the ring is exe cut ing.

REPEATING() Returns 1 if KEDIT is proces sing an auto-repeat keystroke . REPEATING() is 0 for the ini tial keystroke sent by Windows when you first press a key, but is 1 for each of the additi onal keystroke s repeatedly sent by Windows for as long as you hold the key down.

RIGHTEDGE() Returns 1 if the cursor is in the rightmost colum n of the file area.

SCROLLLOCK() Re turns 1 if ScrollLock is in ef fect.

380 Chapter 6. Macro Reference SHADOW() Returns 1 if the cursor is located on a shadow line.

SHIFT() Returns 1 if, at the time of the last keystroke or mouse action proces sed by KEDIT, either Shift key was down.

SHOWPRINTDLG() Returns 1 if the Print File toolbar but ton should show the File Print di alog box, and should not print im medi ate ly. That is, SHOWPRINTDLG() returns 1 when the ’’Print File Toolbar But ton Shows This Dia log’ ’ box in the File Print dia log box is checked.

SPACECHAR() Returns 1 if the charac ter at the cursor posi tion is blank. e c

TAB() Returns 1 if the cursor is located in one of the tab colum ns. n e r e f Returns 1 if the cursor is on the top-of-file line. e

TOF() R

o r c TOPEDGE() Returns 1 if the cursor is in the topm ost line of the file area. a M

UNTITLED() Returns 1 if the current file is an UNTITLED file. That is, UNTITLED() returns 1 if the UNTITLED option was used when edit ing of the current file began, and the file’s ini tial UNTI TLED.n fileid has not been changed.

VERONE() Returns 1 if colum n 1 of the current file is being display ed in colum n 1 of the file area.

6.9 The PARSE Instruction

While PARSE is a keywo rd instruc tion, like DO, RETURN, or SAY, it is more complex than the other key word instructi ons, so it is dis cussed in detail in this sepa rat e secti on.

PARSE takes charac ter strings and assigns porti ons of their values to a set of KEXX vari ables according to a tem plate that you provide. The form at of the PARSE instruc- tion is

PARSE [UPPER] ori gin [tem plate]

UPPER is optional and speci fie s that the strings are to be convert ed to uppercas e before being parsed according to the tem plate.

Ori gin spec ifie s where the PARSE instructi on is to obtain the data to be parsed.

Tem plate is a set of pat tern spec ifi ca ti ons that control the parsing proces s, interm ixed with lists of vari ables to which the parse data is to be assigned.

The PARSE Instruction 381 PARSE origins There are several ways to specify the origin of the string to be parsed:

PARSE [UPPER] ARG [template] When execute d from a KEXX macro while no inter nal routi ne is active, PARSE ARG parses the argum ent string passed to the macro when it was invoked. When exe cuted from an internal routi ne within a KEXX macro, PARSE ARG parses the argum ents to that inter nal rou tine.

PARSE [UPPER] LINEIN [template] KEDIT reads a line of user input from the com mand line and the result ing line of input is parsed.

PARSE [UPPER] PULL [template] KEDIT reads a line of user input from the com mand line and the result ing line of input is parsed. In KEXX, PARSE LINEIN and PARSE PULL are equiv alent . (Both are included in KEXX for com pati bil ity with REXX, where PARSE LINEIN always reads a line of user input but PARSE PULL first tries to read from a REXX facil ity known as the ’’exter nal data queue’’, and reads a line of user input only if this queue is empty. KEXX does not provide an external data queue, so PARSE PULL always acts as if it is empty and always reads a line of user input.)

PARSE [UPPER] SOURCE [template] KEXX parses a string that gives inform ati on about the current ly execut ing macro. This consis ts of the system under which KEDIT is running (for KEDIT for Windows, this is ‘‘Windows’ ’), the method used to invoke the macro (always ‘‘COM MAND’’ in this version of KEDIT), and the name of the macro.

For exam ple, if you issue the com mand

macro test and use PARSE SOURCE within the macro, it would parse the string ‘‘Win dows COMMAND test’’.

PARSE [UPPER] VALUE [expression] WITH [template] KEXX takes the value of expres sion and uses it as the string to be parsed. The keyword WITH is used to sep arate the expres sion from the tem plate. For exam ple,

parse value date() time() with template would parse a string like ‘‘18 Jun 2007 11:37:52’’.

PARSE [UPPER] VAR name [template] KEXX takes the value of the speci fie d vari able as the string to be parsed. For exam ple,

x = "tuna fish" parse var x template would parse the string ‘‘tuna fish’’.

382 Chapter 6. Macro Reference PARSE [UPPER] VERSION [template] KEXX parses a string with inform ati on about the current version and release date of the KEXX language proces sor. This consis ts of the name of the language (‘‘KEXX’’), the KEXX version num ber (for exam ple, ‘‘5.61’’, the version included in the ini tial release of KEDIT for W indows 1.6), and the date of this KEXX version (in the form ‘‘dd Mmm yyyy’’). For exam ple, PARSE VERSION would parse a string like ’’KEXX 5.61 15 Aug 2007’’.

PARSE PARSE templates con sist of spec ifi ca tions that tell KEXX how to break the data being templates parsed into smaller substrings and lists of vari ables to which the data in these substrings is assigned.

The simplest templates con sist only of a list of vari ables, to which all of the data in the string being parsed is assigned. e c

parse value 'Clark Kent is Super man.' with v1 v2 v3 n e r e

In this exam ple, ‘‘Clark Kent is Superm an.’’ is the string being parsed and the tem plate f e

con sists of a list of vari ables, V1, V2, and V3. R

o r c

Variable lists Data is assigned to vari ables in a list in this fash ion: For all variables in the list except a

the last vari able, leading blanks are removed from the data, the next word (that is, the M next set of nonblank charac ter s) is removed from the data and assigned to the next vari - able in the list, and then the first trailing blank (if any) after the word is removed from the data. When the last vari able in the list is reached, all remain ing data (which may include leading and trailing blanks) is assigned to it. If the end of the data is reached before all vari ables in the list have been assigned val ues, the remaining variable s in the list are set to the null string.

This exam ple, in which there is a single blank between each word of the string to be parsed, sets these variables:

parse value 'Clark Kent is Super man.' with v1 v2 v3

sets these variables:

v1 Ü 'Clark' v2 Ü 'Kent' v3 Ü 'is Super man.'

The next exam ple has two blanks between each word of the string to be parsed:

parse value 'Clark Kent is Super man.' with v1 v2 v3

It sets these variables:

v1 Ü 'Clark' v2 Ü 'Kent' v3 Ü ' is Super man.'

The PARSE Instruction 383 A list of variable s can include peri ods that serve as dummy variable s. The value that would norm ally be assigned to the vari able at the period’s posi tion in the list is not assigned to any variable but is sim ply ignored, as ‘‘Kent’’ is in the follow ing example:

parse value 'Clark Kent is Super man.' with v1 . v2

v1 Ü 'Clark' v2 Ü 'is Super man.'

Parse To proces s a tem plate, PARSE moves from left to right through the tem plate, skipping specifications over lists of vari ables but stopping at each parse spec ifi ca ti on. PARSE uses the parse spec ifi ca ti on to pick out a substring of the parse data. Then, if the parse speci fi ca ti on is precede d by a list of variable s, this substring is assigned to the list of vari ables by the proces s described above (that is, one word per vari able except the last variable in the list, which gets the rest of the substring). If the last parse spec ifi ca tion is follow ed by a list of variable s, the remainder of the parse string is assigned to the variable s in the list according to the same process.

Types of parse spec i fi ca tions are:

Absolute Absolut e posi tional patter ns are unsigned integers, optionall y pre ceded by an equal positional sign (‘‘=’’), that specify a spe cific positi on in the parse data. patterns parse value 'Clark Kent is Super man.' with v1 10 v2 15 v3

v1 Ü 'Clark Ken' v2 Ü 't is ' v3 Ü 'Super man.'

Relative Rel ati ve posi tional patter ns are integers pre ceded by a plus sign (‘‘+‘‘) or by a minus positional sign (‘‘-’’). They spec ify a posi tion a cer tain number of char acters after or before the patterns colum n matched by the last parse spec ifi ca ti on (or, when there is no preced ing parse spec ifi ca ti on, from the beginning of the string).

parse value 'Clark Kent is Super man.' with v1 10 v2 +5 v3

v1 Ü 'Clark Ken' v2 Ü 't is ' v3 Ü 'Super man.'

Posi tional patter ns that specify a posi tion beyond the end of the parse data are consid - ered to match the end of the data. Posi tional patter ns that specify a posi tion to the left of the beginning of the parse data are consid ered to match the beginning of the parse data.

parse value 'Clark Kent is Super man.' with 0 v1 10 v2 40 v3

v1 Ü 'Clark Ken' v2 Ü 't is Super man.' v3 Ü ''

384 Chapter 6. Macro Reference When a posi tion at or to the left of the current positi on in the parse string is spec ifie d by a posi tional patter n, it sets the new posi tion in the parse data, and uses all data from the previ ous posi tion through the end of the data to set any pre ceding variable list.

parse value 'Clark Kent is Super man.' with v1 10 v2 -3 v3

v1 Ü 'Clark Ken' v2 Ü 't is Super man.' v3 Ü 'Kent is Super man.'

Literal Char ac ter strings enclosed in quotes are lit eral pat tern spec ifi ca tions. PARSE starts patterns from its current positi on in the PARSE data and matches the first occurrence of the pat- tern string that it finds.

parse value 'Clark Kent is Super man.' with v1 'Kent' v2 e c n e

v1 Ü 'Clark ' r e

v2 Ü ' is Super man.' f e R

When a rel a tive posi tional pat tern follow s a lit eral pat tern, the new posi tion is deter - o r

mined rela tive to the first char ac ter matched by the lit eral pat tern. Also, the substring c formed by the positi onal patter n and the preced ing lit eral patter n includes all charac ter s a from the first charac ter matched by the lit eral patter n up to the col umn spec ifie d by the M rel a tive posi tional pat tern; in all other sit u a tions, the string matched by a lit eral pat tern is not included in this substring.

text = 'Clark Kent is Su perman.' parse var text v1 'Kent' v2 +8 v3

v1 Ü 'Clark ' v2 Ü 'Kent is ' v3 Ü 'Super man.'

Variable Pat tern inform ati on can come from vari ables rather than being directly embedded in patterns the tem plate. Vari able pat terns are indi cated by variable names in paren the ses. If the paren the ses are preceded by an equal sign (‘‘=’’), the value of the vari able must be an integer and its value is used as an absolut e posi tional patter n. If the parenthe ses are pre- ceded by a plus sign (‘‘+’’) or minus sign (‘‘-’’), the value of the vari able must also be an integer and its value is used as a rela ti ve posi tional patter n. Parenthe ses alone, not precede d by an equal sign, minus sign, or plus sign, mean that the value of the vari able is to be used as a literal pattern.

n = 3; s = 'Super' text = 'Clark Kent is Su perman.' parse var text v1 =(n) v2 +(n) v3 (s) v4

v1 Ü 'Cl' v2 Ü 'ark' v3 Ü ' Kent is ' v4 Ü 'man.'

The PARSE Instruction 385 Comma A comma (‘‘,’’) in a tem plate matches the end of the string current ly being parsed and patterns causes proces sing to conti nue at the start of the next parse string. Except when proces s- ing PARSE ARG (and the ARG instruc tion), there is only one string to parse and a comma in a template is not use ful. But with PARSE ARG and with the ARG instruc - tion, when exe cuted from inside an inter nal routi ne that was passed multi ple param e- ters, all of the argum ents to the routi ne can be proces sed with a single tem plate that uses com mas. For exam ple, assume that an inter nal routi ne had been passed the three argu - ments ‘‘Clark Kent’’, ‘‘Lois Lane’’, and ‘‘Jimmy Olsen’’:

parse arg v1, v2, v3 v4

v1 Ü 'Clark Kent' v2 Ü 'Lois Lane' v3 Ü 'Jimmy' v4 Ü 'Olsen'

6.10 Conditions

Condi ti on handli ng, dis cussed in this secti on, is an advanced fea ture of KEXX that most macro writers need not be familiar with.

You can have a KEXX macro auto mati cally trans fer con trol to a differ ent loca tion in your macro when certai n specia l condi ti ons occur. This allows your macro to, for exam ple, display diagnos ti c inform ati on after a syntax error occurs, or ask a user of the macro who has pressed Ctrl+Break whether to ter minate the macro.

The condi ti ons that can be handled are:

· The HALT condi ti on, triggered when Ctrl+Break is pressed.

· The FAILURE condi ti on, triggered when a com mand yields a nega ti ve return code.

· The ERROR condi ti on, triggered when a com mand yields a posi ti ve return code, or when a com mand yields a nega ti ve return code and the FAILURE condi ti on is not enable d. Note that the ERROR condi ti on is not usuall y use ful in KEXX mac- ros, since sev eral KEDIT comm ands (such as a DOWN comm and that reaches the End-of-File line) gener ate posi ti ve return codes in non-error situations.

· The SYN TAX condi ti on, triggered by a syntax error in your macro, or by invali d macro oper a ti ons like divi sion by zero or passing invali d ar gum ents to a built-in function.

· The NOVALUE condi ti on, triggered by the use of an uninitialized vari able in your macro.

By default, user-spec ifie d condi ti on handli ng is disable d and the above condi ti ons are handled as follows: Ctrl+Break and syntax errors cause term ina ti on of your macro. Error and fail ure return codes are ignored. Use of uninitialized variable s is ignored if

386 Chapter 6. Macro Reference SET NOVALUE OFF is in effect, and causes ter mina tion of your macro if SET NOVALUE ON is in effect.

Condi ti on handli ng is most often enabled via this form of the SIGNAL instructi on:

SIGNAL ON condi tion [NAME trapname] When SIGNAL ON has been exe cuted for a condi ti on and that condi ti on occurs, con- trol is transferred, as if SIGNAL label had been exe cuted, to the label spec ified by trapname or, if NAME trapname was omit ted, to a label corre spond ing to the name of the condition.

For exam ple, with

SIG NAL ON HALT e

KEXX will trans fer con trol to the label HALT if Ctrl+Break is pressed while your c

macro is execut ing. n e r e With f e R

SIG NAL ON HALT NAME BREAKER o r c

KEXX will trans fer con trol to the label BREAKER if Ctrl+Break is pressed while your a

macro is execut ing. M

You can use

SIGNAL OFF condi tion to disable user-spec ifie d condi ti on handli ng and restore the default behavior .

With SIGNAL ON, control is transferred to the appropri ate label when a condi ti on is raised, but there is no conve nient way of resum ing exe cuti on of your macro at the point that the con di tion was detected. An alter na tive is to use

CALL ON condi tion [NAME trapname] which calls your condi ti on handler as a subrou ti ne and, if your subrou ti ne returns, resumes execu ti on immedi ate ly follow ing the point where the condi ti on was triggered.

You can use

CALL OFF condi tion to disable this form of user-spec ifie d condi ti on handli ng.

CALL ON con di tion can be used with the HALT, ERROR, and FAILURE condi ti ons, but cannot be used with the SYNT AX and NOVALUE condi ti ons.

Notes · When a condi ti on with SIGNAL ON handli ng in ef fect occurs, and before control is transferred to the condi ti on handler , SIGNAL OFF is put into ef fect for that con- diti on, so that the defaul t behav ior will take place if the condi ti on occurs again and user-spec ifie d condi ti on handli ng has not been re-enabled.

Conditions 387 · When a condi ti on with CALL ON handli ng in ef fect occurs, and before control is transferred to the condi ti on handler , the condi ti on is put into a delay ed state, and will be re-enable d on return from your handler . You can also use SIGNAL or CALL instruc tions within your handler to enable or disable condi ti on handli ng while your handler is active.

· While your handler is acti ve, you can use the CONDI TION() func tion to get infor - mati on about the current trapped condi ti on.

· For the ER ROR and FAIL URE con di tions, the RC variable is set to the command return code involved be fore control is transferred to the condi ti on handler . For the SYNT AX condi ti on, the RC vari able is set to the message num ber for the error in- volved; the text of the message can be retri eved via the ERRORTEXT() function.

· The SIGL vari able is set be fore control is transferred to your condi ti on handler to the line num ber of the last clause ex ecuted.

6.11 KEXX and REXX

KEDIT’s macro language, KEXX, contai ns a large subset of the REXX language. Almost all of the feature s of REXX, as doc um ented in The REXX Language: A Practical Approach to Program ming by Michael Cowlishaw (Second Editi on, Prentice-Hall, 1990) are avail able in KEXX. Here are the prim ary dif fer ences between KEXX and REXX:

· KEXX clauses and com ments must fit com pletely on a sin gle line, and can not be conti nued on addi t ional lines. · Lines of a KEXX macro are lim ited to 1024 char acters. · KEXX com ment lines that begin with an aster isk (‘‘*’’) are not valid in REXX pro- grams. The other form of KEXX com ment, deli m ited by slash-as ter isk (‘‘/*’’) asterisk-slash (‘‘*/’’) pairs, are valid in REXX program s. · The maxi m um NUMER IC DIGITS value supporte d by KEXX is 1000. · KEXX does not support the fol lowing REXX instruc tions: ADDRES S, PUSH, and QUEUE. · Control vari ables in KEXX DO loops must be sim ple sym bols, and the values of the control vari able and the expres sions involved in DO loop control must be whole num bers with at most 9 digits. · TRACE + and TRACE -, used to turn inter acti ve tracing on and off, are supporte d in KEXX but not in REXX, which supports only TRACE ?, which toggles the sta- tus of in ter ac tive tracing. · The STREAM() built-in func tion is not avail able in KEXX. · KEXX does not support the NOTREADY condi ti on. · Labels in KEXX program s are only valid when they are the first token on a line.

388 Chapter 6. Macro Reference · KEXX’s LINEIN(), LINEOUT(), LINES(), CHARIN(), CHAROUT(), and CHARS() functi ons require that their first oper and be speci fie d. REXX lets you do I/O to the console by omit ting this ar gum ent. · The fol lowing REXX fea tures are supporte d in KEXX, but are not docu m ented here because they are rarely-used and not of in ter est to most KEDIT us ers: the sec - ond ar gu ment (‘‘n’’) of the C2D(), D2C(), and X2D() functions , the expp and expt ar gu ments of the FOR MAT() func tion, the NU MERIC FORM in struc tion, the FORM() functi on, SIGNAL VALUE, and TRACE VALUE. See the Cowlishaw book for detai ls about these items. · For com pati bil ity with older versions of KEDIT, KEXX accept s the charac ter s ‘‘@’’, ‘‘#’’, and ‘‘$’’ as valid in sym bols and lets you use ‘‘^’’ and ‘‘~’’ to in dicat e nega ti on. These charac ter s are not in cluded in the latest REXX language defi ni ti on and are consid ered in valid by some REXX im plem enta ti ons, so their use is disc ouraged. e c n e r e f e R

o r c a M

KEXX and REXX 389 Chapter 7. Built-In Macro Handling

7.1 Overview

While you can use the MACRO com mand to run macros directly from KEDIT’s com - mand line, KEDIT macros are most often exe cuted in response to some interac ti on with KEDIT’s user interface . Whenever you press a key, select a toolbar but ton or menu item, or click a mouse but ton, KEDIT runs a macro associ ate d with that action. Most of the macros involved are built into KEDIT, but you can use the DEFINE com mand to rede fine these macros and change KEDIT’s behavior.

This chapter has inform ati on on the nam ing conven ti ons used in the proces sing of key- board, toolbar, menu, and mouse macros.

You can use the MAC ROS com mand to see the defi ni ti ons of all cur rently-defined macros; this will include any macros that you have defined, as well as any default mac - ros that you have not redefine d. To see the default macros that are built into KEDIT, you can run KEDIT with the NOPROFILE option, so that only the default macros are defined, and then use the MACROS command.

Another way to see KEDIT’s default macro defi ni ti ons is to look at the file BUILTIN.KML, which is installed by the KEDIT for Windows SETUP pro gram in the SAMPLES subdi rec tory of the main KEDITW directory . If you decide to change any of KEDIT’s default macro defi ni ti ons, we recom mend that you use sepa rat e DEFINE com mands or KML files for your modi fie d defi ni ti ons, and do not load the entire BUILTIN.KML file from within your pro file. This is because load ing the entire file would be time consum ing and redundant, since the macros involved are already built into the KEDIT module, and because if any of KEDIT’s default defi ni ti ons change in future releases of KEDIT, you may be loading in obsolet e macro defi ni ti ons from your modified version of BUILTIN.KML.

7.2 Keyboard Macros

KEDIT has names for each key and key com bina ti on that it can read from the keyboard. When ever you press a key or a key com bina ti on recog nize d by KEDIT, KEDIT deter- mines the name of the key that was pressed and execute s the corre spond ing macro.

For exam ple, when you press the F1 key, KEDIT runs the F1 macro, which by default issues the com mand HELP, which in turn causes KEDIT to display its Help file. And when you press the Shift+F1 key, KEDIT runs the SHIFT+F1 macro, which by default issues the LOCATE com mand with no operands, causing KEDIT to re-execute the most-recent LOCATE comm and.

KEDIT even has built-in macros corre spond ing to the charac ter keys on your keyboard. For exam ple, when you press the ‘‘A’’ key, KEDIT runs a macro called ‘‘A’’, which issues the comm and ‘‘text a’’ to enter a low er case ‘‘a’’ at the cur sor posi tion.

390 Chapter 7. Built-In Macro Handling When you press Shift+A, KEDIT runs a macro called SHIFT+A, which issues the com mand ‘‘text A’’ to enter an uppercas e ‘‘A’’ at the cursor position.

Naming The system used for key names is straightfor ward. For most keys, the key name is sim - conventions ply the name that appears on the key. For keys pressed in com bina ti on with the Shift, Ctrl, or Alt keys, key names are prefixed with ‘‘Shift+’’, ‘‘Ctrl+’’, or ‘‘Alt+’’ (which can also be given in shorter form as ‘‘S+’’, ‘‘C+’’, or ‘‘A+’’). For com pati bil ity with older versions of KEDIT, you can use ‘‘-’’ instead of ‘‘+’’ as the sepa ra tor within keynames. So, for exam ple, ‘‘Ctrl+End’’, ‘‘Ctrl-End’’, ‘‘C+End’’, and ‘‘C-End’’ are all equiva lent . You can give key names in any com bina ti on of uppercas e and lowercase.

For exam ple, ‘‘J’’ (or ‘‘j’’) names the alpha betic key that nor mally enters a low er case ‘‘j’’ at the cursor position. ‘‘Shift+J’’ (or ‘‘Shift+j’’, or ‘‘S+J’’, etc.) names the shifted version of this key, which norm ally enters an uppercas e ‘‘J’’ at the cursor position.

KEDIT also handles key com bina ti ons involving Shift and Ctrl pressed in com bina ti on with another key. For example, ‘‘Shift+Ctrl+A’’, ‘‘Ctrl+Shift+A’’, ‘‘C+S+A’’, and ‘‘S+C+A’’ are all valid and all refer to the same key com bi na tion. Simi larly , KEDIT handles Alt and Ctrl pressed in com bina ti on with another key, as in ‘‘Ctrl+Alt+A’’ or ‘‘Alt+Ctrl+A’’.

The key names accepted by KEDIT are listed in the table on the next page. Some key com bina ti ons are not avail able, because they are given spe cial handli ng by Windows. For exam ple, Ctrl+Esc always brings up the Windows Task List window , and its behav- ior cannot be changed by KEDIT. And press ing Shift+Space (that is, pressing the Shift key in combi na tion with the space bar) is treated the same as press ing Space alone. s o r c a M

n i - t l i u B

Keyboard Macros 391 A...Z Shift+A...Z Ctrl+A...Z Alt+A...Z 0...9 Shift+0...9 Ctrl+0...9 Alt+0...9 ’ Shift+’ Ctrl+’ Alt+’ - Shift+- Ctrl+- Alt+- = Shift+= Ctrl+= Alt+= [ Shift+[ Ctrl+[ Alt+[ ] Shift+] Ctrl+] Alt+] \ Shift+\ Ctrl+\ Alt+\ ; Shift+; Ctrl+; Alt+; ’ Shift+’ Ctrl+’ Alt+’ , Shift+, Ctrl+, Alt+, . Shift+. Ctrl+. Alt+. / Shift+/ Ctrl+/ Alt+/ Space Alt+Space En ter Ctrl+En ter Alt+En ter Tab Shift+Tab Ctrl+Tab Esc Bksp Ctrl+Bksp Alt+Bksp F1...F12 Shift+F1...F12 Ctrl+F1...F12 Alt+F1...F1 2 Home Shift+Home Ctrl+Home Alt+Home Pgup Shift+Pgup Ctrl+Pgup Alt+Pgup Pgdn Shift+Pgdn Ctrl+Pgdn Alt+Pgdn Curu Shift+Curu Ctrl+Curu Alt+Curu Curd Shift+Curd Ctrl+Curd Alt+Curd Curl Shift+Curl Ctrl+Curl Alt+Curl Curr Shift+Curr Ctrl+Curr Alt+Curr End Shift+End Ctrl+End Alt+End Ins Shift+Ins Ctrl+Ins Alt+Ins Del Shift+Del Ctrl+Del Alt+Del Cen ter Shift+Cen ter Ctrl+Cen ter Plus Ctrl+Plus Alt+Plus Mi nus Ctrl+Mi nus Alt+Mi nus Slash Ctrl+Slash Alt+Slash Star Ctrl+Star Alt+Star NumEnter Ctrl+NumEnter Alt+NumEnte r App Shift+App Ctrl+App Alt+App Alt

Notes on key · The ta ble does not spe cif ically list Shift+Ctrl+key and Alt+Ctrl+key key com bina - names tions. Wher ever Ctrl+key is valid, Shift+Ctrl+key is also valid. Wher ever Alt+key is valid, Alt+Ctrl+key is also valid, aside from Alt+Ctrl+Del, which is given spe - cial handli ng by the oper at ing system.

· ‘‘Space’’ is the name of the space bar. ‘‘Bksp’’ is the name of the Back space key.

· ‘‘Curl’’, ‘‘Curr’’, ‘‘Curu’’, and ‘‘Curd’’ are the names of the cursor left, right, up, and down keys.

392 Chapter 7. Built-In Macro Handling · ‘‘Plus’’, ‘‘Mi nus’’, ‘‘Star’’, ‘‘Slash’’, ‘‘NumEnter’’, and ‘‘Center ’’ are the names of the num eric key pad ‘‘+’’, ‘‘-’’, ‘‘*’’, ‘‘/’’, Enter , and ‘‘5’’ keys.

· ‘‘App’’ is the name of the Appli cati on key found on some key boards with Win- dows-spe cific keys. · The last keyname in the list, ‘‘Alt’’, re fers to the Alt key, when pressed and re - leased alone and not in com bina ti on with any other key. · When you define your own keyboard macros, be sure to use the key names given in the preced ing ta ble. For ex am ple, ‘‘Esc’’ is the name of the macro that is run when you press the key that is nor mally referred to as the Es cape key. ‘‘Es cape’’ is a valid name for a KEDIT macro, so it is not an error to de fine a macro with that name. But ‘‘Esc’’, and not ‘‘Es cape’’, is the name of the macro that will be ex e - cuted if you press the Escape key. · Most keyboards have a sepa rat e cursor pad and num eric pad. KEDIT does not norm ally disti nguish be tween the two sets of keys. For exam ple, if you rede fine ‘‘Home’’ or ‘‘Ctrl+Home’’, your new defi ni ti on will af fect both the cursor pad Home key and the num eric pad Home key. Alt key com bina ti ons are an excep ti on: when you press the Alt key in com bina ti on with a key on the cursor pad, the ex- pected defi ni ti on (for exam ple, Alt+Home) is proces sed, while Alt in com bina ti on with the num eric pad is the “Alt key-num eric pad” method of entering special characters. · See SET RIGHTCTRL for infor m ati on about how to use the right Ctrl key as the equiva lent of the NumEnter key. · READV KEY and QUERY/EXTRAC T LASTKEY always return key names in up percase , with possi ble ‘‘C-’’, ‘‘S-’’, ‘‘A-’’, ‘‘S-C-’’, or ‘‘A-C-’’ prefixes; ‘‘-’’ is

used in the prefix rather than ‘‘+’’ for com pati bil ity with earli er versions of s o KEDIT. r c a M Notes on KEDIT’s key board nam ing scheme is based on the layout of the standard U.S. key- n i non-U.S. board, and users of non-U.S. keyboards should be aware of a few spe cial - t l keyboards con sid er ations: i u B · Spe cial char acters not found on U.S. keyboar ds, such as ac cented let ters, are han - dled via the ASCII macro, which is discusse d im medi ate ly follow ing these notes.

· Specia l charac ter s that are locat ed in dif ferent posi ti ons on U.S. and non-U.S. key- boards are mapped into their loca ti on on the U.S. key board. To rede fine the be hav- ior of one of these special char acters you would need to re fer to the char acter accord ing to its loca ti on on the U.S. keyboard.

For exam ple, the ‘‘#’’ charac ter is present on both the U.S. and Brit ish keyboards. On the U.S. key board it is locat ed on the same key as the digit ‘‘3’’, and is enter ed by pressing Shift+3. On the British keyboard, this charac ter is on a key of its own, locat ed next to the Enter key. In both cases, when KEDIT sees that you have pressed the key corre spond ing to the ‘‘#’’ charac ter , KEDIT runs the macro that corre sponds to this charac ter ’s posi ti on on the U.S. key board: Shift+3. The defaul t Shift+3 macro uses the TEXT com mand to en ter the ‘‘#’’ char acter at the cur sor

Keyboard Macros 393 posi ti on. To rede fine the be havior of the key that norm ally enter s ‘‘#’’ into your file, you would therefore need to redefine the Shift+3 macro.

· With non-U.S. keyboard drivers, Windows gives specia l handli ng to Alt+Ctrl, treating it as equiva lent to the AltGr key found on non-U.S. key boards. You should there fore not re de fine Alt+Ctrl+x char acter keys that have ad di tional char acters norm ally ac cessed in com bina ti on with the AltGr key.

Special Specia l charac ter s not found on U.S. key boards (such as accented let ters found on most characters and non-U.S. keyboards), digit s entered via the numeric pad, and charac ter s entered via the the ASCII Alt key-numeric pad method of entering spe cial charac ter s do not corre spond directly macro to any of KEDIT’s defined key names. When KEDIT reads one of these char acters from the key board, the char acter code involved, in dec im al, is passed to a spe cial macro called ASCII. (Many of the spe cial charac ter s involved are not defined in the ASCII char acter set and are in fact based on the ANSI char acter set, but for com pat ibil ity with ear lier ver sions of KEDIT the macro is still called the ASCII macro.)

For exam ple, if you use the Alt key-numeric pad method to enter charac ter code 12, KEDIT will inter nally issue the command

MACRO ASCII 12 The default def ini ti on for the macro ASCII uses KEDIT’s TEXT com mand to enter the char acter involved at the cur sor location. If the char acter was entered via the Alt key-numeric pad method, or if you are using an non-OEM font, the charac ter is entered directly. If you are using an OEM font, the default ASCII macro first trans lates the charac ter from ANSI (the charac ter set used by Windows for key board input) to OEM, and enters the resulting character.

7.3 Toolbar Macros

Toolbar buttons are defined via the SET TOOLBUTTON com mand. To define a toolbar but ton, you spec ify a name for the button, how the button will be dis played (that is, what bitmap or text will repre sent the but ton on the toolbar), any condi ti ons under which the but ton will be dis abled (for exam ple, the Undo toolbutton is disable d when no undoable changes have been made to the file), and the help text to be dis played as popup toolbar help and on the status line.

You can then use the SET TOOLSET com mand to define the content s of KEDIT’s top or bottom toolbar, or to add buttons to or remove buttons from the current content s of the toolbar.

See the descripti ons of SET TOOLBAR and SET TOOLSET for full inform ati on on the operands for these com mands, and for exam ples of their use.

When ever you select one of the buttons on KEDIT’s toolbar, KEDIT runs a macro called TOOL_name, where name is the name of the button, as defined in the SET TOOLBUTTON com mand. For exam ple, whenever you select the Undo toolbar but - ton, KEDIT runs a macro called TOOL_UNDO. If you add your own buttons to

394 Chapter 7. Built-In Macro Handling KEDIT’s toolbar, you will need to use the DEFINE com mand to supply KEXX macros to be execute d when those but tons are selected.

There is one excepti on to this: the Quick Find toolbar item is not a button, but is a combo box that lets you work with recently-used search strings, and its behavior is hard-coded into KEDIT and is not control led by a macro.

Built into KEDIT are TOOLBUTTON defi ni ti ons for all of the buttons used on KEDIT’s default toolbars, as well as bitmaps and TOOL_name macros for each of those buttons.

You can use the com mand QUERY TOOLBUTTON * to see a list of all cur rent toolbutton defi ni ti ons. You can use QUERY TOOLSET TOP, BOT TOM, or NOFILE to see the cur rent SET TOOLSET values. Since the TOOLSET values may be too wide to be easil y display ed; you may need to use MODIFY TOOLSET TOP, BOT TOM, or NOFILES to get the TOOLSET values to the com mand line where they can be more eas ily edited or precede d by INPUT and inserted into a file.

The file DEFTOOLB.KEX, in the SAMPLES sub direc tory of the main KEDITW directory , has com mands corre spond ing to the default SET TOOLSET and SET TOOLBUTTON def i ni tions.

7.4 Menu Macros

The content s of KEDIT’s menus are built into the program and cannot be changed. While you cannot change the menus them selves, you can redefine the macros that are exe cuted when menu items are selected, although in prac tice the default menu macros rarely need to be changed. s o r

When a menu item is selected, KEDIT runs a macro called MENU_menu_item, where c menu is the name of the menu involved, and item is the text of the menu item involved, a M with all blanks removed. For exam ple, when you select Save Set tings from the Options n i

menu, KEDIT runs the macro MENU_OPTIONS_SAVESETTINGS. - t l i Excepti ons to this are the docu m ent and frame window sys tem menus, the u B recently-edited files list at the bottom of the File menu, and the win dow list at the bot - tom of the Window menu. The behavior of these menu items is hard-coded into KEDIT and is not control led by macros.

7.5 Mouse Macros

Mouse clicks and double- clicks within a docu m ent window cause KEDIT to run a cor- respond ing macro, called BUTTON1DOWN, BUTTON2DOWN, BUTTON1DBLCLK, or BUTTON2DBLCLK.

When you dou ble-click a mouse but ton, KEDIT pro cesses both the initi al click and the dou ble-click, and runs both of the corre spond ing macros. For exam ple, if you dou - ble-click button 1, KEDIT runs BUTTON1DOWN and then runs BUTTON1DBLCLK.

Mouse Macros 395 Built into KEDIT are default def ini tions for each of these macros. These are by far the most com pli cated of KEDIT’s built-in macros, and we recom mend that they be modi - fied only by advanced users of KEDIT’s macro facili ties. Note that these macros tend to change signif i cant ly between one version of KEDIT and the next as KEDIT adapts to new user interface conven ti ons, so you should reprogram these macros only if you are willing to deal with changes in future versions of KEDIT.

Also built into KEDIT are some helper macros: BUTTONXDOWN is called by BUTTON1DOWN and BUTTON2DOWN, BUTTONXDBLCLK is called by BUTTON1DBLCLK and BUTTON2DBLCLK, and BUTTON2POPUP is called by BUTTONXDOWN.

396 Chapter 7. Built-In Macro Handling Chapter 8. KEDIT Language Definition Files

KEDIT’s syntax color ing facil ity uses dif ferent colors to highli ght com ments, strings, keywords, and other items in program s that you are edit ing. The rules that KEDIT uses to deter mine which text to treat as part of a comm ent, a string, a key word, etc., are spec - ified in spe cial files, called KLD (‘‘KEDIT Lan guage Def ini tion’’) files, that are described in this chapter .

8.1 Loading KLD Files

KEDIT Language Defi ni ti on files are loaded via the SET PARSER com mand:

[Set] PARSER parser fileid Use the parser operand to specify the name of the parser you want to define.

The fileid operand speci fie s a file, with a default extension of .KLD, contai ning your lan guage def ini tion. KEDIT searches for the .KLD file in the same directo ries it uses when searching for macro files, as control led by SET MACROPATH.

For exam ple, if you were working with a hypothet ical language called LANG and you had described the language in a KEDIT Language Defi ni ti on file called LANGDEF.KLD, you could define a parser called LANG with the command

SET PARSER LANG LANGDEF.KLD After issuing the SET PARSER com mand, you could then issue the com mand

SET COL OR ING ON LANG to use this parser to control syntax color ing for the current file.

If files in your language always had an extension of, for exam ple, .LNG, you could use the SET AUTOCOLOR com mand to tell KEDIT to always use the LANG parser for .LNG files:

SET AUTOCOLOR .LNG LANG SET PARSER com mands are typi cal ly execute d from your KEDIT profil e when KEDIT is ini tially loaded. For example:

* if first profile ex e cu tion in a ses sion,

* setup the LANG parser and then s e

* cause all .LNG files to be colored us ing the LANG parser l if ini tial() then do i F 'set parser lang langdef.kld' D

'set autocolor .lng lang' L

end K Several language defi ni ti ons are built into KEDIT, and when KEDIT is loaded it automatically issues SET PARSER com mands that use these language defi ni ti ons to set

Loading KLD Files 397 up its default parsers. See the descripti on of the SET PARSER com mand for a com plete list of built-in parsers. To disti nguish these internal language defi ni ti on files from actual disk files, KEDIT uses an aster isk as the first char acter of their names. For example, the command

SET PARSER C *C.KLD tells KEDIT to use *C.KLD as the Lan guage Def ini tion File asso ci ated with the C parser. The aster isk in the name tells KEDIT to use the spe cial file *C.KLD, which is built into KEDIT, and not to look for the file on disk.

Copies of all of the KLD files built into KEDIT are included in the SAM PLES subdi - rec tory of the main KEDITW direc tory. For example, there is a C.KLD file that is an exact copy of the *C.KLD file that is built into KEDIT. If you modify one of these cop- ies you should save it in a dif ferent locati on (norm ally the “KEDIT Mac ros” subdi rec - tory of your Windows Docu m ents folder, which is someti mes known as the My Docu m ents folder) and load it by issuing a SET PARSER com mand referring to the modified file.

Note that whenever you issue the SET PARSER com mand, the KLD file that you spec - ify is loaded into mem ory, even if an identi cal SET PARSER com mand has previ ously been issued. This makes it easy to develop and test modi fi ca ti ons to KLD files, because if you make changes to a KLD file you can sim ply reissue the appropri ate SET PARSER com mand and KEDIT will load the updated version of the file. Any files whose syntax color ing is control led by your parser will autom ati cal ly be re-colored, so you can eas ily see the effect of the changes you have made to the KLD file.

8.2 KLD File Format

Here is a descripti on of the form at of KEDIT Language Defi ni ti on files, which usuall y have an extension of .KLD. The best way to get started with KLD files is to look over this descripti on briefly, and then to exam ine some of the KLD files that are included in the SAM PLES directory of the main KEDITW directory.

The rules given here for KLD files are flexi ble enough to describe a num ber of popu lar pro gram ming lan guages, to han dle vary ing syn tax con ven tions for com ments, strings, num bers, etc., and to have user-configurable lists of keywords. The goal is to handle many com mon language variants with a rel ati vely small num ber of parameters.

KLD files are divided into secti ons. Each secti on begins with a secti on header, consis t- ing of a colon in colum n one fol lowed immedi ate ly by the secti on name. Fol lowing each sec tion header line are one or more lines of param eter information.

To improve readabil ity, you can insert blank lines at any point in a KLD file. Additi on - ally, any line whose first nonblank charac ter is an asterisk (‘‘*’’) is consid ered a com - ment line and is ignored by KEDIT. For example:

398 Chapter 8. KEDIT Language Definition Files * Sam ple KLD con tents :case ig nore

:identi fier [a-z] [a-z0-9]

:keyword if then else The above exam ple starts with a com ment line, followed by a :CASE secti on with one parame ter line, an :IDEN TI FIER sec tion with one param eter line, and a :KEY WORD sec tion with three parame ter lines. Parame ter infor mation is usu ally indented from column one, as in this exam ple, but it does not have to be. Here are descrip tions of each kind of KLD file sec tion:

:CASE section The :CASE sec tion con sists of a sin gle line with the word RESPECT or the word IGNORE. RESPECT means that the lan guage you are describ ing is case-sen sitive (for example, ‘‘else’’ and ‘‘ELSE’’ are not con sid ered iden tical), and IGNORE means that the lan guage is case-insen sitive.

An exam ple:

:CASE re spect If the :CASE sec tion is omitted, KEDIT assumes case insen si tiv ity. If pres ent, the :CASE sec tion must pre cede the :IDEN TI FIER section.

:OPTION The :OPTION secti on consis ts of a single line contai ning spe cial options that are section needed to properl y proces s some languages and spe cial situ a ti ons. There are three pos- si ble options:

PREPRO CESSOR char PRE PROCES SOR indi cat es that the language supports a C-like prepro ces sor mech anism, and that prepro cessor keywords are preceded by the spec ified char ac - ter. For example: :OPTION prepro cessor #

REXX REXX indi cat es that the REXX language is being descri bed. In REXX, certai n

iden ti fi ers are some times con sid ered keywords and are some times con sid ered s e l

vari ables, depend ing on the context in which they are used, and the REXX opti on i F tells KEDIT to do the spe cial proces sing that this requires. D L K

KLD File Format 399 DEEPNESTING KEDIT norm ally keeps track of :MATCH secti on items nested to a depth of 15. You can spec ify DEEPNESTING in the :OPTION sec tion of a .KLD file to cause nest ing to be tracked to a depth of 255.

:IDENTIFIER The :IDEN TI FIER sec tion con sists of a sin gle line that spec ifies what char acters can section appear within iden tifi ers in the lan guage you are describ ing. These char acters are specified in the same way as char acter class spec ifi cations within KEDIT reg u lar expres sions. They consis t of lists, enclosed in square brackets , of valid charac ter s and/or ranges of valid charac ter s (with the first charac ter in the range, a minus sign, and the last char acter in the range). For example,

:IDENTI FIER [a-zA-Z] spec ifies that any set of alpha betic char acters is a valid iden tifier .

In many lan guages, there are dif fer ent rules for what is valid as the first char acter of an identi fier and for what is valid in additi onal charac ter s in an identi fier. To handle this sit u a tion, you can include two iden tifier spec ifi ca tions: first spec ify what is valid as the first iden tifier char acter and then spec ify what is valid in the remaining char acters. For example, in C pro grams the first char acter of an iden tifier can be any alpha betic char ac - ter or can be an under score, while the remain ing char acters of an iden tifier can be alpha betic or can be underscores, but can also be numeric digits:

:IDENTI FIER [a-zA-Z_] [a-zA-Z0-9_] In some cases (BASIC pro grams are the main exam ple), the last char acter of an iden ti- fier can be a spe cial char acter that is not valid elsewher e in an iden tifier . For example, in BASIC, ABC@ is a valid iden tifier . To han dle this, you can include a third item spec - ify ing the special char acters accept able only at the end of an iden tifier . For example:

:IDENTI FIER [a-zA-Z] [a-zA-Z0-9_] [%&!#@$] You can also spec ify in the :IDEN TI FIER sec tion that iden tifi ers that aren't keywords should be display ed in a specia l color. To do this, add the word ALTER NATE fol lowed by a num ber from 1 to 9 that speci fie s the alternate ECOLOR to be used to for these iden ti fi ers. For example:

:IDENTI FIER [a-zA-Z_] [a-zA-Z0-9_] ALTER NATE 2 In the above exam ple, ALTER NATE 2 has been added to the usual speci fi ca ti on for C iden tifi ers. This will cause C iden tifi ers that are not keywords to be dis played in the color spec ifie d by ECOLOR 2. An optional second num ber, also in the range 0 to 9, control s the color used to display prepro ces sor identi fiers that aren't keywords, as in this example:

400 Chapter 8. KEDIT Language Definition Files :IDENTI FIER [a-zA-Z_] [a-zA-Z0-9_] ALTER NATE 2 3

The :IDEN TI FIER sec tion is required if you will be using the :KEY WORD sec tion to give a list of the keywords in your language. The :IDENTI FIER sec tion must appear before the :KEYWORD section.

:COMMENT Use the :COMMENT sec tion to describe the rules for com ments in your language. section Each line of the :COM MENT sec tion describes one type of com ment; since some lan - guages have multi ple methods for speci fy ing com ments, there may be multi ple lines in the :COMMENT section. Some languages have single- line com ments, which are introduced by some type of com ment delim iter and cannot conti nue for multi ple lines. Some languages have com - ments with both a starting and an ending delim iter. This kind of com ment can usuall y conti nue for multi ple lines, but in some languages may be restricted to a single line. For exam ple, C++ allows com ments that are intro duced by a pair of slashes (‘‘//’’) and conti nue until the end of the line. C++ also allows com ments that can conti nue for mul- ti ple lines, introduced by a slash-asterisk pair (‘‘/*’’) and term inate d by an asterisk-slash pair (‘‘*/’’). The corre spond ing :COM MENT sec tion would be:

:COMMENT line // any paired /* */ nonest Line com ments are described using the form at

LINE delim ANY|FIRSTNONBLANK|COLUMN n where delim is the com ment delim iter, which is fol lowed by an indi cati on of when the comm ent delimiter takes effect:

ANY in di cates that ap pear ance of the comm ent de lim iter any where on a line (ex cept within a quoted string) starts a com ment.

in di cates that ap pear ance of the comm ent de lim iter any where on a line (ex cept within a quoted string) starts a com ment.

When ANY is used an addi ti onal opti on, NOTAFTER [class], is also al lowed. It

in di cates that an oc cur rence of delim that imme di ately follow s one of the spec ified s e l

class of charac ter s should not be taken to indi cat e the start of a com ment. For i F

example, D L

:COM MENT K line % any notafter [*] would pre vent the first line be low from being taken as a com ment:

KLD File Format 401 *% This one is not a comment. % This one is a comment.

FIRSTNONBLANK in di cates that the comment de limiter starts a comment only if it is the first nonblank item on a line.

COLUMN n in di cates that the comment de limiter starts a comment only if it ap pears in column n of a line.

Com ments with both start ing and ending delim it ers are described using the form at

PAIRED delim1 delim2 [NEST|NONEST] [MULTI PLE|SIN GLE] where delim1 is the delimiter that starts a comment and delim2 is the delimiter that ends a comm ent.

NEST|NONEST NEST in di cates that multi-line comments can be nested in side multi-line com- ments, with the com ments ending only when as many com ment end deli m it ers as com ment start deli m it ers have been encoun ter ed. NONEST is the defaul t and indi - cates that com ments cannot be nested, and that a com ment ends as soon as the next com ment end deli m iter has been encoun ter ed. For example, consider

/* /* here is a comment */ x = 17 */

In the REXX language, which al lows nested com ments, ‘‘x = 17’’ would be con- sidered part of a com ment. In the C language, which does not al low nested com - ments, ‘‘x = 17’’ would not be consid ered part of a com ment, and the final ‘‘*/’’ in the exam ple would be invalid.

MULTI PLE in di cates that the comments can con tinue for mul tiple lines; this is the de fault and need not be speci fie d.

SINGLE indi cat es that, even though paired deli m it ers are being used, the com ments must begin and end on a single line.

:HEADER The :HEADER sec tion describes header lines. Header lines are used to indi cate the section start of a new sec tion in cer tain types of files; the section ers in .KLD files are examples of header lines. Header lines are spec ified in the same way as sin gle-line comm ents:

402 Chapter 8. KEDIT Language Definition Files LINE delim ANY|FIRSTNONBLANK|COLUMN n As far as KEDIT’s syntax color ing is concerne d, the only dif ference between sin- gle-line com ments and headers is that com ments are display ed using ECOLOR A and headers are display ed using ECOLOR G. An exam ple of a :HEADER secti on that describes .KLD file sec tion headers:

:HEADER line : col umn 1

:STRING Use the :STRING sec tion to describe the types of quoted strings used in your language. section Each line of the :STRING sec tion describes one type of string; since some languages have multi ple methods for speci fy ing strings, there may be multi ple lines in the :STRING sec tion. There are three pos si bil ities: SINGLE This means that your language uses strings enclos ed in single quotes.

DOUBLE This means that your language uses strings enclos ed in double quotes.

DELIM ITER c Use this to specify that the char acter c is the string de lim iter for your language.

SINGLE, DOUBLE, and DELIM ITER c can optionall y be followe d by the words BACKSLASH, VERBA TIM, or MULTILINE, by the com bina ti on BACKSLASH MULTILINE, or by the com bina ti on VERBA TIM MULTILINE. BACKSLASH This means that, as is the case in the C and C++ lan guages, the back slash char acter serves as an es cape char acter within strings and that quote char acters fol low ing a backsla sh do not term inate a string. VERBA TIM This is used to handle the “verba ti m” strings avail able in the C# language. These are spe cial C# strings that be gin with an @ char acter in which back slash char acters don't serve as es cape char acters, so that you can use strings like

@"C:\Windows\System32"

in stead of s

"C:\\Windows\\System32" e l i F MULTILINE D

Indi cat es that strings need not begin and end on the same line, but can conti nue L across end-of-line boundari es. K If the :STRING secti on is omit ted, KEDIT’s syntax color ing does not recog nize any strings in your files.

KLD File Format 403 Another option, NOTAFTER [class], which must be the last option on the line, indi - cates that a quote that imme di ately follow s one of the spec ified class of char ac ters should not be taken to indicat e the start of a string. For exam ple,

:STRING sin gle notafter [a-zA-Z] would pre vent the first three quote charac ter s here from being taken as the start of a string:

a' + b' = c' 'only this is a string' The NOTAFTER option is not valid if the VER BA TIM option has been speci fie d.

:NUMBER Use the :NUMBER sec tion to indicat e the form at of num bers in your language. The section :NUM BER sec tion is a sin gle line long, with the word INTE GER, DEC I MAL, C, COBOL, PASCAL, REXX, or ADA.

· INTE GER means that num bers con sist of strings of dig its.

· DECI MAL means that num bers con sist of strings of dig its and pe riods.

· C is used for C language num bers. These can be inte gers, deci m al num bers, or num bers in expo nenti al nota ti on, like 12.4E-2. Several other languages use nu- meric for mats that are simi lar to those used by C. · COBOL is used for COBOL language num bers, which consis t of digit s and deci - mal points, except that trail ing dec im al points are not counted as part of a num ber, and dig its im me di ately fol lowed by CO BOL iden ti fier char ac ters (for ex am ple, 1234-TEST) are not counted as numeric. · PASCAL num bers are like C language num bers, except that they cannot start with a dec im al point. Also, hex adec im al val ues (for ex am ple, $abcd) are treated as numeric. · REXX handles REXX language consta nt sym bols, which include REXX num bers and sym bols like 12ABC and .XYZ. · ADA num bers are like C language num bers, except that under score s are allowed within the num bers. If the :NUM BER sec tion is omit ted, KEDIT’s syntax color ing does not recog nize any num bers in your files.

:LABEL Use the :LABEL sec tion to define what counts as a label in your language. The label section sec tion norm ally consis ts of a single line, but can involve multi ple lines if your lan - guage has multi ple ways of spec ify ing labels. The label descripti on has the format

DELIM ITER delim FIRSTNONBLANK|ANY|COLUMN n where delim is the delimiter that must follow the label and FIRSTNONBLANK indi - cates that the label must be the first nonblank item on a line, ANY indicates that the

404 Chapter 8. KEDIT Language Definition Files label can appear any where on a line, and ‘‘COL UMN n’’ indicates that the label must begin in colum n n of a line.

Instead of a DELIMITER line, you can specify

COLUMN n to indicat e that any non-key word identi fier beginning in the speci fie d colum n should be treated as a label, with no need for a delim iter fol lowing the label.

:MATCH Use the :MATCH sec tion to spec ify the matching char ac ters and iden tifi ers that indi - section cate nested struc ture within your language. For exam ple, in most languages , left and right parenthe ses can be nested and must match up properl y in a syntac ti cally correct program . In some languages the same is true of keywords like BEGIN and END.

KEDIT’s syn tax color ing facil ity uses the infor mation in the :MATCH sec tion for two pur poses:

First, items at dif fer ent nest ing lev els are col ored dif fer ently, so you can eas ily see which items match. For example, in the line

if (f(x + y + z) = 17) KEDIT can display the inner parenthe ses and the outer parenthe ses in dif ferent colors.

Second, when you use the CMATCH com mand (assigned by default to Shift+F3) to find the matching item for the text at the cursor posi tion, KEDIT can properl y match any items described in the :MATCH secti on. With the cursor on the first DO in the fol - lowing exam ple, Shift+F3 can move the cursor to the second END in the example:

if a = 5 then do j = 17 do i = 1 to 10 say i*j end end Each line of the :MATCH secti on (which can have up to 200 lines) has either two or three items. The first item spec ifies the iden tifi ers or char acter sequences that intro duce a matchable con struct. The sec ond item spec ifies the iden tifi ers or char acter sequences that end a matchable construc t. The third item is optional, and is used to spec ify items that always appear inside of a matchable construct.

For exam ple, s e l i

:MATCH F

( ) D { } L K #if #endif #else Here, three matchable con structs are spec ified:

KLD File Format 405 · The first speci fie s that left paren the ses will be matched with cor respond ing right pa ren the ses. · The second spec ifie s that left braces will be matched with cor respond ing right braces. · The third speci fie s that, as in the C prepro ces sor language, #if is matched with #endif and that within an #if/#endif construc t there may be an #else item that should be colored in the same way as the corre spond ing #if and #endif. KEDIT actu ally uses the fol low ing :MATCH sec tion in its default C lan guage parser:

:MATCH ( ) { } #ifdef,#if,#ifndef #endif #else,#elif,#elseif This is because any of #ifdef, #if, and #ifndef can match up with #endif, with any of #else, #elif, and #elseif allowed between them. As in this exam ple, you can spec ify multi ple equiv a lent items in a :MATCH sec tion, sep a rated by commas.

You can specify multi-token keywords in the :MATCH secti on by using a plus sign (“+”) to join the com ponents of a multi-token key word:

:MATCH do end+do if end+if Some notes on using the :MATCH secti on:

· The current scheme for handli ng matched items works only for items that do not contai n blanks. That is, #if and #endif pairs or BE GIN and END pairs can be matched, but WHILE and END WHILE or IF and END IF cannot be handled, since they con tain blanks. · An identi fier or charac ter sequence should only appear once in the :MATCH sec- tion; any addi ti onal oc currence s of the same item will have no ef fect. So, for exam - ple, in a language that has DO—END and BEGIN—END construc ts, you should not use :MATCH DO END BE GIN END but should inste ad use

:MATCH DO,BE GIN END

· Any iden tifi ers in cluded in :MATCH spec ifi ca tions must also ap pear in the :KEY WORD sec tion, or they will be ignored.

· KEDIT can display up to 8 levels of nested items in dif ferent colors. But it keeps track of nested items up to a depth of 15 — for exam ple, up to 15 levels of nested

406 Chapter 8. KEDIT Language Definition Files paren the ses. You can specify DEEPNESTING in the :OPTION sec tion of a .KLD file to cause nest ing to be tracked to a depth of 255.

If the :MATCH sec tion is omitted, KEDIT’s syn tax color ing facil ity does not rec og nize any matchable construc ts in your files.

:KEYWORD Use the key word sec tion to specify the keywords in your language. Each line of the section keyword sec tion has the form

keyword [ALTER NATE n] [TYPE m] where key word must be a valid identi fier in your language. (If you speci fie d PRE PRO- CESSOR in the :OPTION secti on, you can also include prepro ces sor keywords, which must consis t of the prepro ces sor charac ter followed by a valid identifier.)

Keywords are norm ally col ored according to the current ECOLOR D setti ng, and pre - proces sor keywords according to the current ECOLOR F setti ng. It is someti mes use ful to specify dif ferent types of keywords that will be col ored dif ferentl y. To do this, you can specify

ALTER NATE n fol low ing a key word, where n is a num ber from 1 through 9. When ALTER NATE 1 is spec ifie d, ECOLOR 1 is used to color the keyword; when ALTER NATE 2 is spec ifie d, ECOLOR 2 is used, etc.

TYPE m is used only when REXX has been speci fie d in the :OPTION secti on, and determ ines what to treat as a REXX keyword, subkeyword, etc. The num ber m is deter mined as follow s: start with m equal to 0, then add 1 for a REXX keyword, add 2 for a REXX subkeyword, and add 4 for a REXX key word that takes subkeywords. For exam ple, SAY is a keyword that does not take subkeywords, so it is TYPE 1. ARG is a REXX keyword, is also a REXX subkeyword (as in PARSE ARG), and it takes subkeywords (as in ARG UPPER), so it is TYPE 7. For further exam ples, see the REXX.KLD file in the SAMPLES subdi rec tory of the main KEDITW directory.

A sample :KEY WORD sec tion:

:KEYWORD if then else do end s e l switch i F for pro ce dure al ter nate 1 D L If the :KEY WORD sec tion is omitted, KEDIT’s syn tax color ing facil ity does not rec - K ognize any keywords. If the :KEYWORD sec tion is speci fie d, it must be precede d by the :IDEN TI FIER section.

KLD File Format 407 :MARKUP The :MARKUP sec tion is used with HTML and sim ilar markup languages . It can con- section tain a TAG line and, option ally, a REF ER ENCE line. Use the TAG line to spec ify the char acter string that ini tiates a markup tag and the char - acter string that ter minates a markup tag. In an HTML file, where a typ ical line of text might be:

Level 1 header

‘‘<’’ ini tiates a tag, and ‘‘>’’ ter minates it. This would be spec ified in the :MARKUP sec tion as

:MARKUP TAG < > Use the REF ER ENCE line to spec ify the char ac ter string that initi ates a char ac ter or entity ref er ence and the char acter string that ter minates it. HTML lets you use entity refer ences like ‘‘<’’ or char acter ref er ences like ‘‘<’’ to refer to spe cial char acters. These ref er ences begin with an amper sand (‘‘&’’) and end with a semi-colon (‘‘;’’). This would be spec ified in the :MARKUP section as: :MARKUP TAG < > REF ER ENCE & ; The fol low ing spe cial rules apply if your KLD file con tains a :MARKUP sec tion: · Tags are highli ghted, using ECOLOR T. For exam ple, in the line

This is a new paragraph. ‘‘

’’ would be highli ghted. · Quoted strings within tags are highli ghted us ing ECOLOR B. For exam ple, in the quoted string is dis played using ECOLOR B, while the rest of the tag is dis - played using ECOLOR T. · Simi larly , number s within tags are high lighted us ing ECOLOR C.

· Num bers and quoted strings that are not within markup tags are not highli ghted.

· Char acter and en tity refer ences are high lighted us ing ECOLOR U.

:COLUMN Use the :COLUMN secti on to specify that the parser should ignore certai n colum ns of section your file. For exam ple, in COBOL colum ns 1 through 6 of a file and all colum ns beyond colum n 72 of a file are ignored by the com piler. This would be spec ifie d as

:COLUMN EX CLUDE 1 6 EX CLUDE 73 * Each line of the :COL UMN sec tion has the word EXCLUDE fol lowed by the start ing and ending col umn of a range of col umns that the parser is to ignore. The ending

408 Chapter 8. KEDIT Language Definition Files colum n can be given as an asterisk to indi cate that all col umns through the end of the line are to be ignored.

When the syntax color ing parser proces ses a line of your file, it will treat the excluded colum ns as if they were entirely blank. By default, the excluded colum ns will be dis- played with no specia l highli ghting, but you can specify that any of the 9 ALTER NATE colors be used. For example,

:COLUMN EX CLUDE 1 10 AL TER NATE 2

would display colum ns 1 through 10 of your file using ECOLOR 2.

:POSTCOMPARE The :POSTCOMPARE sec tion is used to color char acter sequences that are not han - section dled by any of the other sec tions of a KLD file. For exam ple, you might want to color opera tors like ‘‘+’’, ‘‘-’’, and ‘‘=’’, or items like ‘‘.T.’’ and ‘‘.F.’’, which indi cate True or False in xBase program s but are not valid identi fiers.

The :POSTCOMPARE can con tain CLASS lines and TEXT lines.

CLASS lines specify a set of charac ter s that you want to have colored, using the same regu lar expres sion charac ter class notati on that is used in the :IDENTI FIER sec tion. For example,

CLASS [+-=/]

means that ‘‘+’’, ‘‘-’’, ‘‘=’’, and ‘‘/’’ char acters are to be col ored. KEDIT uses ECOLOR I by default, but you can instead spec ify any of the nine alternate keyword col ors. For exam ple:

CLASS [+-=/] AL TER NATE 2

TEXT lines specify a string of nonblank charac ter s that is to be colored. For exam ple,

TEXT .T.

would color the charac ter sequence ‘‘.T.’’. KEDIT uses ECOLOR D by default, but you can spec ify an alter nate key word color. For example:

TEXT .T. AL TERNATE 3

You can specify any num ber of CLASS or TEXT lines in a :POSTCOMPARE secti on. When apply ing syntax color ing to your file, the :POSTCOMPARE secti on is proces sed last. That is, KEDIT first checks for iden tifi ers, numbers, comm ents, tags, etc., and s

checks the items in the :POSTCOMPARE secti on only if none of these are found. e l i F

Note that it is not use ful to include valid iden tifi ers in the :POSTCOMPARE sec tion, D since the parser checks for iden tifi ers before :POSTCOMPARE is pro cessed, so iden ti- L fi ers, even iden tifi ers that are not listed in the :KEY WORD sec tion, will never be K matched by :POSTCOMPARE. For this rea son, any identi fiers that you want to color should be included in the :KEYWORD section.

KLD File Format 409 Chapter 9. Error Messages and Return Codes

The first part of this chapter lists all of KEDIT’s num bered error messages , with descripti ons of all message s that may not be self-explana tory . The return code associ - ated with each of the errors is also given; the second part of the chapter discusse s these return codes.

In many cases, KEDIT display s addi tional infor mati on with these error message s. For exam ple, when KEDIT issues the ‘‘Invali d operand’ ’ message , it usuall y shows you the invalid operand.

Mac ros that you write can use the EXTRACT /LASTMSG/ command to examine the text of messages dis played by KEDIT. Note that the mes sage num bers, mes sage texts, and the return codes given may change from one release of KEDIT to the next.

9.1 Error Messages

Error 1: Invalid operand (RC=5)

Error 2: Too many operands (RC=5)

Error 3: Too few operands (RC=5)

Error 4: Invalid number (RC=5) You entered a non-numeric value for an operand that must be numeric, or you entered a num ber that is not valid for the com mand you issued.

Error 5: Numeric operand too small (RC=5) The num ber that you spec ifie d as an operand for a com mand is less than the lowest allowable value for that oper and.

Error 6: Numeric operand too large (RC=5) The num ber that you spec ifie d as an operand for a com mand is greater than the highest allowable value for that oper and.

Error 7: Invalid fileid (RC=20)

Error 8: Invalid, protected, or locked file (RC=12) KEDIT can not access a file you have spec ified, pos sibly because the fileid you have given is actu ally the name of a direc tory, or because the file is locked. This error can also occur if you are trying to create a file in the root directory of a drive but the root direc tory is full.

410 Chapter 9. Error Messages and Return Codes Error 9: File not found (RC=28) s Error 10: Path not found (RC=28) e g

KEDIT tried to access a file, but the path compo nent of the fileid spec ified a directory a s

that does not exist. s e M

r o

Error 13: Invalid drive specifier (RC=24) r r

You spec ifie d an invalid drive let ter in a fileid. One possi ble cause of this is that you are E not properl y logged on to a network drive that you are trying to access.

Error 14: Not same device (RC=99) You issued the RENAME com mand speci fy ing fileids on two dif ferent drives; RENAME requires that both fileids spec ify the same drive.

Error 15: Incomplete target specification (RC=5)

Error 16: Invalid target (RC=5)

Error 17: Target not found (RC=2)

Error 18: Invalid line name (RC=5)

Error 19: Line name not defined (RC=2)

Error 20: No line names defined (RC=3)

Error 21: Invalid command (RC=-1)

Error 22: File has been changed - QQUIT to quit anyway (RC=12) You issued the QUIT com mand for a file that has been modi fie d. If you are sure that you want to abandon the changes to the file, use the QQUIT com mand instead.

Error 26: Too many windows defined (RC=4) You tried to use the SET SCREEN com mand to display more than its limit of 16 win dows.

Error 27: Invalid delimiter (RC=5) Only spe cial char ac ters are valid as delimit ers for strings in string targets and in the CHANGE com mand and related com mands, but KEDIT encounter ed an alphabeti c or numeric delimiter .

Error Messages 411 Error 28: Invalid range (RC=5) You issued the SET RANGE com mand, but spec ifie d a start ing line for the range that comes later in the file than the end ing line.

Error 29: Synonym table full (RC=95) You tried to define more than KEDIT’s limit of com mand synonym s, which is 1000, or KEDIT’s limit of fiftee n prefix syn onyms.

Error 30: Memory shortage - FSA memory full (RC=94) A com mand could not exe cute properl y because KEDIT’s FSA (File Storage Area) filled up and all avail able sys tem mem ory was already allo cated to it. To free up some space, you may need to remove some files from the ring by using File Close, or you may need to close some other applica ti ons. This error message usuall y indicat es that the sys tem swap file, or the disk on which it is located, is nearly full.

Error 31: File already exists - use FFILE/SSAVE (RC=3) You issued a FILE or SAVE com mand to write a file to disk under a new fileid, but a file with the new fileid already exists on disk. If you are sure that you want to replace the existing file, use an FFILE or SSAVE com mand instead.

Error 32: Invalid hexadecimal or decimal value (RC=5)

Error 33: Too many ARBCHAR characters - maximum is 50 (RC=5) A string that you speci fie d had more than the maxi m um of fifty ARBCHARs that KEDIT can handle.

Error 34: Line not found (RC=2) You issued a FIND, FINDUP, NFIND, or NFINDUP com mand that was unsuccess ful.

Error 35: Truncated (RC=3) Text that a KEDIT com mand would have placed beyond the trunca ti on colum n was truncat ed by KEDIT, since KEDIT com mands do not operate beyond the trunca ti on column.

Error 36: No lines changed (RC=4) A KEDIT com mand unexpect edly made no changes to your file. For exam ple, the CHANGE com mand may have found no occurrence s of the string that it was supposed to change.

Error 37: Maximum EDITV variable length exceeded (RC=95) You tried to set an EDITV vari able to a value that is longer than the WIDTH set ting, which is the maxi m um allowable length for an EDITV vari able.

412 Chapter 9. Error Messages and Return Codes Error 38: Improper cursor position (RC=2) The cursor was not posi tioned properl y for the action that you tried to carry out. For

exam ple, you tried to enter text when the cursor was on the top-of-file or end-of-file s e

line or beyond the trunca ti on colum n, or you tried to use a com mand like SPLIT or g

JOIN that is invalid when the cursor is in the prefix area or beyond the trunca ti on a s

column. s e M

r

Error 39: No remembered operand available (RC=3) o r You gave no operands for a com mand like LOCATE or CHANGE, and no remem bered r operands were avail able because the com mand had not previ ously been issued. E

Error 43: Operation would truncate box block or one-line stream block(RC=2) KEDIT cannot carry out a move, copy, or overlay opera ti on on a box block or a one-line stream block, because to do so would affect data beyond the trunca ti on col- umn, and KEDIT com mands cannot oper ate on text beyond the trunca ti on column.

Error 44: No marked block (RC=2) You are trying to carry out some block opera ti on, but there is current ly no marked block.

Error 45: Marked block not in current file (RC=2) There is a marked block in some other file in the ring, but not in the current file. Many KEDIT com mands that work with marked blocks require that the block be in the cur- rent file.

Error 46: Block boundary excluded, not in range, or past truncation column (RC=2) KEDIT cannot handle block opera ti ons if the beginning or end of the block is an excluded line and SCOPE DISPLA Y is in effect, or if the beginning or end of the block is out side of the current range or is located past the trunca ti on column.

Error 47: Operation invalid for line blocks (RC=2) The current ly marked block is a line block, and the block opera ti on you are attempting (such as OVERLAYBOX or FILLBOX) is invalid for line blocks.

Error 48: Operation invalid for box blocks (RC=2) The current ly marked block is a box block, and the block opera ti on you are attempting (such as COM PRESS or DUPLICA TE) is invalid for box blocks.

Error 49: Operation invalid for stream blocks (RC=2) The current ly marked block is a stream block, and the block opera ti on you are attempt- ing is invalid for stream blocks.

Error 50: Invalid MOVE, COPY, or OVERLAYBOX location (RC=2) The desti nati on of a block move, copy, or overlay is inside of the marked block or is the top-of-file line.

Error Messages 413 Error 51: No preserved settings to restore (RC=3) You issued the RESTORE com mand, but there are no preserve d values to restore.

Error 52: Disk is write protected (RC=12)

Error 53: Command valid only when issued from a macro (RC=-3) The ALERT, DIALOG , EXTRACT, POPUP, and READV com mands, along with some forms of the EDITV com mand, can only be issued from within macros and not from the com mand line. This is because they need to exam ine or set the values of macro vari ables. Error 54: Device not ready (RC=100) A device that you tried to use is not ready. This is most often the result of a diskett e drive with no dis kette in it.

Error 55: Printer out of paper (RC=100) KEDIT could not com plete a PRINT com mand because the printer returned an out-of-paper error.

Error 56: I/O error on file (RC=100) KEDIT could not com plete a com mand involving disk input or output because it encounter ed an input or out put error while accessing the disk.

Error 57: Disk full error (RC=13) KEDIT could not com plete a FILE, SAVE, PUT, or AUTOSAVE because the disk involved became full. You will need to free up some space on the disk before reis suing the com mand that could not com plete.

Error 59: No lines are named (RC=3)

Error 60: Line name not found (RC=2)

Error 61: Command ignored due to error loading file (RC=6) If your profil e issues a com mand that causes KEDIT to load your file into mem ory but KEDIT runs into errors that make it impossi ble to load the file, KEDIT execute s your profil e to com pleti on but any additi onal com mands that your profil e issues yield this error message and are not oth er wise processed.

Error 62: Operation invalid for multi-line stream blocks (RC=2) The current ly marked block is a multi-line stream block, and the block opera ti on you are attempting (such as a SHIFT or CEN TER command) is invalid for multi-line stream blocks.

Error 63: Invalid cursor line or column (RC=1) You tried to use the CUR SOR SCREEN com mand to move the cursor to a positi on on the screen not valid for a cursor (for exam ple, to the ID line or the arrow on the

414 Chapter 9. Error Messages and Return Codes com mand line), or you tried to use the CUR SOR FILE com mand to move the cursor to a line or col umn of the file not current ly displayed. s e g

Error 64: Line not reserved (RC=4) a s

You tried to use the SET RESERVED com mand to turn off a reserved line, but the line s was not reserved. e M

r o r Error 65: VERSHIFT would become too large (RC=5) r You tried to use the LEFT or RIGHT com mands to offset the display ed col umns to the E left or right by more than the maxi m um value that KEDIT can handle, which is equal to the setting of the WIDTH initial iza tion option.

Error 66: Invalid match position (RC=2) You issued the CMATCH com mand, but the cursor was positi oned outside of the cur- rent zone colum ns, or on the top-of-file or end-of-file line, or on a shadow line.

Error 67: Invalid match character (RC=2) You issued the CMATCH com mand, but the charac ter in the focus colum n was not one of the char acters that CMATCH can han dle (braces, brack ets, angle brack ets, or paren the ses).

Error 68: Matching character not found (RC=2) The CMATCH comm and could not find a char acter that matches the char acter in the focus colum n.

Error 69: Macro line exceeds 1024 character limit (RC=97) Lines in KEDIT macros cannot be more than 1024 charac ter s long.

Error 70: No lines marked (RC=4) You tried to mark a block in an empty file.

Error 71: Macro not found (RC=-1) You issued a MACRO com mand, but the macro you spec ifie d could not be located.

Error 74: Prefix area contains pending commands (RC=8) KEDIT cannot proces s the SORT com mand when there are pending pre fix com mands.

Error 75: Too many sort fields - maximum is 50 (RC=95) You issued a SORT com mand, but spec ifie d more than the maxi m um of fifty sort fields.

Error 76: Fileid already in ring (RC=4) You used SET FILEID or a sim ilar com mand to change the fileid of the current file, but the new fileid is the same as the fileid of some other file in the ring.

Error Messages 415 Error 77: Command or feature unavailable in KEDIT demo version (RC=5) You are using the demo version of KEDIT, and the com mand that you issued or fea ture that you attempted to use is avail able only in the produc ti on version of KEDIT.

Error 78: HIT queue full (RC=95) The HIT queue is full, and no more macros can be queued up by the HIT com mand until KEDIT proces ses some of the macros already in the queue. The HIT queue can have up to twelve entries.

Error 79: Invalid .KML file header line (RC=97) KEDIT tried to load a .KML file, but the file began with somethi ng other than a com - ment or a .KML-form at macro defi ni ti on.

Error 80: Operation interrupted by Ctrl+Break or Alt+Ctrl+Shift (RC=96) You pressed Ctrl+Break or Alt+Ctrl+Shift while a command was active.

Error 84: Invalid macro name (RC=97) The length of the name of a macro exceeds the allowable maxi m um of 40.

Error 85: Files in ring would exceed maximum of 500 (RC=95) You tried to add a new file to the ring, but the maxi m um allowable num ber of files is already in the ring.

Error 86: Unexpected null character encountered (RC=5) Null char acters (char acter code 0) can not appear in the text of macros, and are valid only in certai n context s within com mand strings that KEDIT proces ses.

Error 87: Cursor line not in scope (RC=2) Many KEDIT com mands are invalid if issued from a macro when SCOPE DISPLA Y is in effect and the cursor is on a shadow line.

Error 88: Macro has multi-line definition (RC=95) You issued the MODIFY MACRO com mand for a macro with a multi-line defi ni ti on, but MODIFY MACRO requires that the macro to be modi fie d have a one-line defi ni - tion. You can instead use the QUERY MACRO com mand to see the defi ni ti on of the macro, or you can use the MACROS com mand to have the macro defi ni ti on put into a file.

Error 89: Invalid column target (RC=5)

Error 90: Internal KEDIT stack full (RC=95) A com mand could not exe cute properl y because KEDIT ran out of room on its internal stack. This can happen if you are nesting your macros more deeply than KEDIT can han dle. (That is, one macro calls another, which calls another, etc.)

416 Chapter 9. Error Messages and Return Codes Error 91: Memory shortage - ISA memory full (RC=94) A com mand could not exe cute properl y because KEDIT ran short of mem ory and all

avail able sys tem mem ory was already allo cated to it. To free up some space, you may s e

need to remove some files from the ring by using File Close, or you may need to close g a

some other applica tions. This error mes sage usu ally indicates that the sys tem swap file, s s

or the disk on which it is located, is nearly full. e M

Error 92: Command too long (RC=95) r o r

The maxi m um allowable length for a KEDIT com mand is equal to the value of the r

WIDTH initial iza tion option; a macro tried to issue a command that is lon ger than this. E

Error 93: Invalid variable reference (RC=98) An instruc tion of a KEXX macro that used a variable ref er ence (the name of a vari able in parenthe ses) did not have a right parenthe sis as the first token after the vari able name.

Error 94: Arithmetic overflow/underflow (RC=98) An arith metic expres sion in a KEXX macro yielded an extremely large or small result. This error is most often caused by an attempt to divide by zero.

Error 95: Invalid data on end of clause (RC=98) Unexpect ed text was found at the end of a clause in a KEXX macro. You may have for - got ten a semi co lon.

Error 96: Invalid expression (RC=98) An invalid expres sion was encounter ed in a KEXX macro. One possi ble cause of this error is a macro that issues a KEDIT com mand involving spe cial charac ter s, but does not have quotes around the com mand.

Error 97: Invalid hexadecimal or binary string (RC=98) An invalid hexa dec i m al or binary string was encounter ed in a KEXX macro. Exam ples of valid hexa dec i m al strings are '124f'X and 'FE 03'X. Exam ples of valid binary strings are '10101111'b and '1100 0011'B.

This error is most often encounter ed when you aren't even intending to use a hexa dec i - mal or binary string, but are instead intending to concat enate a norm al charac ter string with the value of a vari able named B or X. For example,

val = 'something'b is inter preted by KEXX as an invalid attempt to spec ify a binary string and not, as you proba bly intended, an attempt to concat enate the string "somethi ng" and the value of the vari able B.

Unlike all other variables, the vari ables B and X can not be spec ified immedi ately after a string to cause implicit concat ena ti on; with B and X, you instead need to use explicit con cat e na tion, for example

val = 'some thing' || b

Error Messages 417 Error 98: Invalid variable name (RC=98) An invalid vari able name was encoun tered in a KEXX macro.

Error 99: Invalid whole number (RC=98) In certai n context s, KEXX requires whole num bers (num bers that can be expressed within the current NUMERIC DIGITS setti ng without using a dec im al point or expo - nenti al notati on). For exam ple, 2**3.1 is invalid, because KEXX can raise num bers only to whole-num ber powers, and DO loop control vari ables must be whole numbers.

Error 100: Control stack full (RC=98) DO, SELECT, and IF—THEN—ELSE construc ts are being nested too deeply within the cur rently-active KEXX macros.

Error 101: Logical value not zero or one (RC=98) The only accept able operands for logi cal opera tors such as & and | in KEXX macros are 0 and 1.

Error 102: Not numeric value (RC=98) An operand of an arithm eti c opera tor in a KEXX expression could not be convert ed to a numeric value.

Error 103: Symbol expected (RC=98) A clause with invalid syntax has been encounter ed in a KEXX macro.

Error 104: THEN expected (RC=98) An IF instruc tion in a KEXX macro was not fol lowed by a THEN clause.

Error 105: Invalid expression result (RC=98) An expres sion result is not valid for the context in which the expres sion was evalu ate d. For exam ple, the value spec ified for NUMERIC DIGITS or NUMERIC FUZZ was non-numeric or not in the allowable range. (The maxi m um allowable value for NUMERIC DIGITS is 1000, and NUMERIC DIGITS must always be larger than NUMERIC FUZZ).

Error 106: Unbalanced parentheses (RC=98) An expres sion with unbal anced parenthe ses has been encounter ed in a KEXX macro.

Error 107: Unexpected or unmatched END (RC=98) A KEXX macro has an END that does not term inate a DO instruc tion, or a DO instruc - tion not term inate d by an END.

Error 108: Unexpected THEN or ELSE (RC=98) THEN or ELSE was encounter ed in a KEXX macro out side of the context of an IF clause.

418 Chapter 9. Error Messages and Return Codes Error 109: Unmatched ‘‘/*’’ or quote (RC=98) An unmatched com ment, single quote, or double quote was encounter ed in a KEXX

macro. You may have tried to use a com ment or quoted string spanning more than one s e

line of a macro, which KEXX does not allow. g a s s Error 110: Maximum KEXX expression result length exceeded (RC=98) e M

The length of an expression result, or of an inter medi ate result used in the calcu la ti on of r o

an expression result, exceeded KEXX’s limit. The limit is equal to the current WIDTH r r

value plus 100. E

Error 111: Incorrect call to routine (RC=98) A functi on call in a KEXX macro speci fie d too many or too few argum ents, or one of the argum ents spec ifie d was invalid for the functi on involved.

Error 112: Routine not found (RC=98) A functi on or subrou ti ne called from a KEXX macro could not be located. KEXX looks for internal routi nes, built-in func tions, implied EXTRACT functi ons, Boolean func - tions, and exter nal routi nes.

Error 113: Macro interrupted by Ctrl+Break or Alt+Ctrl+Shift (RC=98) Ctrl+Break or Alt+Ctrl+Shift inter rupted exe cu tion of a KEXX macro.

Error 114: Interpretation error (RC=98) An internal proces sing error was encounter ed during exe cuti on of a KEXX macro.

Error 115: Invalid LEAVE or ITERATE (RC=98) A KEXX macro contai ns a LEAVE or ITERA TE instruc tion outside of an iter ati ve DO loop.

Error 116: Invalid DO syntax (RC=98) A KEXX macro contai ns an invalid DO instructi on, for exam ple one which has two TO expres sions.

Error 118: Unsupported REXX feature (RC=98) A REXX fea ture that is not imple mented in KEXX was used in a KEXX macro.

Error 119: Invalid TRACE request (RC=98)

Error 120: Invalid sub-keyword found (RC=98) A KEXX macro used an invalid sub-key word within a keyword instructi on. For exam - ple, a PARSE instructi on may have incorrect ly spec ifie d the origin of the string to be parsed.

Error 121: Invalid PARSE template (RC=98)

Error Messages 419 Error 122: Function did not return result (RC=98) A KEXX macro invoked an inter nal routi ne as a functi on, but the functi on did not return a result.

Error 123: Invalid label (RC=98) Labels in KEXX macros that do not appear as the first token on a line are invalid.

Error 124: Unexpected PROCEDURE (RC=98) A PROCE DURE instruc tion was encounter ed that did not fol low a label, as is required in KEXX macros.

Error 125: Uninitialized variable; NOVALUE ON (RC=98) NOVALUE ON is in effect, and your macro attempted to use the value of a vari able to which you had not yet assigned a value. You might have spelled the vari able name wrong, or might have mistak enly used a vari able name instead of a quoted string.

Error 126: Unexpected WHEN or OTHERWISE (RC=98) A WHEN or OTHER WISE instructi on was encounter ed outside of a SELECT con- struct, or improperl y embedded in a DO—END construc t within a SELECT construc t.

Error 127: WHEN or OTHERWISE expected (RC=98) A SELECT construc t was encounter ed that does not contai n any WHEN clauses, or that con tains clauses in a con text where only WHEN and OTH ER WISE clauses are valid. A com mon cause of this error is for getti ng to use DO—END around multi ple clauses asso ciated with a WHEN—THEN construct.

Error 128: Incomplete DO/SELECT/IF (RC=98) A DO or SELECT instructi on without the matching END, or an IF instruc tion without a THEN clause, has been encoun tered.

Error 129: Machine resources exhausted (RC=98) KEXX has run out of mem ory while trying to proces s a macro.

Error 130: Label not found (RC=98) The label spec ifie d by a SIGNAL instructi on, or required to handle a condi ti on like SIGNAL ON NOVALUE, can not be found. Note that labels in KEXX macros can only appear as the first token on a line.

Error 131: Error in called routine (RC=98) A KEXX macro called an exter nal routi ne, but there was an error loading the external routi ne or the external routi ne term inate d with an error.

Error 132: Symbol or string expected (RC=98) Within a KEXX macro, in a context where only a string or sym bol is valid, either the end of a clause was reached or an invalid token was encounter ed.

420 Chapter 9. Error Messages and Return Codes Error 133: INTERPRET string exceeds 1024-character limit (RC=98) You tried to use the INTER PRET instruc tion to inter pret a string that was lon ger than

1024 char ac ters. s e g a s

Error 134: NUMERIC DIGITS must be > FUZZ and <= 1000 (RC = 98) s The maxi m um allowable value for NUMERIC DIGITS is 1000, and NUMERIC - e M

DIGITS must always be larger than NUMERIC FUZZ r o r r Error 135: Memory shortage - cursor field reset E You typed some text into the com mand line, the prefix area, or a line of your file, but when KEDIT tried to proces s the change, it did not have enough available mem ory to do so. The content s of the field you changed are reset to what they were before your text was entered.

Error 136: The file is already locked (RC=5) You tried to use the LOCK com mand for a file that is already locked.

Error 138: Unexpected file timestamp change - use FFILE/SSAVE (RC=3) You issued a FILE or SAVE com mand, but TIMECHECK ON is in effect and the file’s timestamp has changed since you began editing the file or last saved it. This occurs when some other program , running either on your own com puter or on another com - puter on your network, changes the file while you are edit ing it. If you are sure that you still want to replace the file, use an FFILE or SSAVE comm and instead.

Error 141: Read-only file (RC=12) You tried to write to a file that is marked on disk as read-only.

Error 143: Network access error (RC=100) A sys tem functi on used by KEDIT failed due to a network-rel ated error.

Error 144: Nothing to UNDO (RC=4) You issued the UNDO com mand but there was nothing to undo. You may not have made any changes to your file, you may have already used UNDO to undo all changes to your file, UNDOING OFF may be in effect, or KEDIT may have discarded undo infor ma tion due to mem ory lim i ta tions.

Error 145: Nothing to REDO (RC=4) You issued the REDO com mand but there was nothing to redo. The REDO com mand is valid only after an UNDO com mand, and only when no undoable com mands have been issued since the corre spond ing UNDO com mand.

Error 146: Out of memory - UNDO or REDO incompletely processed (RC=94) KEDIT ran out of mem ory in the middle of proces sing an UNDO or REDO com mand. Some porti on of the undo or redo may have been carrie d out.

Error Messages 421 Error 147: Out of memory - couldn’t process UNDO or REDO (RC=4) KEDIT ran out of mem ory in the middle of proces sing an UNDO or REDO com mand. The undo or redo was not carrie d out.

Error 148: Demo version save operations limited to n-line files (RC=5) You are using the demo version of KEDIT and have attempted to save a file with more lines in it than the demo version allows. Note that the produc ti on version of KEDIT does not limit the size of the files that you can save.

Error 150: Invalid KEDIT module (RC=99)

Error 151: System error code n (RC=99) An operat ing system functi on called by KEDIT unexpect edly returned with error code n.

Error 152: Macro not currently in storage (RC=3) You issued a com mand like MACROS or QUERY MACRO and speci fie d a macro name, but there is no current ly defined in-mem ory macro with that name.

Error 154: JOIN would cause truncation (RC=4) You are using the JOIN com mand to join two lines together, but the result ing text would extend beyond the trunca ti on colum n. To avoid truncat ing your data, KEDIT cancel s the join opera ti on.

Error 155: JOIN would involve excluded line (RC=4) You are using the JOIN com mand to join two lines together, but the second of the two lines is an excluded line that KEDIT cannot oper ate on.

Error 156: Command line unavailable (RC=1) You tried to move the cursor to the com mand line but SET CMDLINE OFF is in effect.

Error 161: Out of system resources (RC=94) KEDIT cannot com plete a com mand because the supply of some system resource has been exhausted. Windows may be out of mem ory, or the data areas that Windows uses to keep track of fonts, windows, bitmaps, etc. may be full. To free up resources, you may need to remove some files from the ring by using File Close, or you may need to close some other applica ti ons.

Error 164: Cannot merge overlapping areas (RC=1) You tried to use the MERGE com mand to merge together two groups of lines, but the MERGE com mand failed because the two groups of lines overlappe d.

Error 165: Invalid use of colon in regular expression (RC=5) You used a colon in a regu lar expres sion, but did not fol low it with the letter that identifies one of the prede fine d regu lar expres sions. If you do not want to use a predefined expression, but instead want the colon to be taken liter all y, precede it with the reg u lar expres sion escape char acter , which is a backslash.

422 Chapter 9. Error Messages and Return Codes Error 166: Unknown predefined string specified in regular expression (RC=5) You used a colon in a regu lar expres sion, but the charac ter that follows it does not iden-

tify one of the prede fine d regu lar expres sions. If you do not want to use a prede fine d s e

expres sion, but instead want the colon to be taken liter all y, precede it with the regu lar g a

expres sion escape char acter , which is a backslash. s s e M

Error 167: Invalid escape sequence in regular expression (RC=5) r o

Your regu lar expres sion used a backsla sh, which introduces an escape sequence, but r r

either the escape sequence was invalid (for exam ple, \x fol lowed by an invalid hexa - E dec im al value), or the escape sequence was missing (the back slash was the last char ac - ter in the regu lar expres sion). If you are using a backsla sh in a regu lar expres sion and want to have it taken liter ally, you must actu ally use two backslashes.

Error 168: Unbalanced parenthesis in regular expression (RC=5) Your regu lar expres sion contai ns an unbalance d parenthe sis . If you are using a paren - thesis in a regu lar expres sion and want to have it taken liter all y, you must pre cede it with the reg u lar expres sion escape char acter , which is a backslash.

Error 169: Unbalanced brace in regular expression (RC=5) Your regu lar expres sion contai ns an unbalance d brace charac ter . If you are using a brace in a regu lar expres sion and want to have it taken liter all y, you must pre cede it with the reg u lar expres sion escape char acter , which is a backslash.

Error 170: Power specified in regular expression exceeds maximum of 255 (RC=5) You used the power opera tor (a caret, ‘‘^’’) in a regu lar expres sion, but the power you spec ifie d exceeds the limit of 255.

Error 171: Infinite closure loop in regular expression (RC=5) You have spec ified a reg u lar expres sion that can never be suc cess fully matched. For example, ‘‘(a*)@’’ matches as many occur rences as pos sible of zero or more ‘‘a’’s, which amounts to matching zero ‘‘a’’s an infinit e num ber of times.

Error 172: Invalid class specification in regular expression (RC=5) Your reg u lar expres sion con tains an invalid char ac ter class spec i fi ca tion. For exam ple, the class may have an opening left bracket but no clos ing right bracket, or it may have an incom plete range spec ifi ca ti on. If you are using a bracket in a regu lar expres sion and want to have it taken lit erall y, you must pre cede it with the regu lar expres sion escape char acter , which is a backslash.

Error 173: Invalid regular expression (RC=5)

Error 174: Too many tags in regular expression (RC=5) Your regu lar expres sion contai ns more than the limit of nine tags, which begin with left braces (‘‘{’’) and end with right braces (‘‘}’’). If you are using a brace in a reg u lar expres sion and want to have it taken liter all y, you must pre cede it with the regu lar expres sion escape char acter , which is a backslash.

Error Messages 423 Error 175: Illegal tag specification in regular expression (RC=5) Your regu lar expres sion contai ns an invalid tag speci fi ca ti on. If you are using a brace in a regu lar expres sion and want to have it taken liter all y, you must pre cede it with the reg- u lar expres sion escape char acter , which is a backslash.

Error 176: Incorrect tag reference in regular expression (RC=5) You used an ampersand (‘‘&’’) in a regu lar expres sion. An ampersand signals a refer - ence to a tagged expression, and must be followed by a digit indicat ing which tagged expres sion is involved, but the digit was miss ing in your regu lar expres sion. If you are using an ampersand in a regu lar expres sion and want to have it taken liter all y, you must pre cede it with the reg u lar expres sion escape char acter , which is a backslash.

Error 179: Invalid use of cursor position operator (RC=5) You used the cursor posi tion opera tor (‘‘\c’’) in an invalid way within a regu lar expres - sion. For exam ple, it was immedi ate ly precede d by the not opera tor (‘‘~’’), or immedi - ately followed by a closure operator.

Error 180: Unsupported closure or power subexpression in regular expression (RC=5) KEDIT’s reg u lar expres sion pro ces sor can not han dle expres sions involv ing clo sure or power opera tors applied to closure or power opera tors. For exam ple, KEDIT cannot han dle this reg u lar expres sion: ‘‘(x+)+’’.

Error 186: Error accessing clipboard (RC=99) KEDIT got an unexpect ed error when it attempted to access the system clipboard.

Error 187: No text in clipboard (RC=2) An attempt to Paste text into KEDIT from the clip board failed because there was no text in the clipboard.

Error 188: Command not available in this version of KEDIT (RC=-1) You have issued a com mand that is valid in some versions of KEDIT but is not sup - ported in this version of KEDIT.

Error 189: KEDIT Help file not found: KEDITW.CHM (RC=28) Your tried to get access KEDIT's Help system but KEDIT's Help file, KEDITW.CHM, could not be located. This file is nor mally put into KEDIT's program directory by the KEDIT installa ti on pro gram. KEDIT looks for this file in the directory from which the KEDIT for Windows program file, KEDITW32.EXE, was loaded, and in C:\Program Files\KEDITW.

Error 190: String contains all possible delimiters (RC=5) Some of KEDIT’s dia log boxes, such as Edit Find and Edit Replace, work by inter nally issuing com mands like LOCATE and CHANGE to search for strings. The strings passed to LOCATE and CHANGE must be delim ited, and KEDIT issues this error mes sage in the very rare sit u ation where no valid delimit ers are available because the strings it is work ing with con tain every valid delimiter character.

424 Chapter 9. Error Messages and Return Codes Error 191: Drive/directory specifiers not allowed in OPENFILTER (RC=5) The fileids passed to SET OPENFILTER must consis t of file names and extensions ,

possi bly including wildcard charac ter s, and they cannot include drive or directory s e

speci fi ers. g a s s Error 192: Button not defined via SET TOOLBUTTON (RC=5) e M

You have issued a SET TOOLSET com mand that speci fie s a toolbar button that has not r o

yet been defined via SET TOOLBUTTON. r r E Error 193: Error creating bitmap (RC=99) You have issued a SET TOOLBUTTON com mand that speci fie s a bitmap file on disk, but KEDIT encounter ed an error convert ing the bitmap into Windows’ internal bitmap form at. This most often occurs when the data in the bitmap file is not in the proper Win- dows bitmap format.

Error 194: Error loading bitmap (RC=99) You have issued a SET TOOLBUTTON com mand that speci fie s a bitmap file on disk, but KEDIT encounter ed an error accessing the bitmap file or loading it into mem ory. This most often occurs when the data in the bitmap file is not in the proper form at.

Error 195: Bitmap too wide or tall (RC=95) You have issued a SET TOOLBUTTON com mand that speci fie s a bitmap file on disk, but the bitmap involved exceeds KEDIT’s lim its of 100 pixels high by 100 pixels wide.

Error 196: Invalid placement of Quick Find toolbar item (RC=5) You have issued a SET TOOLSET com mand that refers incorrect ly to the Quick Find toolbar item. Quick Find can only go on the top toolbar, and not on the bot tom toolbar, and can only appear once on a toolbar, and not multi ple times.

Error 197: TOOLBUTTON definition exceeds 400 character limit (RC=95) The total length of the operands for the SET TOOLBUTTON com mand cannot exceed 400 char ac ters.

Error 198: Multi-line clipboard text cannot be pasted to command line (RC=2) You have attempted to Paste text from the clipboard to the com mand line. KEDIT allows this when the clipboard contai ns a single line of text, but not when the clipboard con tains mul tiple lines of text. Mul tiple lines of text can be pasted into your file, but not to the com mand line. To Paste text into your file, you must positi on the cursor in the file area at the loca tion where you want the pasted text to be inserted.

Error 199: Parser not defined: name (RC=5) The parser referred to in a SET AUTOCOLOR or SET COLOR ING com mand has not been pre viously defined via a SET PARSER com mand.

Error 200: Too many items in target - maximum is 50 (RC=5) You are trying to use and (‘‘&‘‘) and or (‘‘|’’) to com bine more than the limit of fifty tar - gets together.

Error Messages 425 Error 201: SET SCREEN unavailable in One-File-Per-Window mode; try Window Arrange (RC=2) You are in One-File-Per-Window mode, with the default of OFPW ON in effect, and you tried to use the SET SCREEN com mand. SET SCREEN is supporte d in KEDIT for Windows for com pati bil ity with text mode KEDIT, and is avail able only when OFPW OFF is in effect. With One-File-Per-Window mode, KEDIT’s window handli ng is much more like that of other Windows applica ti ons, and because of this we recom mend One-File-Per-Window mode for most users, even though it pre cludes use of the SET SCREEN com mand. One alterna ti ve for arranging your docu m ent windows is to use the Window Arrange dialog box. For more inform ati on, see the descripti ons of SET OFPW and of SET SCREEN.

Error 202: Operand invalid with INTERFACE CLASSIC (RC=5) INTER FACE CLASSIC is in effect, and you used a com mand operand that is only valid with INTER FACE CUA. For example, since selec tions are avail able only with INTERFACE CUA, the SELECTION operand of the MARK com mand is invalid with INTER FACE CLASSIC.

Error 204: FILE/SAVE of UNTITLED file requires fileid (RC=5) You cannot save an UNTITLED file (edited via File New or by starting KEDIT with no fileid speci fie d on the com mand line) without assigning it a perm anent name. Either use the SET FILEID com mand to assign a name, or specify a name for the file on your FILE or SAVE command.

Error 205: DOS command is too long (RC=99) The length of a DOS com mand that you are trying to execute exceeds the limit. The com mand line that KEDIT passes to DOS can be up to 4096 charac ter s long, but because of cer tain parame ters that KEDIT itself must include on this com mand line, the practi cal limit for the length of your DOS com mand is typi cal ly closer to 4000 characters.

Error 206: REXX macro invoked; this version of KEDIT supports only KEXX (RC=99) You tried to run a REXX macro but KEDIT for Windows only supports KEXX macros. A REXX macro is any KEDIT macro that begins with a REXX-style (‘‘/* ... */’’) com - ment; KEXX macros cannot begin with REXX-style com ments.

Error 207: REXX not available; this version of KEDIT supports only KEXX (RC=99) You tried to use the QUERY REXXVERSION com mand to deter mine the version of REXX installed on your sys tem, but KEDIT for Windows only supports KEXX mac ros.

Error 208: TOOLSET definition exceeds 400 character or 50 item limit (RC=95) The total length of the operands for the SET TOOLSET com mand cannot exceed 400 charac ter s, and the total num ber of items in a toolset, including periods used to indi cate spac ing, cannot exceed 50.

426 Chapter 9. Error Messages and Return Codes Error 209: Error updating registry (RC=99) KEDIT encounter ed an unexpect ed error while updat ing the Windows regis try during

the proces sing of a REGUTIL com mand or of Options Save Setti ngs. s e g a

Error 210: Option is not one of the SET options kept in the registry (RC=5) s s

You issued the REGUTIL SAVE SET TING com mand, but spec ifie d a SET option that e M

KEDIT does not maintai n in the Windows regis try . If you want to put a new value for r

the option into effect for every KEDIT session, you can place the SET com mand o r

involved in your profile. r E Error 211: Unable to create the special file fileid (RC=4) You issued a REGUTIL com mand that adds a tem porary file to the ring to hold infor- mati on from KEDIT's sec tion of the Windows regis try , but KEDIT encounter ed an unex pected error when it tried to cre ate the file.

Error 212: SET option unavailable in this version of KEDIT (RC=5) You issued a SET com mand for an option that is valid in earli er text mode versions of KEDIT but that is not avail able in KEDIT for Windows.

Error 213: QUERY option unavailable in this version of KEDIT (RC=5) You issued a QUERY com mand for an option that is valid in earli er text mode versions of KEDIT but that is not avail able in KEDIT for Windows.

Error 214: MODIFY option unavailable in this version of KEDIT (RC=5) You issued a MODIFY com mand for an option that is valid in earli er text mode ver- sions of KEDIT but that is not avail able in KEDIT for Windows.

Error 215: WINEXEC failed with system error code n (RC=99) You issued the WINEXEC com mand, but when KEDIT used the WinExec functi on to pass your com mand to Windows, system error code n was returned. The most com mon error codes are 2, which means that Windows could not find the file that you spec ifie d, and 3, which means that you speci fie d a directory path for the file, and Windows could not find that directory.

Error 216: .KLD error - info (RC=97) An error in a KEDIT Language Defi ni ti on file was encounter ed while proces sing a SET PARSER com mand.

Error 218: Built-in file not found: fileid (RC=28) A SET PARSER com mand used an aster isk in front of a fileid, but the KEDIT Lan- guage Def ini tion file referred to is not built into KEDIT.

Error 219: NULL parser cannot be redefined (RC=5) You tried to use a SET PARSER com mand to redefine the NULL parser, but the NULL parser is a specia l do-nothing parser that cannot be redefine d.

Error Messages 427 Error 221: Bad network name or path: fileid (RC=28) You used a UNC (Uni versal Nam ing Conven ti on) name that is invalid or refers to a net- work resource that is not accessi ble to your machine.

Error 222: Internal control stack full (RC=95) MACRO com mands or calls by macros to exter nal routi nes are being nested too deeply.

Error 223: Invalid DEFBUTTON value (RC=5) You issued a DIALOG or ALERT com mand speci fy ing a DEFBUTTON value that exceeds the num ber of but tons in the dialog box.

Error 224: Another process has exclusive access to fileid (RC=12) Another program has exclusive access to the speci fie d file. The other program could be another applica ti on running on your com puter, or it might be running on another com - puter on your network.

Error 225: File not locked (RC=5) You tried to use the UNLOCK com mand for a file that is not locked.

Error 227: QUICKFIND longer than 120-character limit (RC=9) You issued the SET QUICKFIND com mand, but the string that you speci fie d is longer than the maxi m um of 120 charac ter s.

Error 228: Invalid network password specified (RC=100) KEDIT is unable to access a file because a pass word is required to access the computer on which the file resides, but Windows does not have the correct password.

Error 229: Error creating printer device context (RC = 99) KEDIT got an unexpect ed error while trying to com muni cat e with the Windows print - ing sub sys tem.

Error 230: Printer margins exceed printable area (RC = 99) The printer mar gins (control led via the Mar gins... button in the File Print dialog box) that are in effect, or that you are trying to put into effect, are too large for the current ly active Windows printer and paper size.

Error 231: File already exists: fileid (RC = 99) You are trying to rename a file, but a file with the same name as the new filename involved already exists.

428 Chapter 9. Error Messages and Return Codes Error 232: PATH or MACROPATH setting exceeds 1000-character limit (RC = 95) The values speci fie d with SET PATH and SET MACROPATH have a 1000-charac ter

limit. s e g a s

Error 233: Command cannot have fewer ARCHAR chars on left than right (RC = 5) s e

CHANGE and SCHANGE comm ands that use ARBCHAR char acters must use at least M

as many ARBCHAR char ac ters in the left string as in the right string. r o r r E Error 234: Manual not found in KEDIT program directory: fileid (RC = 28) You tried to view the KEDIT User’s Guide or Refer ence Manual, but the PDF files involved could not be found in the KEDIT for Windows program directory .

Error 235: Error accessing PDF viewer for fileid (RC = 28) You tried to view the KEDIT User's Guide or Refer ence Manual, which are in PDF for- mat, but either there is no PDF viewer, such as Adobe Reader, installed on your sys tem, or KEDIT was not able to access it.

9.2 Return Codes

Every KEDIT com mand sets a return code that you can test in a macro to obtain infor- mation about the suc cess or failure of the comm and. The spe cial macro vari able RC is auto mati cally set equal to the value of the return code after a com mand com pletes. (KEDIT keeps sepa rat e track of the return code of the last com mand issued from the comm and line, which can be accessed via EXTRACT /LASTRC/.)

KEDIT comm ands set a return code of 0 if they exe cute suc cess fully, and set a non zero return code if an error is encounter ed. There is, however , one important excepti on to this. A return code of 1 from any com mand except the CUR SOR com mand is not an indi cati on of an error, but an indi cati on that the com mand encounter ed the top-of-file or end-of-file line dur ing its proces sing or, for com mands like LOCATE or FOR WARD, left you positi oned at the top-of-file or end-of-file.

Mac ros can use the EXIT instructi on to set their own return codes; the norm al return code from macros is 0.

Here is a sum mary of the return codes given with KEDIT com mands. Where possi ble, these return codes are modele d after those that XEDIT would return in a sim ilar sit ua - tion. Unfortu nate ly, XEDIT does not follow a com pletely consis tent patter n, so the fol - lowing list is only approxi m ate. The specif ic return codes set in connec ti on with each KEDIT error message are given in the preceding section.

0 Com mand com pleted suc cess fully. 1 Top-of-file or end-of-file encoun ter ed (not an error). 2 String or tar get not found. 3 Lines truncat ed by com mand.

Return Codes 429 4 A com mand unex pect edly had no ef fect. (For exam ple, a CHANGE com - mand found no occur rence s of a string to change.) 5 An in valid com mand op er and was en coun tered. 6 A com mand was issued from a profil e after an error was encoun ter ed load - ing the file involved, or a com mand is valid only when there are files in the ring but was issued from a macro when the ring was empty. Com mands that get a return code of 6 are other wise ignored, and in most cases no error mes sage is given. 8 There were pending pre fix com mands when you issued a com mand that cannot oper ate when prefix com mands are pending. 12 The oper at ing system denied acces s to some file, or you tried to QUIT from a mod i fied file. 13 A disk full situ a ti on occurred. 20 In valid fileid. 24 Invali d drive specifier. 28 File or path not found. 94 KEDIT did not have enough mem ory to proces s a com mand. 95 Some inter nal KEDIT limit has been ex ceeded. 96 Exe cu ti on of a com mand was inter rupted by Ctrl+Break or Alt+Ctrl+Shift. 97 KEDIT was unable to load or define a request ed macro. 98 A macro language-re lated error occurred dur ing the proces sing of a macro. 99 KEDIT en coun tered an er ror in ac cess ing some sys tem fa cility . 100 KEDIT en coun tered an In put/Out put er ror. -1 You asked KEDIT to exe cute a com mand or macro that could not be lo- cated. -3 A com mand was issued from an envi ron m ent that is inap pro pri ate for that com mand. (For exam ple, the EXTRAC T com mand was issued from the com mand line.)

430 Chapter 9. Error Messages and Return Codes Index

! built-in func tion 354 & command 148 AR ROW QUERY and EX TRACT option 287 = SET option 158 QUERY and EX TRACT option 328 SET option 283 ASCII macro 116, 394 command 150 AT TRIB UTES ? command 149 QUERY and EX TRACT option 287 SET option 153 A AUS files 161 AUTOCOLOR ABBREV QUERY and EX TRACT option 288 built-in func tion 352 SET option 158 ABS built-in func tion 352 AUTOEXIT QUERY and EX TRACT option 289 ADD command 26 SET option 160 ADDLINE AUTOINDENT SOS action 133 QUERY and EX TRACT option 289 AF TER() SET option 160 Boolean func tion 377 AUTOSAVE ALARM QUERY and EX TRACT option 289 SOS action 133 SET option 161 ALERT command 26 re set al ter ation count 154 ALL command 27 AUTOSCROLL ALT QUERY and EX TRACT option 289 QUERY and EX TRACT option 287 SET option 162 SET option 154 Add ing lines ALT() SEE ’’In sert ing text’’ Boolean func tion 377 Alter ation count 154 AL TER com mand 28 SEE ALSO ‘‘AUTOSAVE’’ ALTKEY() Boolean func tion 378 Ap pend CLIPBOARD command 39 ANSI fonts SEE ‘‘Char ac ter set han dling’’ Ar gu ments, pass ing to mac ros ANSIDATATYPE ARG KEXX instruc tion 339 built-in func tion 352 ARG built-in func tion 354 PARSE KEXX instruc tion 345 ANSILOWER passing to pro file 22 built-in func tion 353 Array s ANSITOOEM SEE ‘‘Compound vari ables’’ built-in func tion 353 command 29 Assign ments, KEXX 333 ANSIUPPER B built-in func tion 354 ARBCHAR B2X QUERY and EX TRACT option 287 built-in func tion 355 SET option 155 BACKUP ARG QUERY and EX TRACT option 289 KEXX instruc tion 339 SET option 163

431 BACKW ARD command 30 Boolean func tions 377 BAK files 163 Bound ary mark ers BEEP SET BOUNDMARK option 165 QUERY and EX TRACT op tion 289 SET COLMARK option 169 SET MOUSEBEEP op tion 224 SET WINMARGIN option 279 SET op tion 164 Built-in func tions 351 SOS action 133 But tons built-in func tion 355 de fin ing 267 BE FORE() Boolean func tion 378 C BITAND C2D built-in func tion 355 built-in func tion 358 BITOR C2X built-in func tion 355 built-in func tion 358 BITXOR CALL built-in func tion 355 KEXX instruc tion 339, 387 BLANK() CANCEL command 31 Boolean func tion 378 CAPPEND com mand 31 BLANKDOWN CASE SOS action 133 QUERY and EX TRACT option 290 BLANKUP SET option 166 SOS action 133 CDELETE com mand 32 BLOCK CDN QUERY and EX TRACT option 290 SOS action 134 BLOCK() CEN TER Boolean func tion 378 built-in func tion 356 BLOCKEND command 33 SOS action 133 CEN TRE BLOCKSTART built-in func tion 356 SOS action 133 CFIRST command 34 BOT TOM command 31 CHANGE BOTTOMEDGE command 34 SOS action 134 ef fect of ARBCHAR on 156 BOTTOMEDGE() ef fect of ZONE on 282 Boolean func tion 378 re peat ing last CHANGE command 36 BOUNDMARK CHANGESTR QUERY and EX TRACT option 290 built-in func tion 356 SET option 165 CHARIN BUTTON1() built-in func tion 356 Boolean func tion 378 CHAROUT BUTTON2() built-in func tion 356 Boolean func tion 378 CHARS Back ing up files built-in func tion 357 SET AUTOSAVE op tion 161 CHDIR command 36 SET BACKUP 163 CHDRIVE command 36 SEE ALSO ‘‘SAVE’’ CHECK Blanks SOS action 134 trail ing 218, 274 CINSERT command 38 Blocks CLAS SIC in ter face SET MARKSTYLE option 222 SEE ’’In ter face set tings’’ marking 97 CLAS SIC() unmarking 123 Boolean func tion 378

432 CLAST command 34 CTRL() CLEFT Boolean func tion 378 SOS action 134 CUA in ter face CLICK SEE ’’In ter face set tings‘‘ QUERY and EX TRACT option 290 CUA() CLIP BOARD Boolean func tion 378 QUERY and EX TRACT option 291 CUP CLIPBOARD command 39 SOS action 134 CLIPTEXT() CURLINE Boolean func tion 378 QUERY and EX TRACT option 293 CLOCATE SET option 175 command 40 CURRBOX ex am ples 41 QUERY and EX TRACT option 294 used with CINSERT 38 SET option 176 CLOCK CUR RENT QUERY and EX TRACT option 292 SOS action 134 SET option 168 CUR RENT() CMATCH command 41 Boolean func tion 378 CMDLINE CUR SOR QUERY and EX TRACT option 292 QUERY and EX TRACT option 294 SET option 168 command 49 CMDSEL() CURSORADJUST Boolean func tion 378 SOS action 134 CMSG command 43 CURSORSIZE COLMARK QUERY and EX TRACT option 294 QUERY and EX TRACT option 292 SET option 177 SET option 169 CURSORTYPE COLOR QUERY and EX TRACT option 294 QUERY and EX TRACT option 292 SET option 178 SET option 170 Case con ver sion COL OR ING ANSILOWER built-in func tion 353 QUERY and EX TRACT option 293 ANSIUPPER built-in func tion 354 SET option 172 SET IN TER NA TIONAL op tion 211 COL UMN to low ercase 93 QUERY and EX TRACT option 293 to up per case 144 ini tial iza tion op tion 16 Chang ing text COM MAND com mand 43 AL TER com mand 28 COM MAND() CAPPEND com mand 31 Boolean func tion 378 CDELETE com mand 32 COM PARE CHANGE command 34 built-in func tion 357 CINSERT command 38 COMPRESS command 44 COVERLAY command 47 CREPLACE command 48 CON DI TION OVERLA Y command 106 built-in func tion 357 RE PLACE command 123 COP IES SCHANGE command 128 built-in func tion 358 charac ter codes 28 COPY command 45 over lay ing col umns 47 COUNT command 46 re cov er ing from 117 COUNTSTR selec tive change 128 built-in func tion 358 shift ing 129 COVERLAY command 47 to low ercase 93 CREPLACE command 48 to up per case 144 CRIGHT Char ac ter codes SOS action 134 con vert ing from dec i mal 364

433 con vert ing to dec i mal 358 SET INITIALDIR option 201 display ing 77, 197 Cur rent line spec i fy ing 28, 197 box around 176 Char ac ter set han dling lo ca tion in win dow 175 ANSITOOEM built-in func tion 353 Cur sor ANSITOOEM command 29 ex tract ing po si tion 299 OEMTOANSI built-in func tion 367 shape 177 - 178 OEMTOANSI com mand 106 Cus tom iz ing KEDIT SET IN TER NA TIONAL op tion 211 SEE ‘‘SET command ’’ SET TRANSLATEIN option 275 SEE ‘‘WINPROF.KEX’’ SET TRANSLATEOUT option 275 SEE ‘‘reg is try’’ Color han dling Cut and paste SET COLOR option 170 CLIPBOARD command 39 SET COLOR ING option 172 SET ECOLOR option 186 D SET MONI TOR option 223 SET PCOLOR option 233 D2C Syn tax col or ing 172 built-in func tion 363 Col or ing D2X syn tax col or ing 397 built-in func tion 364 Col umn mark ers DATATYPE SEE ’’Bound ary markers’ ’ built-in func tion 359 Col umn pointer DATE dis play ing 249 built-in func tion 360 moving 40 DATECONV Col umns, work ing with built-in func tion 361 CAPPEND com mand 31 DE BUG command 51 CDELETE com mand 32 DE BUG GING CLOCATE com mand 40 QUERY and EX TRACT option 295 MARK command 97 SET option 179 SET ZONE op tion 282 DEFEXT Com mand his tory QUERY and EX TRACT option 295 SOS RETRIEVEB, SOS RETRIEVEF 136 SET option 179 Com mands DE FINE command 53 & command 148 DEFPROFILE = com mand 150 QUERY and EX TRACT option 295 ? command 149 SET option 180 en ter ing sev eral at one time 150, 216 ini tial iza tion op tion 16 in mac ros 338 DEFSORT last op er and used 214 po sition ing of screen af ter 257 QUERY and EX TRACT option 295 re call ing 149 SET option 181 re nam ing 258 DELBACK re peat ing 121, 148, 150 SOS action 134 Compound vari ables 332 DELBEGIN Con di tion han dling SOS action 134 KEXX facil ity 386 DELCHAR Copy ing text SOS action 134 COPY command 45 DELEND GET command 75 SOS action 134 to a disk file 112 DELETE command 54 Cowlishaw, Mi chael 329, 388 DE LIMIT Cur rent di rec tory built-in func tion 361 CHDIR command 36 DELLINE QUERY and EX TRACT option 295 SOS action 134

434 DELSEL DU PLI CATE com mand 64 SOS action 134 De bug ging mac ros DELSEL() DE BUG command 51 Boolean func tion 379 PROFDEBUG ini tial iza tion op tion 20 DELSTR SET DE BUGGING option 179 built-in func tion 362 SET NOVALUE op tion 227 DELWORD TRACE KEXX in struc tion 348 SOS action 134 Dec i mal codes built-in func tion 362 SEE ‘‘Char ac ter codes’’ DI A LOG com mand 55 De let ing text DIG ITS DELETE command 54 built-in func tion 362 col umn delete 32 de let ing words with Shift+Ctrl+W 280 DIR command 58 Direc tory list ing 15, 58 DIR() ini tial di rec tory 201 Boolean func tion 379 Doc u ment win dow DIRAPPEND com mand 58 SET DOCSIZING option 184 DI REC TORY SET INITIALDOCSIZE option 203 QUERY and EX TRACT option 295 SET OFPW option 228 SEE ALSO ’’Current direc tory’ ’ SET SCREEN option 251 DIRFILEID WINDOW command 145 QUERY and EX TRACT option 296 SEE ALSO ‘‘Frame window’ ’ DIRFORMAT QUERY and EX TRACT option 296 E SET option 182 ECOLOR DIRSORT command 59 QUERY and EX TRACT option 297, 314 DIS PLAY SET option 186 QUERY and EX TRACT option 296 EDITV command 65 SET option 183 EFILEID DMSG command 60 QUERY and EX TRACT option 297 DO-END EMSG command 67 KEXX instruc tion 340 END() DOCSIZING Boolean func tion 379 QUERY and EX TRACT option 297 ENDCHAR SET option 184 SOS action 135 DOPREFIX ENDWORD SOS action 135 SOS action 135 DOS EOF DIR command 58 QUERY and EX TRACT option 298 ERASE sim u la tion 67 EOF() EXIT 61 Boolean func tion 379 command 61 EOFIN DOSDIR QUERY and EX TRACT option 298 built-in func tion 362 SET option 189 DOSENV EOFOUT built-in func tion 363 QUERY and EX TRACT option 298 DOSNOWAIT com mand 61 SET option 189 DOSQUIET command 61 EOL DOWN com mand 63 QUERY and EX TRACT option 298 DRAG EOLIN QUERY and EX TRACT option 297 QUERY and EX TRACT option 298 SET option 185 SET option 190 DROP EOLOUT KEXX instruc tion 342 QUERY and EX TRACT option 299

435 SET option 191 FILL command 71 ERASE command 67 FILLBOX command 71 ERRORBEEP FIND SOS action 135 command 72 ERRORTEXT SEE ALSO ‘‘LOCA TE’’ built-in func tion 364 FINDUP command 72 EX E CUTE FIRST() SOS action 135 Boolean func tion 379 EXIT FIRSTCHAR KEXX instruc tion 342 SOS action 135 re turn ing to KEDIT from DOS 61 FIRSTCOL EX PAND SOS action 135 command 68 FLOW command 73 used with COMPRESS 44 FLSCREEN EX TEND command 68 QUERY and EX TRACT option 301 EX TRACT command 69, 285 FMODE End-of-file char acter 189 QUERY and EX TRACT option 301 En ter ing text SET option 193 SEE ’’In sert ing text‘‘ FNAME QUERY and EX TRACT option 301 En vi ron ment vari able SET option 193 KEDITW 21 FOCUSEOF() Equal buffer 121, 283, 328 Boolean func tion 379 Equalsign FOCUSTOF() SET option de scrip tion 283 Boolean func tion 379 Er ror messages 410 FOCUSWORD Exit code QUERY and EX TRACT option 301 from DOS com mands 62 FOR MAT Ex pres sions, KEXX 333 QUERY and EX TRACT option 302 Ex tended char ac ters SET option 195 SEE ’’In ter na tional sup port’’ built-in func tion 364 FOR WARD command 74 F FPATH FCASE QUERY and EX TRACT option 302 QUERY and EX TRACT option 299 SET option 193 FEXT FRAMESIZE QUERY and EX TRACT option 299 ini tial iza tion op tion 16 SET option 193 FTYPE FFILE command 69 QUERY and EX TRACT option 302 SET option 193 FIELD FULLINP() QUERY and EX TRACT option 299 Boolean func tion 379 FIELDWORD FUP command 72 QUERY and EX TRACT option 299 FUZZ FILE com mand 69 built-in func tion 364 FILEID File locking QUERY and EX TRACT option 300 LOCK command 93 SET option 193 LOCK ini tial iza tion op tion 17 FILELINE() SET LOCKING option 217 Boolean func tion 379 UNLOCK command 143 FILESEARCH Files QUERY and EX TRACT option 300 back ing up 163 FILESTATUS cre at ing 83, 112, 148 QUERY and EX TRACT option 300 de fault ex ten sions 179

436 end-of-file char acter 189 IM ME DI ATE com mand 81 ex ten sion of .AUS 161 IMPMACRO ex ten sion of .BAK 163 QUERY and EX TRACT option 303 ini tial di rec tory 201 SET option 199 line length 218, 245 INBLOCK() lock ing 93 Boolean func tion 379 open ing 83, 229 INISAVE re naming 121, 193 QUERY and EX TRACT option 304, 317 sav ing au to mat i cally 161 SET option 200, 247 search path for 83, 232, 300 INI TIAL() switching between files 83 Boolean func tion 379 tem po rary 112 trail ing blanks in lines 245, 274 INITIALDIR un lock ing 143 QUERY and EX TRACT option 304 Fixed length re cords 218, 245 SET option 201 Frame window INITIALDOCSIZE SET INITIALFRAMESIZE option 204 QUERY and EX TRACT option 304 WINDOW command 145 SET option 203 SEE ALSO ‘‘Doc u ment window’ ’ INITIALFRAMESIZE Func tions QUERY and EX TRACT option 304 Boolean 377 SET option 204 built-in 351 INITIALINSERT ex ter nal 351 QUERY and EX TRACT option 304 implied EXTRACT 286 SET option 205 in ter nal 350 INITIALWIDTH QUERY and EX TRACT option 305 G SET option 206 GET command 75 INPREFIX() Boolean func tion 379 H IN PUT command 82 HELP command 76 SEE ALSO ’’INPUTMODE’’ HELPDIR INPUTMODE SET option 196 QUERY and EX TRACT option 305 HEX SET option 207 QUERY and EX TRACT option 303 exit with Home key 207 SET option 197 INSER T HEXDISPLAY built-in func tion 364 QUERY and EX TRACT option 303 INSERTMODE SET option 197 QUERY and EX TRACT option 305 HEXTYPE command 77 SET option 208 HIGH LIGHT INSERTMODE() QUERY and EX TRACT option 303 Boolean func tion 379 SET option 198 INSTAB HISTUTIL command 77 SOS action 135 HIT command 80 IN STANCE Hex a dec i mal codes 77, 278 QUERY and EX TRACT option 305 Hori zon tal cur sor 177 - 178 SET option 208 ini tial iza tion op tion 17 I IN TER FACE IDLINE QUERY and EX TRACT option 305 QUERY and EX TRACT option 303 SET option 209 SET option 199 IN TER NA TIONAL IF-THEN-ELSE QUERY and EX TRACT option 305 KEXX instruc tion 342 SET option 211

437 IN TER PRET In struc tions, KEXX 339 KEXX instruc tion 343 In ter face set tings INTRUNC() CLASSIC 209 Boolean func tion 379 CUA 209 IT ER ATE SET INTER FACE option 209 KEXX instruc tion 343 SET KEYSTYLE option 213 Implied EX TRACT func tions 286 SET MARKSTYLE option 222 In dent ing SET OFPW option 228 SET AUTOINDENT option 160 In ter na tional sup port SET MARGINS option 221 ANSILOWER built-in func tion 353 Ini tial iza tion op tions 16 ANSIUPPER built-in func tion 354 COL UMN 16 DATECONV built-in func tion 361 DEFPROFILE 16 SET IN TER NA TIONAL op tion 211 FRAMESIZE 16 and print ing 240 IN STANCE 17 and sort ing 131, 211 LINE 17 case con ver sion 93, 144, 211 LOCK 17 key board 393 MACROPATH 18 In voking KEDIT 14 NEW 18 NODEFEXT 18 J NOFILEMENU 18 JOIN command 82 NOINI 18 Jus ti fy ing text NOLOCK 18 FLOW command 73 NOMSG 19 LEFTADJUST com mand 87 NOPROFILE 19 RIGHTADJUST com mand 126 NOREG 19 SET FORMA T option 195 PATH 19 PROFDEBUG 20 K PRO FILE 20 UN TI TLED 20 KEDIT WIDTH 20 Lan guage Def i ni tion files 398 notes on 20 STA TUS command 140 Ini tial iza tion pro cess ing 22 - 23 command 83 ed it ing ad di tional files 24 - 25 de fault ex ten sions 179 In put, in mac ros in voking 14, 83 ALERT command 26 SEE ALSO ‘‘Screen lay out’’ DI A LOG com mand 55 KEDIT Lan guage Def i ni tion files PARSE, KEXX instruc tion 345 SEE KLD files PULL, KEXX instruc tion 346 KEDITW en vi ron ment vari able 21 READV command 114 KEXX In put/Out put in KEXX 375 as sign ments 333 In put ting text ex pres sions 333 SEE ’’In sert ing text‘‘ in struc tions 339 In sert mode 205, 208 lan guage ref er ence 329 In sert ing text op er a tors 331, 333 ADD command 26 sym bols 331 INPUT command 82 to kens 330 SET INPUTMODE option 207 vari ables 331 SET WORDWRAP option 281 SEE ALSO ‘‘Mac ros’’ add ing lines 26, 226 KEYSTYLE ap pend ing to end of text 31 QUERY and EX TRACT option 306 col umn insert 38 SET option 213 con tin u ous en ter ing 207, 281 KHELP command 85 du pli cat ing lines 64 KLD files from another file 75 file for mat 398

438 in tro duc tion 397 ef fect of ARBCHAR on 155 Key board ef fect of CASE on 166 re de fin ing 53 ef fect of WRAP on 281 Keys, naming con ven tions 391 re peat ing of 89 LOCK L command 93 LASTKEY ini tial iza tion op tion 17 QUERY and EX TRACT option 306 LOCK ING LASTMSG QUERY and EX TRACT option 308 QUERY and EX TRACT option 307 SET option 217 LASTOP LOWER QUERY and EX TRACT option 307 built-in func tion 367 SET option 214 LOW ER CASE com mand 93 LASTPOS LPREFIX command 94 built-in func tion 365 LRECL LASTRC QUERY and EX TRACT option 308 QUERY and EX TRACT option 307 SET option 218 LEAVE LSCREEN KEXX instruc tion 344 QUERY and EX TRACT option 309 LEFT Leav ing KEDIT built-in func tion 365 SEE ‘‘Ending KEDIT’’ command 86 Line(s) LEFTADJUST com mand 87 add ing 207 LEFTEDGE copy ing 45 SOS action 135 de let ing 54 display ing line num bers 227 LEFTEDGE() du pli cat ing 64 Boolean func tion 379 lo cat ing 257, 281 - 282 LENGTH maxi mum length 20, 206 QUERY and EX TRACT option 308 moving 102 built-in func tion 365 naming 235 LESS command 87 prob lem with wrap ping 20 LINE re cov er ing 117 QUERY and EX TRACT option 308 Lo cat ing text ini tial iza tion op tion 17 ALL command 27 LINEADD CLOCATE com mand 40 SOS action 135 FIND command 72 LINEDEL FINDUP 72 SOS action 135 LO CATE com mand 88 LINEFLAG NFIND command 104 QUERY and EX TRACT option 308 NFINDUP command 104 SET option 215 SET QUICKFIND option 243 LINEIN TFIND command 142 built-in func tion 365 col umn locate 40 LINEINP() ef fect of ARBCHAR on 155 Boolean func tion 380 ef fect of CASE on 166 LINEND ef fect of WRAP on 281 QUERY and EX TRACT option 308 Loop ing, in KEXX 340 SET option 216 LINEOUT M built-in func tion 366 MACRO LINES QUERY and EX TRACT option 309 built-in func tion 366 command 95 LO CATE MACROPATH command 88 QUERY and EX TRACT option 309

439 SET option 219 im me di ate ex e cu tion 81 ini tial iza tion op tion 18 implied 199 MACROS command 96 in-memory 53, 96 MAKECURR lan guage ref er ence 329 SOS action 135 path 219 MARGINL read ing data from com mand line 114 SOS action 135 re mov ing 111 MARGINR Mar gin SOS action 135 line mark ing 279 MAR GINS Matching braces, brackets, etc. 42 QUERY and EX TRACT option 309 Menu SET option 221 mac ros 395 MARK command 97 popup 107 MARKSTYLE Mes sages QUERY and EX TRACT option 310 CMSG command 43 SET option 222 DMSG command 60 MAX EMSG command 67 built-in func tion 367 MSG command 103 MEM ORY NOMSG com mand 105 QUERY and EX TRACT option 310 NOMSG ini tial iza tion op tion 19 SET MSGMODE op tion 225 MERGE command 99 WMSG com mand 148 MIN summary of 410 built-in func tion 367 Min i mal trun ca tion 12 MOD I FI ABLE() Mov ing text Boolean func tion 380 MOVE command 102 MODIFY command 100 SHIFT command 129 MON I TOR to a disk file 112 QUERY and EX TRACT option 310 Mul ti ple file ed it ing 83 SET option 223 MORE command 101 N MOUSEBEEP QUERY and EX TRACT option 310 NBFILE SET option 224 QUERY and EX TRACT option 311 SOS action 136 NBSCOPE MOUSEPOSMODIFIABLE() QUERY and EX TRACT option 311 Boolean func tion 380 NBWINDOW MOUSEPOSVALID() QUERY and EX TRACT option 312 Boolean func tion 380 NEW MOUSETEXT ini tial iza tion op tion 18 SET option 153 NEWLINES MOVE command 102 QUERY and EX TRACT option 312 MSG command 103 SET option 226 MSGLINE NEXT command 104 QUERY and EX TRACT option 311 NFIND command 104 SET option 224 NFINDUP command 104 MSGMODE NFUP command 104 QUERY and EX TRACT option 311 NODEFEXT SET option 225 ini tial iza tion op tion 18 MULTWINDOW() NOFILEMENU Boolean func tion 380 ini tial iza tion op tion 18 Mac ros NOINI WINPROF.KEX 23 ini tial iza tion op tion 18 de bug ging 179 NOLOCK de fin ing 53 ini tial iza tion op tion 18

440 NOMSG CMSG command 43 ini tial iza tion op tion 19 DI A LOG com mand 55 NOMSG com mand 105 DMSG command 60 NOP MSG command 103 KEXX instruc tion 344 WMSG com mand 148 NOPROFILE Over lay ing text ini tial iza tion op tion 19 enter line with OVER LAY 106 NOQUEUE() spec i fied col umns with COVERLAY 47 Boolean func tion 380 P NOREG ini tial iza tion op tion 19 PARINDENT NOVALUE SOS action 136 QUERY and EX TRACT option 312 PARSE SET option 227 KEXX instruc tion 345, 381, 383, 385 NUM BER PARSER QUERY and EX TRACT option 312 QUERY and EX TRACT option 313 SET option 227 SET option 230 Nam ing files PATH SEE ‘‘Files’’ QUERY and EX TRACT option 314 Naming lines 235 SET option 232 ini tial iza tion op tion 19 O PCOLOR SET option 233 OEM fonts PEND ING() SEE ‘‘Char ac ter set han dling’’ Boolean func tion 380 OEMFONT() POINT Boolean func tion 380 QUERY and EX TRACT option 314 OEMTOANSI SET option 235 built-in func tion 367 POPUP command 107 command 106 POS OFPW built-in func tion 367 SET option 228 POWER equiva lent 207 OPENFILTER PRE FIX SET option 229 QUERY and EX TRACT option 315 OPMODE SET option 236 QUERY an EX TRACT option 312 SOS action 136 OPSYS PRE FIX SYN ONYM QUERY and EX TRACT option 313 SET option de scrip tion 236 OP TIONS PRE FIX() KEXX instruc tion 345 Boolean func tion 380 OTH ER WISE PREFIXLEFT() KEXX instruc tion 347 Boolean func tion 380 OVER LAY PREFIXWIDTH built-in func tion 367 SET option 239 command 106 PRESER VE command 108 OVERLAYBOX command 107 PRINT command 109 One-file-per-window 228 PRINTCOLORING Op er a tor pre ce dence, KEXX 337 SET option 239 Op er a tors, KEXX 331 PRINTER Options of SET command 129 QUERY and EX TRACT option 315 display ing 100, 113, 140 SET option 240 mod i fy ing 100 PRINTPROFILE Out put from mac ros, dis play ing QUERY and EX TRACT option 316 ALERT command 26 SET option 242

441 PRINTSIZE READV command 114 QUERY and EX TRACT option 316 RECENTFILES PRO CE DURE QUERY and EX TRACT option 316 KEXX instruc tion 345 SET option 245 PROFDEBUG RECFM ini tial iza tion op tion 20 QUERY and EX TRACT option 317 PRO FILE SET option 245 ini tial iza tion op tion 20 RE COVER command 117 SEE ALSO ‘‘WINPROF.KEX’’ REDO command 118 PRO FILE() RE FRESH command 118 Boolean func tion 380 REGUTIL command 119 PULL RE NAME command 121 KEXX instruc tion 346 RE PEAT PURGE command 111 command 121 PUT command 112 used with CDELETE 33 PUTD command 112 used with COVERLAY 48 Paste RE PLACE CLIPBOARD command 39 can trig ger In put Mode 207 Prefix area command 123 SET PREFIX option 236 REPROFILE SET PREFIXWIDTH option 239 QUERY and EX TRACT option 317 commands 237 SET option 246 disap pears in In put Mode 207 RE SERVED pro cess ing pre fix com mands 94 QUERY and EX TRACT option 317 re set ting pend ing pre fix com mands 123 SET option 248 Pro files RE SET command 123 ed it ing ad di tional files 24 - 25 RE STORE in ini tial iza tion pro cess ing 22 - 23 SOS action 136 Put command 124 CLIPBOARD command 39 RESTORECOL Q SOS action 136 RESTORELINE QCMND SOS action 136 SOS action 136 RETRIEVEB QQUIT command 114 SOS action 136 QUERY command 113 RETRIEVEF QUICKFIND SOS action 136 QUERY and EX TRACT option 316 RE TURN SET option 243 KEXX instruc tion 346 QUICKFINDACT RE VERSE SOS action 136 built-in func tion 368 QUICKFINDB REXX lan guage 388 SOS action 136 The REXX Lan guage 329, 388 QUICKFINDF RGTLEFT command 125 SOS action 136 RIGHT QUIT command 114 built-in func tion 368 command 125 R RIGHTADJUST com mand 126 RAN DOM RIGHTCTRL built-in func tion 368 QUERY and EX TRACT op tion 317 RANGE SET op tion 249 QUERY and EX TRACT option 316 RIGHTEDGE SET option 244 SOS action 136

442 RIGHTEDGE() SET option 253 Boolean func tion 380 SET RING STA TUS command 140 QUERY and EX TRACT option 317 command 129 Re cord length pre serv ing op tion val ues 108 SET LRECL option 218 que ry ing set tings 113 SET RECFM option 245 re stor ing pre served op tion val ues 124 WIDTH ini tial iza tion op tion 20 SETCOLPTR trun ca tion col umn 276 SOS action 137 Re cov er ing text SETLEFTM SEE ‘‘RE COVER command’ ’ SOS action 137 SEE ’’UNDO com mand’’ SETTAB Reg is try 23 SOS action 137 NOREG ini tial iza tion op tion 19 SHADOW SET REGSAVE op tion 247 QUERY and EX TRACT option 319 and pro file pro cess ing 23 SET option 255 Reg u lar Ex pres sions 35 SHADOW() Reg u lar ex pres sions 92 Boolean func tion 381 Re served lines 248 SHAR ING Re turn codes 429 QUERY and EX TRACT option 319 TRACE KEXX in struc tion 348 SET option 255 Rou tines SHIFT command 129 ex ter nal 351 SHIFT() in ter nal 350 Boolean func tion 381 Running ex ter nal pro grams 61, 146 SHOWDLG command 130 S SHOWPRINTDLG() Boolean func tion 381 SAVE SIGN SOS action 137 built-in func tion 366, 368 - 369 command 127 SIG NAL de fault ex ten sions 179 KEXX Instruc tion 387 SAVECOL KEXX instruc tion 348 SOS action 137 SIZE SAVELINE QUERY and EX TRACT option 319 SOS action 137 SORT command 131 SAY SOS command 133 KEXX instruc tion 346 SOURCELINE SCALE built-in func tion 369 QUERY and EX TRACT option 318 SET option 249 SPACE built-in func tion 369 SCHANGE command 128 SCOPE SPACECHAR() QUERY and EX TRACT option 318 Boolean func tion 381 SET option 250 SPLIT command 138 SCREEN SPLTJOIN command 139 SET option 251 SSAVE command 127 SCROLLBAR STARTUP QUERY and EX TRACT option 318 QUERY and EX TRACT option 319 SET option 253 STARTWORD SCROLLLOCK() SOS action 137 Boolean func tion 380 STA TUS command 140 SE LECT STATUSLINE KEXX instruc tion 347 QUERY and EX TRACT option 320 QUERY and EX TRACT option 318 SET option 256

443 STAY Selec tive chang ing of text 128 QUERY and EX TRACT option 315, 320 Shelling to DOS SET option 257 SEE ’’Run ning ex ter nal pro grams’’ used with CHANGE 35 Shift ing text STREAM SHIFT command 129 QUERY and EX TRACT op tion 320 Sort ing SET op tion 257 SORT command 131 used with CDELETE 32 and in ter na tional char ac ters 211 STRIP Spe cial char ac ters built-in func tion 369 chang ing 29 SUBSTR Starting KEDIT 14, 83 built-in func tion 369 Stem variables 331 SUBWORD Symbols, KEXX 331 built-in func tion 370 Syn onyms SYM BOL for commands 258 built-in func tion 370 for pre fix area commands 236 SYNEX command 140 Syn tax col or ing SYN ONYM con trol ling col ors 186, 233, 239 QUERY and EX TRACT option 320 en abling 172 SET option 258 load ing KLD files 397 Sav ing your work Syn tax con ven tions 12 - 13 FILE com mand 69 T SAVE command 127 SET AUTOSAVE op tion 161 TAB() SET BACKUP option 163 Boolean func tion 381 Screen layout TABB SET ARROW option 158 SOS action 137 SET CLOCK option 168 TABCMD SET CURLINE op tion 175 SOS action 137 SET HEXDISPLAY option 197 TABCMDB SET IDLINE op tion 199 SOS action 137 SET NUMBER 227 TABCMDF SET PREFIX option 236 SOS action 137 SET PREFIXWIDTH option 239 TABF SET RE SERVED option 248 SOS action 137 SET SCALE option 249 TABFIELDB SET SCREEN option 251 SOS action 138 SET SCROLLBAR option 253 TABFIELDF SET STATUSLINE option 256 SOS action 138 SET TABLINE op tion 260 TABLINE SET VERIFY option 278 QUERY and EX TRACT option 320 dis play ing char ac ter code 197 SET option 260 mul ti ple win dows 251 TABS numbers on lines 227 QUERY and EX TRACT option 321 re served lines 248 SET option 261 scale line 249 used with COMPRESS 44 Scroll ing TABSAVE SET AUTOSCROLL option 162 QUERY and EX TRACT option 321 back ward 30 SET option 262 for ward 74 TABSIN hor i zon tal 86, 125, 162 QUERY and EX TRACT option 321 Search and replace SET option 263 SEE ’’Chang ing text’’ TABSOUT SEE ’’Lo cat ing text’’ QUERY and EX TRACT option 321

444 SET option 264 TRANSLATEOUT TABWORDB QUERY and EX TRACT option 324 SOS action 138 SET option 275 TABWORDF TRUNC SOS action 138 QUERY and EX TRACT option 324 TAG command 140 SET option 276 TAR GET built-in func tion 372 QUERY and EX TRACT option 321 Tab char ac ters TEXT command 141 compres sion of 44, 264 TFIND command 142 ex pan sion of 68, 263 THIGHLIGHT pres er va tion of 262 QUERY and EX TRACT option 322 Tab stops SET option 265 dis play ing 260 TIME set ting 261 QUERY and EX TRACT option 322 Tai lor ing KEDIT built-in func tion 370 SEE ‘‘WINPROF.KEX’’ TIMECHECK SEE ’’SET command ’’ QUERY and EX TRACT option 322 Targets SET option 266 blanks, spe cial han dling 277 TOF col umn 41 QUERY and EX TRACT option 322 ex amples of with CHANGE command 34 TOF() ex amples of with LO CATE com mand 88 Boolean func tion 381 spec i fy ing char ac ter codes in 197 TOFEOF string 277, 282 QUERY and EX TRACT option 322 sum mary 90 SET option 266 wildcard charac ters used in 155 TOL SEE ALSO ‘‘Reg u lar Ex pres sions’’ QUERY and EX TRACT option 323 Tempo rary file 112 TOOLBAR Tokens, KEXX 330 QUERY and EX TRACT option 323 Toolbar SET option 267 de fin ing con tents 267, 272 TOOLBUTTON dis play ing 267 QUERY and EX TRACT option 323 Trun ca tion col umn SET option 267 SET TRUNC option 276 TOOLSET QUERY and EX TRACT option 324 U SET option 272 TOP command 143 UNC TOPEDGE in fileid spec i fi ca tions 193 SOS action 138 UNDO TOPEDGE() QUERY and EX TRACT option 325 Boolean func tion 381 command 143 TRACE re set ting undo lev els 123 KEXX instruc tion 348 UN DO ING built-in func tion 371 QUERY and EX TRACT option 325 TRAIL ING SET option 276 QUERY and EX TRACT option 324 UNIQUEID SET option 274 QUERY and EX TRACT option 325 TRANS LATE UNLOCK command 143 built-in func tion 371 UN TI TLED TRANSLATEIN ini tial iza tion op tion 20 QUERY and EX TRACT option 324 UN TI TLED() SET option 275 Boolean func tion 381

445 UP command 144 WORDLENGTH UP PER built-in func tion 373 built-in func tion 372 WORDPOS UP PER CASE com mand 144 built-in func tion 373 Uni ver sal Nam ing Con ven tion WORDS in fileid spec i fi ca tions 193 built-in func tion 374 V WORDWRAP QUERY and EX TRACT option 327 VALUE SET option 281 built-in func tion 372 WRAP VARBLANK QUERY and EX TRACT option 327 QUERY and EX TRACT option 325 SET option 281 SET option 277 VER IFY Wild card char ac ters QUERY and EX TRACT option 325 ARBCHAR in tar gets 155 SET option 278 blanks in FIND command 72 built-in func tion 373 SEE ALSO ’’Reg u lar ex pres sions’’ VERONE() Win dow mar gin 279 Boolean func tion 381 Win dow(s) VERSHIFT SEE ’’Doc u ment win dow‘‘ QUERY and EX TRACT option 326 SEE ’’Frame window’ ’ VER SION Word pro cess ing QUERY and EX TRACT option 326 GML tags 195 Vari ables, KEXX 331 SET FORMA T option 195 Ver ti cal cur sor 177 - 178 SET WORDWRAP option 281 W blanks af ter punc tu a tion 195 con tin uous en ter ing of text 207, 281 WHEN mar gins 221 KEXX instruc tion 347 para graph def i ni tion 195 WIDTH print ing 109 QUERY and EX TRACT option 326 Wrapped lines ini tial iza tion op tion 20 prob lem with 20 WINDIR QUERY and EX TRACT option 326 WINDOW command 145 X WINDOWNAME X2B QUERY and EX TRACT option 327 built-in func tion 374 WINEXEC command 146 X2C WINHELP command 147 built-in func tion 374 WINMARGIN X2D SET option 279 built-in func tion 375 WINPROF.KEX 23 SET REPROFILE option 246 XEDIT command 148 de fault pro file 180 XEDIT com pat i bil ity re-ex e cut ing for new file 246 SEE User’s Guide Appen dix A WMSG com mand 148 XRANGE WORD built-in func tion 374 QUERY and EX TRACT option 327 SET option 280 Z built-in func tion 373 punc tu a tion de lin eates words 280 ZONE WORDINDEX QUERY and EX TRACT option 328 built-in func tion 373 SET option 282

446