Executing follow code inside my application i receive error because
same record are not appended
Error occour also using rddads
If i isolate in a sample program i can run witout error (all  record
as appended)
ppo in my sample and in my application are equal
Append from (in my application) not append all record on
What error can i have made in my application

Thanks for support
function main()
 ? "Verify append operation"
 X_RDD="DBFCDX"
 XA_DIR:=ARRAY( ADIR("*.DBF"))
 ADIR("*.DBF",XA_DIR)
  FOR A=1 TO LEN(XA_DIR)
    X_DB1=XA_DIR[A]
        ? X_DB1
     X_DB2       := "DB2TEMP.DBF"
    use &X_DB1 alias TEMP VIA X_RDD exclusive
    X_LASTREC=LASTREC()
    ?? X_LASTREC
    A_STRUTTURE:=DBSTRUCT()
    USE
    dbcreate(X_DB2,A_STRUTTURE,X_RDD)
    use &X_DB2 alias TEMP VIA X_RDD exclusive
      append from &(X_DB1) VIA X_RDD
    SKIP 0
    X_LASTREC2=LASTREC()
        ?? X_LASTREC2
    use
    IF X_LASTREC2<>X_LASTREC
        ?? "ERROR NOT ALL RECORD WAS APPENDED"
    ENDIF
 NEXT A
 RETURN

regarding append i have found this xharbour ng regarding an eror that
give me error also with harbour last cvs so i post here also if is
unrelated with my problem.
REQUEST DBFCDX

function main()
   local aTst, aTstErr
   local aStruct := { { "id", "C", 2, 0 }, ;
                      { "name", "c", 30, 0 } }

   cls
   ? ' Begin test'
   ? ' create tables'
   ? RddSetDefault( "DBFCDX" )  // !!! 1 condition !!!
   dbCreate( "testsrc", aStruct, "DBFCDX", .T., "testsrc" )
   dbAppend()
   testsrc->ID := '01'
   testsrc->NAME := 'test record'
   dbcommit()
   testsrc->( DbCloseArea() )

   dbCreate( "testapp", aStruct, "DBFCDX", .T., "testapp" )
   index on field->id tag id  // !!! 2 condition !!!

   // --- must be ok ---
   ? ' '
   ? ' test appending from table with differ name'
   ? ' lastrec = '
   ?? testapp->( LastRec() )
   ? ' append from testsrc.dbf'
   append from ('testsrc.dbf')
   ? ' lastrec = '
   ?? testapp->( LastRec() )
   ? ''
   ? if ( testapp->( LastRec() ) == 1, 'OK!', 'Error!' )

   // --- ERROR ---
   ? ' '
   ? ' test appending from table with same name, but differ ext'
   zap
   FRename( 'testsrc.dbf', 'testapp.bak' )  // !!! 3 condition !!!

   ? ' lastrec = '
   ?? testapp->( LastRec() )
   ? ' append from testapp.bak'
   append from ('testapp.bak')
   ? ' lastrec = '
   ?? testapp->( LastRec() )
   ? ''
   ? if ( testapp->( LastRec() ) == 1, 'OK!', 'Error!' )

   wait
return nil

-- 
Massimo Belgrano
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to