home *** CD-ROM | disk | FTP | other *** search
/ CICA 1992 November / CICA_MS_Windows_CD-ROM_Walnut_Creek_November_1992.iso / win3 / misc / cica2cq / cica2cq.bas next >
BASIC Source File  |  1992-09-10  |  2KB  |  66 lines

  1.     '   Program Name:    CICA2CQ.BAS
  2.     '     Written by:    William C. Kotheimer Jr.
  3.     '           Date:    10 September 1992
  4.     '          Using:    MicroSoft QBasic
  5.     '    Description:    Converts CICA index file into a comma-and-quotes
  6.     '                    text file that can be converted into an X.dbf
  7.     '                    format file by many PC-based DBMS'
  8.  
  9.     '***  Opening banner
  10.     CLS
  11.     PRINT "     CICA INDEX TO DATABASE COMMA AND QUOTES FILE"
  12.     PRINT "             Written by Will Kotheimer"
  13.     PRINT " "
  14.    
  15.     '***  Get Cica index file name and output file name
  16.     PRINT " Using full path and file names,"
  17.     INPUT " Enter CICA index file name:    ", CICA$
  18.     INPUT "     Enter OUTPUT file name:    ", CICAOUT$
  19.    
  20.     '***  Open Output and input files
  21.     OPEN CICAOUT$ FOR OUTPUT AS #1
  22.     OPEN CICA$ FOR INPUT AS #2
  23.     CLS
  24.    
  25.     ' *** Read lines from input file
  26.     CLS
  27.     PRINT "    BEGINNING PROCESSING"
  28.     PRINT " "
  29.     DIR$ = " "
  30.     FIRST$ = " "
  31.     DO WHILE NOT EOF(2)
  32.         LINE INPUT #2, REC1$   'Read entries from file.
  33.         FIRST$ = LEFT$(REC1$, 1)
  34.         IF FIRST$ = "*" THEN  ' Test for breaks between directory listings
  35.                 FOR I = 1 TO 80
  36.                         TEST$ = MID$(REC1$, I, 1)
  37.                         IF TEST$ = "~" THEN ' Test for directory name start
  38.                                 B = I + 17
  39.                                 DIR$ = MID$(REC1$, B, 20)
  40.                                 FOR J = 1 TO 20 'Test for dir name end
  41.                                         IF MID$(DIR$, J, 1) = " " THEN
  42.                                                 DIR$ = LEFT$(DIR$, J)
  43.                                                 J = 20
  44.                                         END IF
  45.                                 NEXT J
  46.                        PRINT "PROCESSING DIRECTORY "; DIR$
  47.                        END IF
  48.                 NEXT I
  49.         ELSEIF FIRST$ <> " " THEN ' Reading in name, date, description
  50.                 NAME$ = MID$(REC1$, 1, 12)
  51.                 DTG$ = MID$(REC1$, 17, 6)
  52.                 DESCRPT$ = MID$(REC1$, 25, 55)
  53.                 IF NAME$ <> "" THEN
  54.                 WRITE #1, NAME$, DIR$, DTG$, DESCRPT$
  55.                 END IF
  56.         END IF
  57.     LOOP
  58.  
  59.     ' *** Closing files
  60.     CLOSE #1
  61.     CLOSE #2
  62.     PRINT "    PROCESSING COMPLETED"
  63.     PRINT "    FILE "; CICAOUT$; " GENERATED"
  64.     END
  65.  
  66.