Navigation:  CodeBase >

Btrieve to Codebase

Print this Topic Previous pageReturn to chapter overviewNext page

TAS professional has at this time of writing 2 native databases it can work with Btrieve/Pervasive and Codebase. the codebase type database is a DBF type database. Please do not under estimate this type of data base it is very fast and easy to work with I am at this time converting Our Advanced Accounting that has always been Btrieve for the most part... to a pure codebase version... as I go thru all of these programs I am going to write down the changes I had to make to make the programs work.

Data base changes

All type V fields have to be deleted and add these field names as segmented keys. if you used this field for example in a scan Start myvfield you need to change it to Start seg1,seg2,seg3

 

You need to make sure you convert any Open command to Openv

 

Findv in pervaisve you could use the err qualifier in the command on codebase this is ignored.

 

Examples

findv M fnum bkarcust_hndl key bkar.custcode value temp.cust err no.cust //err will not work

code base should use the flerr()

findv M fnum bkarcust_hndl key bkar.custcode value temp.cust //err no.cust

if flerr(bkarcust_hndl) <> 0 goto no.cust

The err part of the command is also ingnored in codebase

Openv as well here you should use the open() <> 0 goto my.error

should look like this in codebase

openv 'myfile' fnum myfile_hndl lock  X

if open(myfile_hndl) <> 0 goto my.error

 

Record locking

Normaly wne using Btreive mostly in reporting we would open the files with Lock X meaning we only want to read the data however I found that in codebase even is we open read only both the findv and scan need to have the Nlock on the command or your program will attempt to lock the records as they are read...

Example

scan @myfile_hndl key mykey nlock

ends

 

findv M fnum myfile_hndl key mykey nlock

 

Codebase Scan Skip problem

When scanning a file if you have to save back to they file you must use the noclr command. 

 

Btreive normally will do this fine..

scan @myfile_hndl key mykey

// changing somthing  here......

save @myfile_hndl

ends

code base change

scan @myfile_hndl key mykey

// changing somthing  here......

save @myfile_hndl noclr

ends

if the above code is not changes you will get a codebase Error - 910 Skip Error.

 

More on the subject of Btreive/Pervasive to Codebase

 

Codebase VS Btreive

When converting from the Btreive file System to Codebase here are the changes I found I needed to make the system work…

 

Data base changes

All V type fields should be deleted or changed to a type Alpha… if changing to an alpha you will need to make up some sort of update to keep the overlay fld working… something like this

Myoverlay = field1 + fld2 + fld3

I recommend deleting the V type Fld then adding that key name

The Find command has to be changed to findv also in the findv there was a err part of the command this will not work in codebase so you will need to use if flerr(myfile_hndl)_ <> 0 goto myerror_line

 

Scan + save

If you save inside a scan you must use the noclr option or save the record position then retrieve the record position.  Or your scan will stop because the save has lost the scan position

 

Example

save @myfile)hndl ncnf // Btreive

save @myfile)hndl ncnf noclr  /codebase

 

Ifdupe needs to be changed to ifdupecb()

Aloc looks like it’s not working.  However it will work see Example

Aloc works you just can not use a codebase fld

 

Example

//You must place the Codebase field value in some defined holder field to work with codebase type databases.

   define pos_type type a size 3 // here we define our fld

   pos_type = bkpos.slp.type // here we make the codebase fld = to our defined fld

   cntr=aloc(pos_type,pmt_type) // our Aloc using codebase is fixed !!!!

TASNotes had to change the pointer type from P to F ???

Interesting thing about LCKD() found this in the WBKPOA enter PO program…

if lckd(bkicmstr_hndl,get_key_num('bkic.prod.code')) = .t. // Btrv uses the key num

if lckd(bkicmstr_hndl,'bkic.prod.code') = .t.   // codebase code base uses the name of the key nit the integer but the read name it uses an alpha !!!!!!

 

Scan loops with a delete have to have a place holder…. To avoid 910 skip error…

save the record pos then dellete the set the same position

or you can rewrite most using the dall command

FILL looks like there is a problem with Fill in codebase

This is in the adv60

//******************************************************************************

//   fill_inv fill up alpha fields with spaces to get rid of binary zeroes

//      used initially in BKSOA, may be needed in other programs that

//      do a save @bkarinv_hndl

//******************************************************************************

:fill_inv

#proc

cmd fill_inv

ret  // codebase can not use Fill added this to CB version for now..

 fill bkar.inv.cuscod TRAIL chr ' '

 fill bkar.inv.cusnme TRAIL chr ' '

 fill bkar.inv.cusa1 TRAIL chr ' '

 fill bkar.inv.cusa2 TRAIL chr ' '

 fill bkar.inv.cuscty TRAIL chr ' '

 ret

#endp

//

::fill_inv end

There were several of these fill commands I have a ret in each one… this makes a memory err ???

There is a Fill() will try to replace the fuction….

It looks like srch_key_name="BKARINV"  will not work in codebase…

Database file names in Btreive can be larger than 8 char not true for codebase

here is one way to do a delete in a scan

define record_num

Scan @myfile key @1

  record_num = rcn(myfile)    //save the record POS

  DEL @myfile

rcn #myfile rcn record_num set  // now get the record pos and continue scan

Ends

Need to replace for now with Dall….

I think we may be able to use  del

Sample code that worked…

 HOLD_GLACCT = bkgl.acct

         HOLD_GLDPT = BKGL.GLDPT

        rec_num = rcn(bkglcoa_hndl) // codebase we need a place holder

         //dall @bkglcoa_hndl key bkgl.key  start hold_glacct, HOLD_GLDPT while bkgl.acct = HOLD_GLACCT .a. BKGL.GLDPT = HOLD_GLDPT

        del @BKGLCOA_hndl nocnf

          rcn @bkglcoa_hndl rcn rec_num set

         inc recs_deleted

  findv N fnum BKGLCOA_hndl //err FINI

     if flerr(bkglcoa_hndl) <> 0 goto Fini

   '@pbprinting.position' = REC_PERCENTAGE(bkglcoa_hndl)

   goto LOOP

 

logical array problem

Ran into a problem in code base to use a logical fdl in an array bkys.demo[10] added fld bkys.trans no array this fixed the problem

 

REPORT.RTM not working using codebase

One other thing I ran into. I had several .rtm report formats that for some reason would not work work using  codebase. After a rewrote the same report format it worked not sure what that problem was but by rebuilding the report it started to work ???

So far thus is all I have found I was able to take my ADV 7 Accountg system from btreive to Codebase using the above fixes...

 

Rick Atkeson

Computer Accounting Solutions..

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Page url: http://www.cassoftware.com/tas/manual/btrieve_to_codebase.htm