home *** CD-ROM | disk | FTP | other *** search
- Batch File Sorts
- (PC Magazine Vol 3 No 8 May 1, 1984 User-to-User)
-
- In DOS 2.x it's easy to use batch files and filters to list your
- files alphabetically by filename, filename extension, or by the size of
- the file. To do this, make sure your SORT.EXE file is on the disk you
- are sorting, and create a batch file called SDIR.BAT:
-
- A>COPY CON:SDIR.BAT <Enter>
- DIR %1: |SORT /+%2>%3
-
- Then hit the F6 key, and then the Enter key. (The vertical bar
- character (|) before the word SORT is the DOS "piping" symbol.)
- In this batch file, %1 designates the drive containing the
- directory to be sorted, %2 stands for the column number of the
- directory to be sorted, and %3 is the filename which it is to be
- saved under. Note that since there is a colon after %1, you won't
- have to enter a colon when you tell SDIR.BAT which disk to sort.
- To sort drive A alphabetically (using the first column), you
- would type:
- A>SDIR A 1 A:ASRT.DIR
- then hit the Enter key and you'll see on the screen:
- A>DIR A:|SORT /+1>A:ASRT.DIR
- For alphabetization of the FILENAME EXTENSION, type in 9 instead
- of 1. Type:
- A>SDIR A 9 A:FXSRT.DIR
- then hit the Enter key.
- For the DIR to be listed by the size of the files, replace the 9
- with 13:
- A>SDIR A 13 A:SZSRT.DIR
- and you'll get the same results as above but a different sorting of the
- directory. You can also get a reverse order listing of the directory
- by typing /R after the column number:
- A>SDIR A 13/R A:RSRT.DIR
- and hitting the Enter key.
- Once you've created these sorted directory files, to use them just
- type the DOS TYPE command. To view the initial alphabetical listing
- described above, for instance, type:
- A>TYPE ASRT.DIR
- then hit the Enter key and you'll see all the files on your disk
- rearranged alphabetically by filename.
- It's probably best to have three batch files on your disk:
- SDIR.BAT to create sorted files, PSDIR.BAT to create them and print
- them out on your printer, and SSDIR.BAT to create them and print them
- on your screen. For PSDIR.BAT type:
- A>COPY CON:PSDIR.BAT <Enter>
- DIR %1:|SORT/+%2>%3 <Enter>
- COPY %3 LPT1: <F6><Enter>
- For SSDIR.BAT, type:
- A>COPY CON:SSDIR.BAT <Enter>
- DIR %1:|SORT /+%2>%3 <Enter>
- COPY %3 CON: <F6><Enter>
-
- -----------------------------------------------------------------
- Assembling a Port Switch
- (PC Magazine Vol 3 No 18 Sept 18, 1984 User-to-User)
-
- The following .COM program written through DEBUG's Assemble
- command in DOS 2.0 will run two printers for use with dBASE II. The
- file is named PSWITCH.COM.
-
- A>DEBUG
- -NPSWITCH.COM
- -A
- 1363:0100 MOV AX,0040
- 1363:0103 MOV DS,AX
- 1363:0105 MOV SI,0008
- 1363:0108 MOV AX,[SI]
- 1363:010A XCHG [SI+02],AX
- 1363:010D MOV [SI],AX
- 1363:010F MOV AX,004C
- 1363:0112 INT 21
- 1363:0114
- -RCX
- 0000: 0014
- -W
- Writing 14 bytes
- -Q
- A>
-
- -----------------------------------------------------------------
- Sloppy Floppies
- (PC Magazine March 20, 1984 User-to-User)
-
- This procedure that will sort and keep track of files on floppy
- disks and let you locate any file in seconds.
- You need DOS 2.x and a word processor, i.e., WordStar. First
- number all your disks on their labels. DOS 2.x allows redirection of
- I/O, which will put the directories of each disk into individual files.
- To do this, get into DOS, put a blank, formatted disk into drive B:,
- put your disk #1 into drive A:, and at the DOS prompt A> type:
- DIR>B:DISK1 <Enter>
- Then put disk #2 in, and type the same thing; disk #3, etc. When
- you're all done, you'll have a lot of directories on drive B: named
- DISK1, DISK2, DISK3, etc. Append them into one master file by typing:
- COPY B:*. DIRECTRY
- This will merge all of the individual directory files into one master
- file called DIRECTRY.
- All you have to do now is go into that master DIRECTRY file with
- WordStar, number the individual directories sequentially, and clean
- them up if you don't want to see the "bytes free" messages or the
- "Volume in drive A has no label" messages.
- To find what disk a file is on, use WordStar's string search
- command (^QF) to hunt for the filename. Scroll up through the
- individual listing, once WordStar has found a match, to see what the
- number of the disk is. You can find all sorts of uses for this. For
- instance, you could see if copies of a file are on more than one disk,
- or look at every file that you created or modified last Tuesday, etc.
- When you change the contents of any of the files on one of the
- disks listed in your master directory, you have to redirect the changed
- disk's directory into a temporary file, then get into the master
- directory and delete the old listing and read in the temporary file.
- You can do this is WordStar with block moves -- ^KB^KK^KY to remove the
- old directory, then ^KR to read in the new one.
- You might also be able to use DOS FIND and SORT filter commands
- for this, but if you do so, you'll have to use your word processor to
- add the number of the disk to each line in each of your directory
- listings.
-
- -----------------------------------------------------------------
- Using DOS 2.0 To Organize Your Diskettes
- (PC Age May 1983 by Willard A. Brown)
-
- Keeping track of the contents of dozens of diskettes when their
- contents are frequently altered can be a problem. Here is a process
- for making order out of chaos by creating a catalog of the contents of
- a group of disks:
- 1. Format a disk give a volume name indicating its use: a catalog
- of disks and their contents.
- 2. Place the disk that is to be cataloged in drive A.
- 3. Type the following: DIR|SORT>B:DISK1.DRA (If the disk
- being cataloged has been assigned a name, use that name instead of
- DISK 1.)
- 4. Place the next disk in drive A.
- 5. Type the same as above, but change the filename.
- 6. Continue until 10 disks have been cataloged, then start using
- an extension of DRB instead of DRA and repeat for the next 10 disks.
- The reason for this has to do with the PRINT command (see below).
- 7. Copy to your catalog disk in drive B the following files from
- your DOS disk: CHKDSK.COM, FIND.EXE, MORE.COM, PRINT.COM, SORT.EXE,
- and TREE.COM.
- Next you will want to make several batch files for future
- convenience in searching through your catalog and making printed
- copies. The code listing below shows a sample.
- After completion of this task, if you type DISPLAY, you will find
- on your screen a sorted page full of the names of the files that have
- been created. Pressing the space bar will cause display of the next
- full page. Of if you type SEARCH followed by a string of characters
- you will have a display of those disk names that have filenames that
- include the specified string of characters.
- The PRINT command can store pointers for no more than 10 files.
- For this reason you store groups of 10 with extensions of DRA, DRB,
- DRC, etc. in the procedures above. Using this strategy you can request
- printing of the entire stream of directories in a reasonably efficient
- way. Thirty disks would only require three command lines. The reason
- that a batch file is suggested for the first group is that it serves as
- a reminder of the form that the command line should take.
- - - - - -
- B>COPY CON:DISPLAY.BAT
- DIR|SORT|MORE
-
- B>COPY CON:SEARCH.BAT
- FIND "%1" DISK1.DRA DISK2.DRA DISK3.DRA
- FIND "%1" DISK6.DRA DISK7.DRA
- FIND "%1" DISK11.DRB DISK12.DRB
-
- B>COPY CON:PRINTA.BAT
- PRINT *.DRA
-
- -----------------------------------------------------------------
- Bug Hung
- (PC Magazine Vol 4 No 2 Jan 22, 1985 User-to-User)
-
- 1. If your default drive is A: and you are trying to rename a file
- in drive B: with the BASIC NAME command, you get a "Rename across
- disks" error message. The solution is to not use the format given in
- the BASIC manual. Instead use "NAME filespec AS filespec."
- 2. Advanced programmers using IBM's ASM/MASM Assembler may be
- puzzled by a mysterious "?End of file encountered on input file" error
- message that appears on start-up. It's not in IBM's manuals. All it
- means is that you probably answered the start-up prompts with a
- complete filespec instead of just a filename. All the assembler wants
- is "[d:]filename". You probably entered "[d:] filename.ext".
- 3. If CHKDSK reports one more hidden file than you think you
- should have, you probably just formatted the disk with the /V switch.
- CHKDSK reports the VOLUME ID label as a hidden file.
- 4. Do your batch files end with a double prompt A> A>? You can
- avoid this by typing the EOF marker (Ctrl-Z or function key F6) on the
- same line as the last command instead of on the next line. A blank
- space typed before the marker is optional.
- 5. Are you annoyed by the REMs that clutter up your display when
- you want to make a REMark in a batch file with ECHO ON? Try using a
- period (.) instead. It means the same as REM, but it yields a much
- neater display. There is also another use for the period with ECHO
- OFF. To skip lines between commands, use an ECHO . command wherever
- you want a blank line. The line displayed will be blank except for a
- single period in the first position.
- 6. If you're using your word processor to write batch files, the
- EOF marker is usually not available from the F6 key. Use a Ctrl-Z key
- combination instead. Your screen will show a "right arrow", the ASCII
- symbol for Ctrl-Z.
- 7. When using a RAMdisk, you must have a complete operating
- system in place if you want to invoke DOS commands from the RAMdisk.
- Use SYS d: and COPY COMMAND.COM d: to load IBMBIO.COM, IBMBIO.COM, and
- COMMAND.COM into the first three files on your RAMdisk. Make sure that
- they are the first three files and that IBMBIO.COM resides in
- contiguous sectors. The easiest way to do this is to start with a
- completely empty RAMdisk.
- Editor's Notes:
- (1) When renaming files on one disk from another, be sure and play
- it safe by putting the drive at the beginning of each, for example,
- name B:TEST.BAS as B:RETEST.BAS. While it's true that the BASIC manual
- is confusing, it makes one good point -- filenames don't default to a
- BAS extension; you have to add it if you want it.
- (6) It's generally safe to end a line with Ctrl-Z (F6 in DOS), but
- there are times when a line has to end in a carriage return. For
- instance, if you're typing ANSI magic, you have to hit the carriage
- return before the Ctrl-Z. But normal batch files don't usually need
- the extra carriage return.
- (7) DOS 3.0 doesn't let you use a period (.) instead of a REM.
- If you want to save trouble, you can use the COMMAND C:\ to move
- COMMAND.COM, but it's not necessary to schlep the hidden files on
- RAMdisk.
-
- -----------------------------------------------------------------
- Tidy Lister
- (PC Magazine Vol 4 No 2 Jan 22, 1985 User-to-User)
-
- If you are putting up with "untidy" listings of long BASIC
- programs, help files and the like, you can modify the DOS 2.x MORE
- filter to pause after a full page rather than a 24-line screenful.
- Alter MORE to pause every 55 lines by:
- 1. Make a copy of MORE.COM under another name -- PORE.COM.
- 2. With DEBUG.COM and PORE.COM in the default drive, enter:
- A>DEBUG PORE.COM
- - D
- - E0118
- - xxxx:0118 19.37
- - W
- - Q
- (Note: Check for the value "19" which should appear at offset
- :0118, the byte at the right of the long line, and ignore the numbers
- that replace xxxx.)
- Now when you need a listing of a BASIC program (saved in ASCII)
- or any ASCII file from DOS, enter:
- TYPE FILENAME|PORE>LPT1:
- Use the correct device name (if different) in place of LPT1:. After
- listing 54 lines of the file, the printer pauses. With a quick
- Off-Line/Form-Feed/On-Line sequence a a press of any key, the next page
- is off and running.
- Editor's Note: You can also create a batch file, called PMOR.BAT,
- that automatically does this job:
- A>COPY CON:PMOR.BAT
- TYPE %1|PORE>LPT1:
- Then, to type a file with the new PORE pauses in it while in DOS, just
- enter PMOR <filename>. Also, to avoid having the phrase "--more--"
- appear on your printouts, while you're in DEBUG, add the following line
- just before you write (by hitting W):
- -F 1F1 1FA 20
- This replaces the "--more--" message with blank spaces.
-
- -----------------------------------------------------------------
- Poor Man's MODE
- (PC Magazine Vol 4 No 15 July 23, 1985 User-to-User)
-
- While the DOS MODE command performs a variety of I/O functions,
- many readers probably use it only to select video modes. It's possible
- to bypass MODE.COM and do this directly by using the SCREEN.COM program
- below, which speeds things up and saves 5K of space on disk. Once
- you've entered the program using DEBUG, use the command SCREEN n,
- substituting a number from 0 to 3 in space of n. Here are the new
- SCREEN n values along with their old MODE n equivalents:
- New SCREEN n Old MODE.COM n
- 0 BW40 (or 40)
- 1 CO40
- 2 BW80 (or 80)
- 3 CO80
- Editor's Note: This does the job, but MODE.COM cones in handy
- elsewhere and at 5K isn't a space hog, especially on a hard disk. But
- if you're tight for space on a floppy, or if you want to give away or
- sell a disk and don't want to put IBM's copyrighted MODE.COM on it,
- this is for you.
- - - - - -
- A>debug
- -n screen.com
- -a
- xxxx:0100 xor ax,ax
- xxxx:0102 mov bx,0081
- xxxx:0105 cmp byte ptr [bx],20
- xxxx:0108 jnz 010d
- xxxx:010A inc bx
- xxxx:010B jmp 0105
- xxxx:010D mov al,[bx]
- xxxx:010F cmp al,33
- xxxx:0111 ja 0117
- xxxx:0113 cmp al,2f
- xxxx:0115 ja 0119
- xxxx:0117 mov al,33
- xxxx:0119 sub al,30
- xxxx:011B int 10
- xxxx:011D int 20
- xxxx:011F
- -rcx
- CX 0000
- :lf
- -w
- Writing 001F bytes
- -q
-
- -----------------------------------------------------------------
- Screen Blanker
- (PC Magazine Vol 4 No 15 July 23, 1985 User-to-User)
-
- For users who leave their monitors on all night to use the CTTY
- remote control, the program below will blank their screens as
- recommended in "Remote Access with CTTY" (Vol 4 No 3). Enter the
- program with DEBUG. To run the program, simply type BLANK at the DOS
- prompt. To return from the blank screen, use the DOS MODE command or
- change the byte at &h108 from 00 to 07.
- - - - - -
- A>debug
- -a 100
- xxxx:0100 mov dx,1950
- xxxx:0103 mov cx,0000
- xxxx:0106 mov ax,0600
- xxxx:0109 mov bh,00
- xxxx:010B int 10
- xxxx:010D mov al,00
- xxxx:010F mov dx,03d9
- xxxx:0112 out dx,al
- xxxx:0113 int 20
- xxxx:0115
- -rcx
- cx 0000
- :114
- -n BLANK.COM
- -w
- Writing 0114 bytes
- -q
-
- NOTE: To create UNBLANK.COM, substitute MOV BH,07 for the line
- MOV BH,00 and enter MOV AL,# instead of MOV AL,00 -- substituting the
- hex number of your border clor (3=cyan, 2=green, etc.) for the #.
- Also, name it UNBLANK.COM.
-
- -----------------------------------------------------------------
- Beyond DOS COMPare
- (PC Magazine Vol 4 No 16 Aug 6, 1985 User-to-User)
-
- The DOS compare files command (COMP) compares two files until it
- finds 10 differences, then stops. You may want to compare two files
- even though the number of differences exceeds this limit. For DOS 2.x,
- use DEBUG to change the limit to any number of comparisons you'd like:
-
- A>DEBUG COMP.COM
- -e 39a nn
- -e 809 "xx"
- -w
- Writing 09E6 bytes
- -q
-
- To change the number to 14, for example, replace the nn with 0E (the
- hex notation for 14) and the "xx" to "14". For DOS 3.x, substitute
- 879 for 39a and b51 for 809.
- This patch will let you change COMP to continue file comparisons
- without any limit on the number of byte-by-byte differences COMP finds
- for DOS 2.x:
-
- A>DEBUG COMP.COM
- -e 39b 90 90
- -w
- Writing 09E6 bytes
- -q
-
- For DOS 3.x, use 87a for 39b.
- Editor's Note: This DOS 2.x trick works, but it doesn't handle
- the annoying problem where, if there is just one extra byte at the
- beginning of one file being compared, COMP gets confused and the whole
- process becomes meaningless.
-
- -----------------------------------------------------------------
- Cursor Toggling
- (PC Magazine Vol 4 No 22 October 29, 1985 User-to-User)
-
- CURSON.COM, written for a color display, turns the cursor back on
- if it disappears when exiting from a program. To adapt it to work on
- a monochrome display, change the 0607 in the first MOV instruction to
- 0C0D. Also, if you want to turn the cursor off, change the same
- instruction to 0F00.
-
- A>DEBUG CURSON.COM
- File not found
- -A
- xxxx:0100 MOV CX,0607
- xxxx:0103 MOV AH,01
- xxxx:0105 INT 10
- xxxx:0107 INT 20
- xxxx:0109
- -RCX
- CX 0000
- :9
- -W
- Writing 0009 bytes
- -Q
-
- -----------------------------------------------------------------
- Cursoring a Blue Streak
- (PC Magazine Vol 4 No 25 Dec 10, 1985 PC Tutor)
-
- The size of the cursor on the PC can be controlled by ports on
- the 6845 video controller chip. It's easier to use the BIOS Interrupt
- 10h function call 01h, however. Use DEBUG to create the CURSOR.COM
- program below that will let you experiment with different cursor sizes.
- The program takes two arguments (each a 2-digit hex number) to specify
- the top scan line and the bottom scan line of the cursor. You can
- start by entering the following commands, depending on whether you have
- a monochrome or color/graphics display:
- Monochrome Normal: CURSOR 0B 0C
- Monochrome Box : CURSOR 00 0C
- Color Normal : CURSOR 06 07
- Color Box : CURSOR 00 07
- Using CURSOR.COM to experiment with cursor size is better than
- using the BASIC LOCATE statement because you can go beyond 1F hex (or
- 31 decimal) in the arguments. You may notice through experimentation
- that the blink is slowed down somewhat by values of 6x (for instance,
- CURSOR 66 67), but it cannot be turned off entirely.
- Whether other programs will destroy your settings depends on the
- program. Some do; some don't.
- For programs that use a nonblinking cursor, you're seeing a
- hardware-generated cursor. Programs can hide the read hardware cursor
- and then create their own "cursor" by writing the characters to the
- display with a reverse-video attribute. Mimicking this process in a
- memory-resident utility is not entirely successful. BIOS Interrupt 10h
- calls can be intercepted to substitute a reverse-video screen attribute
- for the blinking cursor, but this only worked at the DOS-command level.
- It was an absolute mess with some other programs. For instance,
- WordStar 3.30 uses the BIOS services to set the cursor position, but
- it uses direct memory to write to the screen and scroll it. This
- results in multiple copies of a "cursor" appearing all over the screen.
-
- A>DEBUG
- -A
- xxxx:0100 MOV AX,[005D]
- xxxx:0103 CALL 0116
- xxxx:0106 MOV CH,AL
- xxxx:0108 MOV AX,[006D]
- xxxx:010B CALL 0116
- xxxx:010E MOV CL,AL
- xxxx:0110 MOV AH,01
- xxxx:0112 INT 10
- xxxx:0114 INT 20
- xxxx:0116 CALL 0125
- xxxx:0119 XCHG AL,AH
- xxxx:011B CALL 0125
- xxxx:011E MOV CL,04
- xxxx:0120 SHL AH,CL
- xxxx:0122 ADD AL,AH
- xxxx:0124 RET
- xxxx:0125 OR AL,20
- xxxx:0127 SUB AL,57
- xxxx:0129 JNB 012D
- xxxx:012B ADD AL,27
- xxxx:012D RET
- xxxx:012E
- -N CURSOR.COM
- -R CX
- CX 0000
- :002E
- -W
- Writing 002E bytes
- -Q
-
- -----------------------------------------------------------------
- Behind the Eight Ball with DEL
- (PC Magazine Vol 4 No 22 October 29, 1985 User-to-User)
-
- Here's an easy, new and undocumented feat of prestidigitation.
- A mere slip of the finger, and much of your current subdirectory or
- floppy disappears like magic!
- Say you've got a bunch of files whose names don't have extensions,
- like MOE, LARRY and JOE. You've also got some with the .BAT extension:
- MOE.BAK, LARRY.BAK and CURLY.BAK. May as well get rid of those useless
- backups. Nothing to it. You simply type: erase *.bak (or del *.bak).
- Except that after you hit the asterisk over the 8, you accidentally
- let go of the Shift an instant too late. What you type instead, since
- the > sign is over the period, is: erase *>bak (or del *>bak).
- You hit the Enter key before you catch the error. And when you
- look at the directory, you discover the .BAK files are still there.
- Missing are all of your files whose names lack extensions. MOE, LARRY
- and CURLY are gone, and so are PETER, PAUL and MARY. You may not see
- it in the directory, but you now have a file called BAK whose length
- is zero.
- Agony! An immediate trip to the undelete utility. It's likely
- to be a long session. Seeing the > sign, DOS thought you were trying
- to redirect the output of the ERASE command into a file called BAK;
- the output of the ERASE command is nothing at all. Of course, the
- lone asterisk meant you wanted to erase all files whose names lack
- extensions. DOS was kind enough to oblige.
- Moral: when using the ERASE or DEL command, avoid the Shift keys.
- Use the asterisk under PrtSc instead of the one over the 8. Or
- automate things; create a batch file with the single line: del *.bak,
- and call it DELBAK.BAT. Then you type in DELBAK and you'll never find
- yourself behind the eight ball.
- Editor's Note: Using the PrtSc asterisk introduces another
- headache. If you happen to be leaning on a Shift when you hit this
- key, you either get a printed page full of junk if your printer is
- on-line, or a long hang if it's not. The batch file is the best
- solution, and add three lines at the beginning:
- echo off
- echo Ready to del .BAK files
- pause
- This reminds you of what you're doing and gives you one more chance to
- Ctrl-Break out before a valuable backup file vanishes.
-
- -----------------------------------------------------------------
- Global FIND
- (PC Magazine Vol 4 No 6 March 19, 1985 User-to-User)
-
- The only problem with the DOS 2.x command FIND is that you cannot
- use global filename characters in specifying the names of the files you
- want searched. Sometimes you want to search all the files on a disk
- for a particular string, and entering all the filenames is a bother.
- One way to avoid entering all the filenames is to use the FOR
- command. If FIND.EXE is in drive A:, and the disk you want to search
- is in B:, the following command, which must be executed as part of a
- batch file, will search all the files on B: for the string "your
- generous offer":
- FOR %%F IN (B:*.*) DO FIND "your generous offer" IN %%F
- This command executes quickly, but it can go much faster if the
- files being searched are on a RAMdisk. Also, since FIND is an external
- command, it is loaded every time the command is executed so FIND should
- be on a RAMdisk.
- There is one problem to be solved. When FIND examines itself it
- sends the PC into never-never land and has to be rebooted. So FIND
- should be in a different subdirectory. As a remedy, create a
- subdirectory named \FINDSD and copy FIND.EXE into it. Then make the
- root directory the default directory, copy this batch file into it, and
- execute the batch file:
- ECHO OFF
- PATH \FINDSD
- FOR %%F IN (*.*) DO FIND "your generous offer" IN %%F
-
- -----------------------------------------------------------------
- FIND Unquoter
- (PC Magazine Vol 4 No 13 June 25,1985 User-to-User)
-
- As a frequent user of the DOS FIND filter, I grew tired of having
- to enclose each string I was searching for inside quotation marks. I
- figured out how to fix FIND.EXE so that quotes are not necessary (see
- below). The drawback is that his new version of FIND can't search for
- strings containing spaces. I named this utility after the UNIX
- command FGREP.
- - - - - -
- Instructions for changing DOS 3.0 FIND.EXE:
- A>copy find.exe fgrep
- 1 File(s) copied
- A>debug fgrep
- -e 3cc
- xxxx:03CC 75.4e 0A.90
- -e 3e9
- xxxx:03E9 22.20
- -e 3ec
- xxxx:03EC AC.90 3C.90 22.90 74.90
- xxxx:03F0 0F.90 4E.90
- -w
- Writing 18DB bytes
- -q
- A>rename fgrep fgrep.exe
-
- -----------------------------------------------------------------
- Random File SORTs
- (PC Magazine Vol 4 No 10 May 14, 1985 User-to-User)
-
- The SORT filer command in DOS 2.1 does not work satisfactorily.
- The program is supposed to read data from the standard input device,
- sort it and write the data to the standard output device. It can sort
- data in alphabetical order or in reverse alphabetical order and can
- begin the sort on a specified column. The problem is that a programmer
- can specify whatever record length he wants when he loads BASIC.
- Unfortunately, the SORT filter does not know the length of the records
- in a random file since the operation is conducted in DOS, not BASIC.
- There is a way around this problem.
- To tell the SORT filter where each record ends, you must add a
- carriage return and then a line feed at the end of each record. This
- is easily handled by following these steps:
- 1. OPEN the file as usual.
- 2. FIELD the file, adding as the last two variables:
- 1 AS CR$, 1 AS FL$
- 3. LSET as usual with the following two last statements
- LSET CR$=CHR$(13):LSET LF$=CHR$(10)
- Now when the SORT filter begins, it will automatically know where
- each record ends, and the command will work properly. Additionally, if
- you want to examine the actual file using the DOS TYPE command, you
- will notice that each record will begin at the left edge of the screen,
- which makes examining the file much easier. Finally, be sure to allow
- for the extra bytes when OPENing the file.
- Editor's Note: SORT needs carriage returns at the end of each
- record to work properly, and this inserts them properly. But sorting
- random length files can pose problems, for instance, when you're
- sorting on a specified column that isn't there. In any event, it
- would be simple to write a short BASIC program that reads an existing
- random file, adds carriage returns, and writes the data to a new file
- with slightly longer FIELDs so the records could be sorted properly.
-
- -----------------------------------------------------------------
- Five Easy Patches
- (PC Magazine Vol 4 No 24 Nov 26, 1985 User-to-User)
-
- Even DOS 3.1 COMMAND.COM has deficiencies. The first deficiency
- is that whoever wrote COMMAND.COM didn't know how many lines are on a
- standard video display, since the CLS command will clear 26 lines
- rather than the standard 25. While this may not appear to be a
- problem, if you run a program that uses the PC's extra video pages,
- you may find the first line of an extra page mysteriously erased. The
- reason for the error is probably that the video-scroll function in BIOS
- is based on zero-relative values, so the existing COMMAND.COM value of
- 25 actually clears lines 1 through 25, plus line 0.
- To fix this bug, make sure DEBUG and DOS 3.1 COMMAND.COM are on
- your disk and type:
-
- DEBUG COMMAND.COM
- E 263B 18
- W
- Q
- The second problem lies in the DOS 3.1 ECHO command. While
- undocumented, it is an accepted fact that in a batch file an ECHO
- command followed immediately by two spaces will generate a blank line.
- This works on earlier versions of DOS, but not 3.1. Instead of
- displaying a blank line, DOS will return the current status of ECHO.
- Since most batch files start by turning ECHO off, instead of inserting
- clean blank lines, this problem clutters your screen with a lot of
- "ECHO is off" messages. To fix COMMAND.COM so ECHO and two spaces
- will produce a blank line, make sure DEBUG and DOS 3.1 COMMAND.COM
- are on your disk and type:
-
- DEBUG COMMAND.COM
- E 3878 83
- E 3879 F9
- E 387A 02
- E 387B 72
- W
- Q
- Problem three is that COMMAND.COM normally defaults to ECHO ON,
- forcing most users to turn it off in the first line of all their batch
- files. Apart from being a nuisance, this puts an ECHO OFF line on the
- screen. COMMAND.COM handles this default separately for AUTOEXEC.BAT
- and for all other batch files. To turn the default to OFF in both
- cases, make sure DEBUG and DOS 3.1 COMMAND.COM are on your disk and
- type:
-
- DEBUG COMMAND.COM
- E 105B 2
- E 1967 0
- W
- Q
- The fourth and fifth problems are that DOS won't simply print
- the date and time if you request it; instead it will first stop and ask
- you for the new date and time. You can of course just hit the Enter
- key to procede, but this makes it harder to date- and time-stamp your
- files. The way to get aroudn this is to create two new commands,
- DATER and TIMER, that bypass the request for new information and send
- control directly to the routines that print the date and time.
- COMMAND.COM contains a table of familiar words such as DIR,
- RENAME (and REN), ERASE (and DEL), etc., that it examines every time
- you enter a command. Fortunately for anyone wishing to play with the
- command table, three words on the list -- CHDIR, MKDIR and RMDIR --
- are redundant, since every user in the world uses the shorter CD, MD
- and RD versions. This lets us use the space on the table for TIMER
- and DATER. The reason these new commands are five letters long is,
- of course, that they will replace existing five-letter commands.
- The DOS 3.1 COMMAND.COM command table begins at around 4CF4.
- Each entry on the table is made of four parts. The first is a byte
- that specifies how many characters are in the particular command.
- This is followed by the command itself. After the text of the command
- is a byte that seems to tell DOS whether the command needs an argument,
- may have an argument, or never requires an argument. Both TIMER and
- DATER don't need an argument, so this byte will be 0. The fourth part
- is the 2-byte address of the routine that COMMAND.COM will transfer
- control to.
- To change CHDIR to DATER, make sure DEBUG and DOS 3.1 COMMAND.COM
- are on your disk and type:
-
- DEBUG COMMAND.COM
- E 4D7D "DATER"
- E 4D82 0
- E 4D83 2E
- E 4D84 26
- W
- Q
- To change MKDIR to TIMER, type:
-
- DEBUG COMMAND.COM
- E 4D8C "TIMER"
- E 4D91 0
- E 4D92 DF
- E 4D93 1E
- W
- Q
- While these patches are for DOS 3.1 only, some of them can be
- adapted to earlier versions of COMMAND.COM.
- Editor's Note: While some might argue that it's bad to use an
- undocumented feature like the ECHO+space+space above, once users learn
- about it they will incorporate it into their programs as if it were in
- the manual. Once you've made all the changes, you either have to
- reboot your system to install the patched COMMAND.COM, or invoke it as
- a secondary command processor by typing COMMAND. A nifty way to reboot
- automatically by using DEBUG is to create a file called RB that
- contains the five lines:
-
- rcs
- ffff
- rip
- 0000
- g
-
- Make sure you include a carriage return at the end of each line. Then
- create a batch file called REBOOT.BAT that contains the one line:
-
- DEBUG < RB
-
- Be certain that DEBUG.COM is on your current directory, or that you
- PATH to it.
-