* -      -----------------------------------------
* -      |  LOGSORT.CMD a subroutine of LOG.CMD  |
* -      |  Permits indexing on any field and    |
* -      | copying to another file with the index|
* -      |  Written by Orbra W. Bliss  2/4/85    |
* -      -----------------------------------------
* - Updated as of 2/16/85
* -
ERASE
LIST FILES ON &MDRV
@ 10,1 SAY 'What is the name of the file to be indexed?' GET MFILE
READ
STORE !(TRIM(MFILE)) TO MFILE
USE &MDRV.:&MFILE
ERASE
@  6,10  SAY 'Index on which field ?'
@  8,10  SAY '1) Date         6) RPT'
@  9,10  SAY '2) Time         7) Band'
@ 10,10  SAY '3) Station      8) Mode'
@ 11,10  SAY '4) Name         0) Return to menu'
@ 12,10  SAY '5) QTH'
WAIT TO CHOICE
DO CASE
   CASE CHOICE = '1'
        INDEX ON $(DATE,7,2)+$(DATE,1,6) TO &MDRV.:DATE
        ?
?'         &MDRV.:&MFILE is now indexed with &MDRV.:DATE.NDX'
        STORE 'DATE.NDX' TO MNDX
   CASE CHOICE = '2'
        INDEX ON TIME TO TIME
?'         &MDRV.:&MFILE is now indexed with &MDRV.:TIME.NDX'
        STORE 'TIME.NDX' TO MNDX
   CASE CHOICE = '3'
        INDEX ON STATION TO STATION
?'         &MDRV.:&MFILE is now indexed with &MDRV.:STATION.NDX'
        STORE 'STATION.NDX' TO MNDX
   CASE CHOICE = '4'
        INDEX ON NAME TO NAME
?'         &MDRV.:&MFILE is now indexed with &MDRV.:NAME.NDX'
        STORE 'NAME.NDX' TO MNDX
   CASE CHOICE = '5'
        INDEX ON QTH TO QTH
?'         &MDRV.:&MFILE is now indexed with &MDRV.:QTH.NDX'
        STORE 'QTH.NDX' TO MNDX
   CASE CHOICE = '6'
        INDEX ON RPT TO RPT
?'         &MDRV.:&MFILE is now indexed with &MDRV.:RPT.NDX'
        STORE 'RPT.NDX' TO MNDX
   CASE CHOICE = '7'
        INDEX ON BAND TO BAND
?'         &MDRV.:&MFILE is now indexed with &MDRV.:BAND.NDX'
        STORE 'BAND.NDX' TO MNDX
   CASE CHOICE = '8'
        INDEX ON MODE TO MODE
?'         &MDRV.:&MFILE is now indexed with &MDRV.:MODE.NDX'
        STORE 'MODE.NDX' TO MNDX
   CASE CHOICE = '0'
        RETURN
ENDCASE
 
@ 15,1 SAY ' Do you want to copy to another .DBF file using this index? Y/N'
WAIT TO ANSWER
IF !(ANSWER) = 'Y'
   ERASE
   STORE '          ' TO NUFILE
   @ 18,10 SAY 'Include Drive designation if Not Logged drive.'
   @ 17,10 SAY 'Enter the name of the receiving file.' GET NUFILE
   READ
   USE &MDRV.:&MFILE INDEX &MDRV.:&MNDX
   COPY TO &NUFILE
ENDIF
RETURN
