#!/usr/bin/mumps

      s i=$zsqlite("pragma","journal_mode=off")
      s i=$zsqlite("pragma","synchronous=off")

      w "pragma journal_mode=off;",!
      w "pragma synchronous=off;",!

      open 1:"insurance,old"
      use 1
      set i=0
      for  do
      . read a
      . i '$t break
      . s i=i+1
      . s code=$p(a," ",1)
      . s ins=$p(a," ",2,99)
      . s ^insurance(i,code,ins)=""
      close 1
      s ^insurance=i-1

      use 5
      write "drop table if exists patientId;",!
      write "drop table if exists insurers;",!
      write "create table insurers (insurer_code char(10), insurer varchar(100), primary key (insurer_code) );",!
      write "begin transaction;",!
      for i=$o(^insurance(i)) do
      . set code=$o(^insurance(i,""))
      . set name=$o(^insurance(i,code,""))
      . write "insert into insurers values ('",name,"','",code,"');",!
      write "end transaction;",!

      set ^Tran(0)=1
