Handling Columnar Records (Another way)

Another way to to handle the previous example is to use Timport's built-in ability to automatically separate out data from fixed width columns. Two changes to the above example schema will be all that's required. First, replace recexpr with format specifying a format style of col. Second replace the tag subexpression numbers with column positions. Columns begin counting with 1. Column positions may be a range, as in {bf 15-22} meaning character columns 15 through 22 inclusive. You may specify a variable width column as the last field in the record by specifying a range with no ending position, as in 24- which means column 24 through end of line.

The schema format for this is as listed in the schema file log2.sch:

  #
  # Import an ASCII transaction log into Texis
  # Example of columnar records
  #
  database /tmp/testdb
  table    log
  col
  datefmt  yy-mm-dd HHMM
  trimspace
  keepfirst
  #          name    type            tag
  field      Date    date            1-13
  field      Future  char            14
  field      Who     varchar         15-22
  field      What    varchar         24-

  # Example input file (remove leading '#').
  #95-04-21 1300 mike     john smith - acme rockets, called for pricing
info
  #95-04-21 1301 bob      jane doe - text 'r' us, called for joe,
regarding ret'ing some voice mail software
  #95-04-21 1800*sally    remember telephone maintenance tomorrow
morning


Copyright © Thunderstone Software     Last updated: Dec 10 2018
Copyright © 2019 Thunderstone Software LLC. All rights reserved.