# FM3 Changing From Topspeed to SQL(ODBC) does not copy/convert existing files

**URL:** <https://clarionhub.com/t/fm3-changing-from-topspeed-to-sql-odbc-does-not-copy-convert-existing-files/7175>\
**Category:** questions\
**Tags:** odbc, fm3, tps\
**Created:** [May 20, 2024, 2:50am UTC](https://clarionhub.com/t/fm3-changing-from-topspeed-to-sql-odbc-does-not-copy-convert-existing-files/7175 "2024-05-20T02:50:41Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![xxetfxx](https://clarionhub.com/user_avatar/clarionhub.com/xxetfxx/32/5215_2.png) [@xxetfxx](https://clarionhub.com/u/xxetfxx)\
**Post date:** [May 20, 2024, 2:50am UTC](https://clarionhub.com/t/fm3-changing-from-topspeed-to-sql-odbc-does-not-copy-convert-existing-files/7175/1 "2024-05-20T02:50:41Z")

</div>

Hi,

I am trying to convert my tps files to sql by changing first the file driver from topspeed to odbc driver on the dictionary, and then together with the help of fm3.

I tried testing this sample odbc app provided by fm3.  
[odbc.zip](https://clarionhub.com/uploads/short-url/5zmCBkR5g2LmbkCakeI6J37sQFZ.zip) (2.2 MB)

When I tried running Run time file manager, it successfully created the tables, but it has 0 records converted.

 ![image](https://clarionhub-uploads.s3.dualstack.eu-north-1.amazonaws.com/original/2X/e/e5ba464a832c3d8cbe3859a88fc72a640abf9326.png)  
Am I missing something? Or the documentation itself says that copying only works on flat files?  
 ![image](https://clarionhub-uploads.s3.dualstack.eu-north-1.amazonaws.com/original/2X/d/d68b77199bdd20fa95832352e60b5b3a98683bc3.png)

---

<div class="post-metadata">

**Author:** ![Edvard\_Korsbaek](https://clarionhub.com/user_avatar/clarionhub.com/edvard_korsbaek/32/534_2.png) [@Edvard\_Korsbaek](https://clarionhub.com/u/Edvard_Korsbaek)\
**Post date:** [May 21, 2024, 9:37am UTC](https://clarionhub.com/t/fm3-changing-from-topspeed-to-sql-odbc-does-not-copy-convert-existing-files/7175/2 "2024-05-21T09:37:02Z")

</div>

I think that you shold send this directly to Bruce.  
I gave up myself on FM3 when i changed to MSSQL, and have made a program called “Totalupdate” instead for each of my dct’s.

---

<div class="post-metadata">

**Author:** ![xxetfxx](https://clarionhub.com/user_avatar/clarionhub.com/xxetfxx/32/5215_2.png) [@xxetfxx](https://clarionhub.com/u/xxetfxx)\
**Post date:** [May 21, 2024, 9:51am UTC](https://clarionhub.com/t/fm3-changing-from-topspeed-to-sql-odbc-does-not-copy-convert-existing-files/7175/3 "2024-05-21T09:51:01Z")

</div>

May I know atleast a bit of info on how that works? I have created a converter where i have a function and only pass the file as parameter and manually deep assign columns of old tps file to new sql file. But that’s only usable to one dictionary that I need to convert to. [Procedure Passing Two File and Record Parameters for deep assign](https://clarionhub.com/t/procedure-passing-two-file-and-record-parameters-for-deep-assign/4153).

---

<div class="post-metadata">

**Author:** ![PurpleEdge2214](https://clarionhub.com/user_avatar/clarionhub.com/purpleedge2214/32/5109_2.png) [@PurpleEdge2214](https://clarionhub.com/u/PurpleEdge2214)\
**Post date:** [May 22, 2024, 2:43am UTC](https://clarionhub.com/t/fm3-changing-from-topspeed-to-sql-odbc-does-not-copy-convert-existing-files/7175/4 "2024-05-22T02:43:19Z")

</div>

I was pretty sure that File Manager also creates the conversion program that you can run to convert your data, so presumably there is a step for that somewhere?

You also seem to have your own conversion process is there a reason why you haven’t used that to convert your data?

---

<div class="post-metadata">

**Author:** ![xxetfxx](https://clarionhub.com/user_avatar/clarionhub.com/xxetfxx/32/5215_2.png) [@xxetfxx](https://clarionhub.com/u/xxetfxx)\
**Post date:** [May 22, 2024, 3:54am UTC](https://clarionhub.com/t/fm3-changing-from-topspeed-to-sql-odbc-does-not-copy-convert-existing-files/7175/5 "2024-05-22T03:54:27Z")

</div>

I have to recreate again using the dictionary that I want to convert, and another cons in using my own conversion process is I need to have a tps table and odbc table, but in fm3 you only manage version and upg file  
 ![image](https://clarionhub-uploads.s3.eu-north-1.amazonaws.com/original/2X/5/51bb742319891a95909f82793f9724d4a1a8a7ca.png)

---

<div class="post-metadata">

**Author:** ![Bruce](https://clarionhub.com/letter_avatar_proxy/v4/letter/b/ccd318/32.png) [@Bruce](https://clarionhub.com/u/Bruce)\
**Post date:** [May 22, 2024, 3:57am UTC](https://clarionhub.com/t/fm3-changing-from-topspeed-to-sql-odbc-does-not-copy-convert-existing-files/7175/6 "2024-05-22T03:57:44Z")

</div>

When setting it up to convert from TPS to SQL are you setting the OldName option?

How are you doing multiple dstabases? Are you using Multiproj, or something else?

---

<div class="post-metadata">

**Author:** ![xxetfxx](https://clarionhub.com/user_avatar/clarionhub.com/xxetfxx/32/5215_2.png) [@xxetfxx](https://clarionhub.com/u/xxetfxx)\
**Post date:** [May 22, 2024, 4:04am UTC](https://clarionhub.com/t/fm3-changing-from-topspeed-to-sql-odbc-does-not-copy-convert-existing-files/7175/7 "2024-05-22T04:04:22Z")

</div>

Yes I have setup OldName Option.  
I am not doing multiple databases and multi-proj.

 ![image](https://clarionhub-uploads.s3.eu-north-1.amazonaws.com/original/2X/f/fa7d3cea59d336e645e01513ea36528e4b822094.png)

I used variable in defining file names and set it before fm3 procedure assigning using SetFileName() procedure

 ![image](https://clarionhub-uploads.s3.eu-north-1.amazonaws.com/original/2X/9/99b3f679b944b0867f7018bc1a245a27375ac3bd.png)

my settings is based on odbc sample provided by fm3

---

<div class="post-metadata">

**Author:** ![Bruce](https://clarionhub.com/letter_avatar_proxy/v4/letter/b/ccd318/32.png) [@Bruce](https://clarionhub.com/u/Bruce)\
**Post date:** [May 22, 2024, 4:29am UTC](https://clarionhub.com/t/fm3-changing-from-topspeed-to-sql-odbc-does-not-copy-convert-existing-files/7175/8 "2024-05-22T04:29:59Z")

</div>

The variable for filenames only has to be set before the file is opened. Its not used in the upg.

I’m not seeing the OldName option being set there?

The copy will only happen when the SQL table is created, so make sure you drop the table from the db before conversion.

Did you run the “SupportABC” utility template?

---

<div class="post-metadata">

**Author:** ![xxetfxx](https://clarionhub.com/user_avatar/clarionhub.com/xxetfxx/32/5215_2.png) [@xxetfxx](https://clarionhub.com/u/xxetfxx)\
**Post date:** [May 22, 2024, 5:23am UTC](https://clarionhub.com/t/fm3-changing-from-topspeed-to-sql-odbc-does-not-copy-convert-existing-files/7175/9 "2024-05-22T05:23:17Z")

</div>

May I know where can I set the OldName Option? I only know the OldName is set on dictionary

 ![image](https://clarionhub-uploads.s3.eu-north-1.amazonaws.com/original/2X/b/b130588ff04736dd9d2501656498eb38734e5cff.png)  
And to assign the variable filename I follow this guide  
 ![image](https://clarionhub-uploads.s3.eu-north-1.amazonaws.com/original/2X/2/225be0f6a22f06cba866403eecd4820d37039f14.png)

In my SetFileName() Procedure have this code

```auto
SetFileNames PROCEDURE
  CODE
PATH:Branch = CLIP(GLO:DataSource) & '\branch.dat'  

```

where this is under the `After PROGRAM CODE statement` embed

```auto
  CODE
  SetFileNames()
  GlobalErrors.Init(GlobalErrorStatus)
  FuzzyMatcher.Init ! Initilaize the browse 'fuzzy matcher'
  FuzzyMatcher.SetOption(MatchOption:NoCase, 1) ! Configure case matching
  FuzzyMatcher.SetOption(MatchOption:WordOnly, 0) ! Configure 'word only' matching
  INIMgr.Init('.\sql_convert.INI', NVD_INI) ! Configure INIManager to use INI file
  DctInit()
   ! Generated using Clarion Template version v11.1 Family = abc
    ds_SetOption('fm3callbackaddress',address(MyFM3Callback))
    ds_FM_Upgrading &= ds_PassHandleForUpgrading()
    if ds_FMInited = 0
      ds_FMInited = 1
        ds_SetOption('inifilename','.\fm3.ini')
    SQL_Connect() ! Generated by FM3
      ds_SetOption('BadFile',1)
      ds_AddDriver('Tps',gTopSpeedFile,__gtps:record)
      ds_AddDriver('odb',gOdbcFile,__godb:record)
      !***
  
  
      ds_IgnoreDriver('AllFiles',1)
        ds_SetOption('DctMasterFields',1)
        ds_SetOption('DctMasterKeys',1)
      ds_SetOption('SPCreate',1)
      ds_SetOption('ZeroNull',1)
      ds_SetOption('GUIDsCaseInsensitive',1)
    ds_UsingFileEx('Branch',Branch,2+ds_VersionModifier,'Branch')
                ds_AlternateFileNameAndOwner('' & PATH:Branch & '','Branch',Branch,)
        if GetIni(ds_AppName(),'BadFile',,'.\fm3.ini')
          RuntimeFilemanager ! this line placed by the FM3 "Auto Fix" option.
                       ! If you have this procedure, and you're making an abc app
                       ! and you still get an error here then check that the "declare
                       ! globally" setting is also set ON for this procedure.
        end
              omit('***',FM2=1)
              !! Don't forget to add the FM2=>1 define to your project
              You did forget didn't you ?
              ! close this window - go to the app - click on project - click on properties -
              ! click on the defines tab - add FM2=>1 to the defines...
            !***
    End !End of if ds_FMInited = 0
  GLO:FM3Done = 1
  RuntimeFilemanager
  INIMgr.Update
    ds_FMKill() ! Placed by FM2/3
  INIMgr.Kill ! Destroy INI manager
  FuzzyMatcher.Kill ! Destroy fuzzy matcher

```

I have also run SupportABC utility template still no luck.

For reference, you can try this sample provided by fm3. I also haven’t been able to convert tps files to sql here via odbc using dsn connectivity. It only creates the sql tables but doesn’t copy the records  
[odbc.zip](https://clarionhub.com/uploads/short-url/5zmCBkR5g2LmbkCakeI6J37sQFZ.zip) (2.2 MB)
