CLS

PRINT
PRINT "   GERA O ARQUIVO MG050.CSV   "
PRINT

OPEN "MG050.CSV" FOR OUTPUT AS #2
WRITE #2, "CLASSE", "GR1", "GR2", "GR3", "GR4", "GR5", "GR6", "GR7"

OPEN "Dados.txt" FOR INPUT AS #1
WHILE NOT EOF(1)
    INPUT #1, ARQ$
    ARQUIVO$ = ARQ$ + ".CSV"
    PRINT ARQUIVO$
    OPEN ARQUIVO$ FOR INPUT AS #3
    LINE INPUT #3, LINHA$
    WHILE NOT EOF(3)
        INPUT #3, COD$, PLACA$, CLASSE$, GR1, GR2, GR3, GR4, GR5, GR6, GR7, PBt
        WRITE #2, CLASSE$, GR1, GR2, GR3, GR4, GR5, GR6, GR7
    WEND
    CLOSE #3
WEND
CLOSE #1, #2

SYSTEM
