home *** CD-ROM | disk | FTP | other *** search
- * Program.: S-TOTAL.PRG
- * Author..: Luis A. Castro
- * Date....: 01/11/83, 01/17/84, 06/24/84
- * Notice..: Copyright 1983 & 1984, Ashton-Tate, All Rights Reserved
- * Version.: dBASE II, version 2.4x
- * Notes...: A command file that simulates the TOTAL 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 "MASTER" TO masterfile
- STORE "TOTAL" TO totalfile
- STORE "Lastname" TO key:field
- STORE "Cost" TO field:01
- STORE "Quantity" TO field:02
- *
- SELECT PRIMARY
- USE &masterfile
- * ---Create the total file.
- COPY STRUCTURE TO &totalfile;
- FIELD &key:field, &field:01, &field:02
- SELECT SECONDARY
- USE &totalfile
- SELECT PRIMARY
- DO WHILE .NOT. EOF
- STORE &key:field TO mkey
- STORE 0 TO mfield:01, mfield:02
- *
- * ---Total numeric fields with duplicate key fields.
- DO WHILE &key:field = mkey .AND. .NOT. EOF
- STORE &field:01 + mfield:01 TO mfield:01
- STORE &field:02 + mfield:02 TO mfield:02
- SKIP
- ENDDO
- SELECT SECONDARY
- * ---Enter result into the total file.
- APPEND BLANK
- REPLACE &key:field WITH mkey,;
- &field:01 WITH mfield:01,;
- &field:02 WITH mfield:02
- SELECT PRIMARY
- ENDDO
- CLEAR
- SET TALK ON
- RETURN
- * EOF: S-TOTAL.PRG