PDA

View Full Version : Dbase V Migration


wah_wah_69
04-03-07, 10:10
Greetings,and thanks in advance!

First I must say that dbase is an obscure entity for me,I worked with oracle some time ago,but never had to work with dbase before,to me it seems as an obsolete technology, but I might be wrong.

I need to transfer data from a delphi win32 aplication using paradox to a DOS based application using Dbase 5.(:shocked: Blame my boss,I know it's a step backwards)

So I first tried to edit the dbf file, used openoffice 2 calc application to import from paradox to dbase format.

It seemed to work right in short all I did was:

* Copied an pasted all the data from the db file to the dbf file (Made some format changes and cleanup).

* Used reindex option from the dos application.

Listing works fine from the DOS application,(customer and articles).

*BUT*

There's no way to process an invoice , when I try to select the customer code it simple ignores me as it didnt exist although the code appears in the listing option.So the tables are not being related.

I entered a customer "by hand" and it was selected correctly under the invoice processing option, so I wonder what I have messed up.

I supose it's the ndx files, but didn't the reindex option from the DOS application handle that?

Can I recreate the ndx files in a useful way?

Am I missing something else?

What othe options do I have,using a obdc driver for dbase maybe?

jcreamer
04-03-07, 12:33
Wah Wah 69,

More than likely it is an index issue. But it may be more than that. Make sure that you have recreated all of the various indexes for that app. If it isn't the indexes then there must be something that happens when you add a record that didn't get updated when you manually added the records yourself. One way to debug it is to look at all of the dates & times on the dbf's and indexes prior to adding a record and then look at them after to see what the program updated. There may be a DBF that needs a link to complete the addition of a record for the invoice to function properly. In the same vain, compare the record you appended in yourself and the record you added thru the system, it may be missing a piece data element to complete the link.

I don't see how an ODBC driver would make any differences to your problem because you work around your app and not with it. Is there an import function to setup records? And yes dbase is obsolete animal but still functional for what it is used for in most cases

Jim C.

wah_wah_69
04-09-07, 13:59
Wah Wah 69,

More than likely it is an index issue. But it may be more than that. Make sure that you have recreated all of the various indexes for that app. If it isn't the indexes then there must be something that happens when you add a record that didn't get updated when you manually added the records yourself. One way to debug it is to look at all of the dates & times on the dbf's and indexes prior to adding a record and then look at them after to see what the program updated. There may be a DBF that needs a link to complete the addition of a record for the invoice to function properly. In the same vain, compare the record you appended in yourself and the record you added thru the system, it may be missing a piece data element to complete the link.

I don't see how an ODBC driver would make any differences to your problem because you work around your app and not with it. Is there an import function to setup records? And yes dbase is obsolete animal but still functional for what it is used for in most cases

Jim C.

”Thanks for your reply!

Taking a deeper look at the dos app files I found the file "Alta.prg" which seems to be the exact piece of code that handles customers adition to the database.

Also in the same folder are located "Alta.bdo and Cliente.com" The bdo file seems to be the compiled .prg.

Note this lines:

SET INDEX TO C:\DISLAPE_\DATOS\CLI_COD **Customer code

USE C:\DISLAPE_\DATOS\CLIENTE -> This is a com file!
***
SET INDEX TO C:\DISLAPE_\DATOS\\CLI_NOM **Customer name
REINDEX
SET INDEX TO C:\DISLAPE_\DATOS\CLI_APE1 ** Customer Surname
REINDEX
SET INDEX TO C:\DISLAPE_\DATOS\CLI_APE2 ** Customer Surname
REINDEX
SET INDEX TO C:\DISLAPE_\DATOS\CLI_LOC ** Customer Location
REINDEX

This is Alta.prg code:

**** ALTA CLIENTES ****
SET TALK OFF
SET ECHO OFF
USE C:\DISLAPE_\DATOS\CLIENTE
SET INDEX TO C:\DISLAPE_\DATOS\CLI_COD
CLEAR
SW="N"
COD=SPACE(6)
SET MESSAGE TO [ (ESC-en codigo)SALIR ()CAMPO ARRIBA ()CAMPO ABAJO (<Ł)ACEPTAR CAMPO]
DO WHILE COD <> "0"
CLEAR
RUN C:\DISLAPE_\CLIENTES\PAN_CLI
@ 22,20 SAY " P R O G R A M A D E A L T A S "
COD=SPACE(6)
NOM=SPACE(15)
APE1=SPACE(15)
APE2=SPACE(15)
DI=SPACE(40)
LOC=SPACE(20)
PRO=SPACE(20)
CIFV=SPACE(10)
TEL=SPACE(9)
MOVI=SPACE(9)
EN=SPACE(4)
SU=SPACE(4)
D_C=SPACE(2)
N_CUENTA=SPACE(10)
N_BANCO=SPACE(30)
@ 5,61 GET COD
READ
IF LASTKEY()=27
COD="0"
ENDIF
IF COD<>"0"
SEEK COD
IF EOF()
@ 5,28 GET CIFV
@ 8,10 GET APE1
@ 8,26 GET APE2
@ 8,42 GET NOM
@ 10,17 GET DI
@ 12,17 GET LOC
@ 12,49 GET PRO
@ 14,16 GET TEL PICTURE "999999999"
@ 15,16 GET MOVI PICTURE "999999999"
@ 14,41 GET N_BANCO
@ 16,15 GET EN PICTURE "9999"
@ 16,29 GET SU PICTURE "9999"
@ 16,39 GET D_C PICTURE "99"
@ 16,48 GET N_CUENTA PICTURE "9999999999"
READ
APPEND BLANK
SW="S"
REPLACE CODIGO WITH COD
REPLACE NOMBRE WITH NOM
REPLACE APELLIDO1 WITH APE1
REPLACE APELLIDO2 WITH APE2
REPLACE DNI WITH CIFV
REPLACE DIRECCION WITH DI
REPLACE LOCALIDAD WITH LOC
REPLACE PROVINCIA WITH PRO
REPLACE TELEFONO WITH VAL(TEL)
REPLACE MOVIL WITH VAL(MOVI)
REPLACE ENTIDAD WITH EN
REPLACE SUCURSAL WITH SU
REPLACE DC WITH D_C
REPLACE CCC WITH N_CUENTA
REPLACE NOMBRE_BAN WITH N_BANCO
ELSE
SET COLOR TO W/N
@ 5,28 SAY DNI
@ 8,10 SAY APELLIDO1
@ 8,26 SAY APELLIDO2
@ 8,42 SAY NOMBRE
@ 10,17 SAY DIRECCION
@ 12,17 SAY LOCALIDAD
@ 12,49 SAY PROVINCIA
@ 14,16 SAY STR(TELEFONO,9)
@ 14,41 SAY NOMBRE_BAN
@ 16,15 SAY ENTIDAD
@ 16,29 SAY SUCURSAL
@ 16,39 SAY DC
@ 16,48 SAY CCC
SET COLOR TO W/B
TECLA=SPACE(1)
@ 20,13 SAY "CLIENTE YA MECANIZADO. PULSE UNA TECLA PARA CONTINUAR " GET TECLA
READ
@ 20,13 SAY " "
ENDIF
ENDIF
ENDDO
SET MESSAGE TO [ ]
IF SW="S"
SET INDEX TO C:\DISLAPE_\DATOS\\CLI_NOM
REINDEX
SET INDEX TO C:\DISLAPE_\DATOS\CLI_APE1
REINDEX
SET INDEX TO C:\DISLAPE_\DATOS\CLI_APE2
REINDEX
SET INDEX TO C:\DISLAPE_\DATOS\CLI_LOC
REINDEX
ENDIF
CLOSE DATABASE
RETURN


Can I make dbase generate the from my hand edited dbf file, how?

Can I externally generate the ndx files, how?

wah_wah_69
05-19-07, 10:56
Dbf manager demo version (40 executions only) did the trick for me, now the data is properly read from the DOS application.