To Run this demonstration
=========================

To run this demonstration, drag all these files into a temporary directory.

At the DOS prompt, issue the command:
Stage2.com Kwic2.s2m


You should see a stream of text appear on your screen, aligned around column 40.


Brief description of the process
================================


The following demonstration shows how a simple STAGE2 macro can replace about three hundred lines of COBOL.  This example is derived from a transportable keyword-in-context processor, written in COBOL but now implemented in STAGE2.  The essence of the set of macros can be expressed as :

        !^!
        !f1
        111111111111111111111 22222222222222222222
        !10!20

which reads "For any line of the form <some-text> <caret> <some-text>, output (in aligned format) the first chunk of text followed by a space character then the second chunk of text, then re-scan the line without the caret first discovered, until there are no more carets in the text". 

#!#!0 (+-*/) STAGE2 macro templates for the KeyWord In Context (KWIC) processor
END
END OF STAGE2 TRANSLATION!F1
!F0
#
<! !
sto item !10
#
sto ! !
!f3
#
!^!
fmt item !10^!20
!10 !20
#
fmt ! !^!
frmt !11^!20^!30
#
frmt !^!^!
!f14
11111111 22222222222222222222222222222 33333333333333333333333333333
##
<BYTEMY84 volume 9 number 5
^Trump Card: ^Hardware - ^speed up your IBM PC with ^16-bit ^coprocessing power by Steve ^Ciarca 
User's column - Dirty ^filters - ^8/16-bit land - views of the future 
BYTE West coast: ^Bulletin boards in ^space - Amateur ^radio pioneering promises low-cost ^global ^communications by John ^Markoff 
A Professional's perspective on ^user-friendliness by William J. ^Raduchel 
<BYTEFE85 Volume 10 Number 2 
The ^HP Integral Personal Computer - Hewlett-Packard's new all-in-one system makes ^UNIX truly ^portable by Phillip ^Robinson
Ciarcia's Circuit Cellar: Build a ^Serial ^EPROM ^Programmer - Steve devises an affordable version of an essential ^tool for hackers by Steve ^Ciarcia
The ^Macintosh Office - ^AppleTalk ^networks the Macintosh and its new ^laser printer by John ^Markoff and Phillip ^Robinson
END 
Christopher Greaves Saturday February 18, 1989 

This is not a true KeyWord-In-Context (KWIC) processor.  It is a 
crude demonstration of how easily the STAGE2 macro-processor can 
be used as a text-processor.

Each magazine, journal, or set of notes has an external 
identifier, visible on the spine of the journal, or as an 
adhesive tab on a folder in a filing cabinet.  The external 
identifier serves to locate the item on the shelf storage.  A 
Dewey Decimal number and Cutter number system would be effective.  

The identifier is encoded here with a prefix of "<", found as 
Shift-comma on most IBM-compatible keyboards.  The first item to 
be indexed is an issue of BYTE magazine from May 1984.  the 
second item in our collection is BYTE for February 1985. 

Each item (magaizine, journal, notes) has a set of articles, and 
we have encoded one article per line.  Within each article we 
have tagged keywords with the character "^" found as Shift-6 on 
most IBM-compatible keyboards.

The macros spit out one line of each text for each keyword, with 
the keyword aligned in column 40.  We take the output file (from 
channel 4) and sort it on column 40 with a case-insensitive sort 
to produce the KWIC index (which appears below).

 1       10        20        30        40        50        60        70
 BYTEMY84  Trump Card part 1:  Hardware 16-bit ^coprocessing power by
 BYTEMY84 User's column - Dirty  filter 8/16-bit land - views of the 
 BYTEMY84  Trump Card part 1:  Hardware Ciarca                       
 BYTEMY84  Trump Card part 1:  Hardware coprocessing power by Steve ^
 BYTEMY84 User's column - Dirty         filters - ^8/16-bit land - vi
 BYTEMY84  Trump Card part 1:           Hardware - ^speed up your IBM
 BYTEMY84  Trump Card part 1:  Hardware speed up your IBM PC with ^16
 BYTEMY84                               Trump Card part 1: ^Hardware 

This entire file can be input to STAGE2; lines past the "END" 
statement will be ignored by Stage2.

