home *** CD-ROM | disk | FTP | other *** search
- * Program.: S-JOIN.PRG
- * Author..: Luis A. Castro
- * Date....: 01/11/83, 01/17/84, 06/24/84
- * Notice..: Copyright 1983 & 1984, Luis A. Castro, All Rights Reserved
- * Version.: dBASE II, version 2.4x
- * Notes...: A command file that simulates the JOIN command.
- *
- SET TALK OFF
- *
- * ---The parameters may be initialized with STORE statements
- * ---or entered from the keyboard with ACCEPT statements
- * ---(i.e. the STORE verbs could be changed to ACCEPT verbs).
- STORE "FIRST" TO firstfile
- STORE "SECOND" TO secondfile
- STORE "JOIN-TO" TO joinfile
- STORE "Lastname+Firstname" TO key:expr
- *
- * ---Initialize macro to REPLACE to joinfile from secondfile.
- * ---Assumes only Name and Amount fields need replacing.
- STORE "Name WITH S.Name, Amount WITH S.Amount" TO Mreplace
- *
- * ---Joinfile has all the desired fields to be JOINed.
- * ---It is created before the program is executed,
- * ---and contains no records.
- SELECT PRIMARY
- USE &joinfile
- APPEND FROM &firstfile
- GO TOP
- SELECT SECONDARY
- * ---Assumes the second file and index file have the same name.
- USE &secondfile INDEX &secondfile
- SELECT PRIMARY
- DO WHILE .NOT. EOF
- STORE &key:expr TO mkey
- SELECT SECONDARY
- FIND &mkey
- IF # <> 0
- * ---A matching record.
- SELECT PRIMARY
- * ---REPLACE to joinfile from secondfile.
- REPLACE &Mreplace
- ENDIF
- SELECT PRIMARY
- SKIP
- ENDDO
- CLEAR
- SET TALK ON
- RETURN
- * EOF: S-JOIN.PRG