home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / BASIC / POWBASIC / LIBRARY4 / READ123.BAS < prev    next >
BASIC Source File  |  1993-12-01  |  3KB  |  103 lines

  1. 'Read123.bas
  2. DEFINT A-Z
  3. DECLARE SUB GetFormat (Format, Row, Column)
  4.  
  5. DIM SHARED FileNum
  6. DIM SHARED CellFmt AS STRING * 1
  7.  
  8. CLS
  9. DO
  10.    INPUT "Enter name of Lotus file to read: ", FileName$
  11.    IF FileName$ = "" THEN FILES "*.w?"
  12. LOOP UNTIL LEN(FileName$)
  13.  
  14. FileNum = FREEFILE
  15. OPEN FileName$ FOR BINARY AS #FileNum
  16.  
  17. DO UNTIL Opcode = 1
  18.    GET FileNum, , Opcode
  19.    GET FileNum, , Length
  20.  
  21.    SELECT CASE Opcode
  22.      
  23.       CASE 0
  24.          GET FileNum, , Integ
  25.         
  26.          IF Integ < 1028 OR Integ > 1030 THEN ' test this if you want
  27.             PRINT "Not a Lotus FIle !"
  28.             END
  29.          END IF
  30.         
  31.          PRINT "BOF:  Lotus ";
  32.          SELECT CASE Integ
  33.              CASE 1028
  34.                 PRINT "123 version 1.0 or 1A"
  35.              CASE 1029
  36.                 PRINT "Symphony version 1.0"
  37.              CASE 1030
  38.                 PRINT "123 version 2.0, 2.1 or Symphony version 1.1"
  39.          END SELECT
  40.       
  41.       CASE 12                     'Blank - Notee: Lotus saves cells only
  42.                                   'if they are formatted or protected
  43.          GetFormat Format, Row, Column
  44.          PRINT "Blank:  "; Format, "Row ="; Row, "Col ="; Column
  45.  
  46.       CASE 13                     'Integer
  47.          GetFormat Format, Row, Column
  48.          GET FileNum, , Integ
  49.          PRINT "Integer:"; Format, "Row ="; Row, "Col ="; Column
  50.      
  51.       CASE 14                     'Real number (BASIC double precision type)
  52.          GetFormat Format, Row, Column
  53.          GET FileNum, , Number#
  54.          PRINT "Number: "; Format, "Row ="; Row, "Col ="; Column, Number#
  55.  
  56.       CASE 15 'Label
  57.          GetFormat Format, Row, Column  'Create a string to hold the label
  58.          Info$ = SPACE$(Length - 6)
  59.                                         '6 is subtracted to exclude the
  60.                                         ' Format, Column, Row, and 0 bytes
  61.                                         'that were included in the original
  62.                                         'length byte (already gotten by the
  63.                                         'GetFormat routine)
  64.          GET FileNum, , Info$           'get the label text
  65.          GET FileNum, , CellFmt$        'gobble up the trailing chr$(0) byte
  66.          PRINT "Label:  "; Format, "Row ="; Row, "Col ="; Column, Info$
  67.      
  68.       CASE 16                   'Forumla
  69.          GetFormat Format, Row, Column
  70.          GET FileNum, , Number#
  71.          GET FileNum, , Length
  72.          SEEK FileNum, SEEK(FileNum) + Length
  73.  
  74.          PRINT "Formula :"; Format, "Row ="; Row, "Col ="; Column, Number#
  75.      
  76.       CASE ELSE
  77.  
  78.          Dummy$ = SPACE$(Length)
  79.          GET FileNum, , Dummy$
  80.          PRINT "Opcode: "; Opcode 'Show its opcode just for fun
  81.      
  82.       END SELECT
  83.  
  84.       IF CSRLIN > 21 THEN
  85.          PRINT : PRINT "Press <Esc> to end or any other key for more . . ."
  86.          DO: k$ = INKEY$: LOOP UNTIL LEN(k$)
  87.          IF k$ = CHR$(27) THEN EXIT DO
  88.          CLS
  89.       END IF
  90.      
  91.       Cntr = Cntr + 1
  92. LOOP
  93.  
  94. PRINT "Number of Records Processed ="; Cntr
  95. CLOSE
  96.  
  97. SUB GetFormat (Format, Row, Column)
  98. GET FileNum, , CellFmt$: Format = ASC(CellFmt$)
  99. GET FileNum, , Column
  100. GET FileNum, , Row
  101. END SUB
  102.  
  103.