Print Listings the Easy Way
~~~~~~~~~~~~~~~~~~~~~~~~~~~

<PROGRAM: EASYLIST.BAS>
What you need to use this program:  MS-DOS, QBASIC or QuickBASIC

"Programmers, use this program to print your listings from DOS: it tracks 
down and prints all modules neatly in one step"

                     PRINT LISTINGS THE EASY WAY
                           by Henry Green

   Recently I wrote a large application program in Turbo BASIC. As you 
would expect, it was constructed of numerous procedures and other modules 
-- enough to fill a notebook, in fact. As the program evolved, keeping 
track of its many components became increasingly difficult. Printing 
updated listings was time-consuming and required entry of many separate 
commands. I finally solved the problem by developing EasyList, a program 
that lets me list one or many modules in a neatly formatted way and with 
no more effort than invoking a single batch file.

   Unlike other program listers, EasyList can be executed from DOS and 
permits the use of command-line parameters. Thus it can be called from a 
batch file.

   The first line of the listing is printed in boldface type and serves as 
the title of the listing. The system date is included in the file. The 
pages are numbered, and each page bears the same title and date. A margin 
is left at the top and bottom of each page, and a form feed is executed at 
the end of the printout.


About the Program

   While I wrote EasyList in Turbo BASIC, it should be simple to convert 
to QuickBASIC or even conventional BASIC. (Editor's note: In order to 
enable the program to run in QBASIC, we changed the statement INCR I to I 
=I + 1 and the statement INCR page to page = page + 1. You can also 
compile this program listing in QuickBASIC for faster operation.) It 
begins with an error trap that warns the user if he has entered a filename 
nonexistent in the current or specified directory. The main program, 
consisting of a self-explanatory IF/THEN routine, follows.

   Two procedures are used. PRINTIT prints the file, counting the lines 
and pages and adding the date. Note that when the line counter reaches 51, 
a form feed is executed and the line counter reset. The variable TITLE is 
merely a flag to indicate whether the first line of the program has been 
copied into the variable TITLE$. The INSTRUCTIONS procedure prints 
instructions if the user fails to provide a filename or provides one that 
is unavailable.

   The printer codes used for turning on and off boldface characters are 
commonly ESC "E" and ESC "F", respectively. These codes are used by Epson, 
Panasonic and many other printers. If your printer is another brand, 
however, changing these codes is simple.


Using the Program

   EasyList can be used by itself to perform a printout of any ASCII-saved 
file. This can be a Turbo BASIC, Pascal or other language batch or 
document file. The syntax is EASYLIST FILENAME.EXT if the file is in your 
current directory -- or EASYLIST C:\DIRNAME\FILENAME.EXT if it's in 
another directory or on another drive.

   The program is most effective when used in a batch file with 
replaceable parameters. It can then be used to list all files fulfilling 
specific criteria. (This might be all files within a specific 
subdirectory, all files with a certain extension, etc.) The batch file I 
use is:

      CLS
      PAUSE THIS PRINTS ALL FILES WITH THE .INC EXTENSION
      FOR %%F IN (*.INC) DO EASYLIST %%F

This small batch file prints all the files in my $INCLUDE list, since they 
all have the extension .INC.

                                  -=*=-

               Henry Green is a cardiologist who writes 
            programs for medical applications. His work 
            has appeared in numerous medical and technical
            publications. He can be reached at 22250 
            Providence Drive, #600, Southfield, MI 48075.

-=--------------        -=*=-     -=*=-     -=*=-        --------------=-
