Harbour HBSIX

211 views
Skip to first unread message

Riaz Khan

unread,
Feb 7, 2012, 12:59:51 AM2/7/12
to Harbour Developers
Dear All,

I am using Harbour 3.1 and have a problem..:

My dbf files along with index nsx and memo smt file are opened and
create indexes via the prg. With no errors. The source is as follows.:

CASE aFiles[ss] = 'P5_PPFM'
oMeter:Set(++nCount)
Index On CODE+STR(RECNO()) TAG "P5_PPFM1"
EVAL( SysRefresh() )
oMeter:Set(++nCount)
Index On NAME+STR(RECNO()) TAG "P5_PPFM2"
EVAL( SysRefresh() )
oMeter:Set(++nCount)
Index On DESCEND(SCAL)+DTOS(JO_DT)+DESI+STR(RECNO()) TAG
"P5_PPFM3" EVAL( SysRefresh() )

The dbf files without any memo field do a SEEK well.
The dbf files with a memo field does NOT seek.

I use a utility of bdbfs (a dbf file editor) to do file maintenance
outside of my application. After index creation via fbs I am unable
to seek for files containing memo fields..

The PACK command via fbs application produces this error..:

Time from start: 0 hours 0 mins 8 secs
Error occurred at: 06/02/2012, 21:47:53
Error description: (Application: 38) DBFNSX/1010 Read error:
\PPFNSX\PFL\PFL-1112\P5_PPFM.smt

Stack Calls
===========
Called from: => __DBPACK( 0 )
Called from: .\W_624.PRG => W_6241( 100 )
Called from: .\W_624.PRG => (b)W_624( 40 )
Called from: .\source\classes\BUTTON.PRG => TBUTTON:CLICK( 157 )
Called from: .\source\classes\CONTROL.PRG =>
TBUTTON:HANDLEEVENT( 1654 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3159 )
Called from: => SENDMESSAGE( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:COMMAND( 379 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\DIALOG.PRG =>
TDIALOG:HANDLEEVENT( 886 )
Called from: => DIALOGBOX( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 270 )
Called from: .\W_624.PRG => W_624( 46 )
Called from: .\W_62.PRG => W_62( 5 )
Called from: .\W_Main.PRG => (b)BUILDMENU( 566 )
Called from: .\source\classes\MENU.PRG => TMENU:COMMAND( 461 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:COMMAND( 1033 )
Called from: .\source\classes\MDIFRAME.PRG =>
TMDIFRAME:COMMAND( 247 )
Called from: => TMDIFRAME:HANDLEEVENT( 0 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3159 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG =>
TMDIFRAME:ACTIVATE( 980 )
Called from: .\W_Main.PRG => MAIN( 250 )

My call in main prg is as follows:

REQUEST DBFNSX
RDDREGISTER( "DBFNSX" , 1 )
RDDSETDEFAULT( "DBFNSX" )
Sx_AutoOpen(.F.)

This function SX_MemoExt() return ".SMT"

Can anyone suggest any solution,

Regards

Mindaugas Kavaliauskas

unread,
Feb 7, 2012, 8:01:01 AM2/7/12
to harbou...@googlegroups.com
Hi,


On 2012.02.07 07:59, Riaz Khan wrote:
> Can anyone suggest any solution,

Self contained sample.


Regards,
Mindaugas

Riaz Khan

unread,
Mar 2, 2012, 3:40:56 AM3/2/12
to Harbour Developers
Hi Mindaugus,

I have here a self contained example...:

The section (A) below produces no error..

************** Section (A) ********************************
*---------------------------------------------------------------------------
*
FUNCTION Main( )
*---------------------------------------------------------------------------
*
LOCAL hBorland
LOCAL x,sx
LOCAL DBFPass := 'bogus'
*
FIELD P_NO

SET CENT ON
SET DATE TO BRITISH
SET EPOCH TO 1980
SET DELETED ON
SET 3DLOOK ON

hBorland := LoadLibrary("BWCC32.DLL")
BWCCRegister( GetResources() )

REQUEST DBFNSX,DBFSMT
RDDREGISTER( "DBFNSX" , 1 )
RDDSETDEFAULT( "DBFNSX" )
Sx_AutoOpen(.F.)


Use P1_APur New VIA "DBFNSX" ALIAS P1_APur EXCLUSIVE PASSWORD
(DBFPass)
Set Index to P1_APur // This file has NO memo field
DbSetOrder(1)

PACK //.. NO ERROR

Sx_DBcreate("NewP1.dbf" , P1_APur->(DBstruct()) )

Use NewP1 New VIA "DBFNSX" PASSWORD (DBFPass)
Sx_DBFencrypt()

MsgInfo( SX_TableType() ) //Returns 2

Index On P_NO+Str(RecNo()) TAG "NewP11"
Set Index To NewP1
PACK // NO ERROR

DbSelectAr('P1_APur')

Do While !P1_APur->(Eof())
NewP1->(DBappend())
For x = 1 to P1_APur->(fcount())
NewP1->(FieldPut( x , P1_APur->(FieldGet(x))))
Next x
P1_APur->(dbskip(1))
Enddo

DbSelectAr('NewP1')
If DbSeek('1701P') // Returns .T.
MsgInfo('Found')
Else
MsgInfo('Seek Failed')
Endif

FreeLibrary(hBorland)
SET 3DLOOK OFF
SET RESOURCES TO
DBCLOSEALL()

RETURN (NIL)

DLL32 FUNCTION BWCCRegister( hInst AS LONG ) AS WORD PASCAL LIB
"BWCC32.DLL"

**************************** END
************************************
The section (B) below produces errors.. Only difference is It has a
SMT memo file
*************************** Section (B)
********************************
*---------------------------------------------------------------------------
*
FUNCTION Main( )
*---------------------------------------------------------------------------
*
LOCAL hBorland
LOCAL x,sx
LOCAL DBFPass := 'bogus'

FIELD P_NO

SET CENT ON
SET DATE TO BRITISH
SET EPOCH TO 1980
SET DELETED ON
SET 3DLOOK ON

hBorland := LoadLibrary("BWCC32.DLL")
BWCCRegister( GetResources() )

REQUEST DBFNSX,DBFSMT
RDDREGISTER( "DBFNSX" , 1 )
RDDSETDEFAULT( "DBFNSX" )
Sx_AutoOpen(.F.)

Use P1_Purs New VIA "DBFNSX" ALIAS P1_Purs EXCLUSIVE PASSWORD
(DBFPass)
Set Index to P1_Purs // This File MEMO Field and Associated SMT
File
DbSetOrder(1)

PACK // Error : DBFNSX/1010 Read error: P1_PURS.smt

Sx_DBcreate("NewP1.dbf" , P1_Purs->(DBstruct()) )

Use NewP1 New VIA "DBFNSX" PASSWORD (DBFPass)
Sx_DBFencrypt()

MsgInfo( SX_TableType() ) //Returns 1

Index On P_NO+Str(RecNo()) TAG "NewP11"
Set Index To NewP1
PACK

DbSelectAr('P1_Purs')

Do While !P1_Purs->(Eof())
NewP1->(DBappend())
For x = 1 to P1_Purs->(fcount())
NewP1->(FieldPut( x , P1_Purs->(FieldGet(x))))
Next x
P1_Purs->(dbskip(1))
Enddo

DbSelectAr('NewP1')
If DbSeek('1701P') // Returns .F.
MsgInfo('Found')
Else
MsgInfo('Seek Failed')
Endif

FreeLibrary(hBorland)
SET 3DLOOK OFF
SET RESOURCES TO
DBCLOSEALL()

RETURN (NIL)

DLL32 FUNCTION BWCCRegister( hInst AS LONG ) AS WORD PASCAL LIB
"BWCC32.DLL"

********************* END ***************************************

Can you suggest a solution

vszakats

unread,
Mar 2, 2012, 4:12:50 AM3/2/12
to harbou...@googlegroups.com
Hi,

Results:
----
t2.prg(16) Error E0030  Syntax error "syntax error at '3'"
t2.prg(27) Error E0030  Syntax error "syntax error at 'P1_APUR'"
t2.prg(35) Error E0030  Syntax error "syntax error at 'NEWP1'"
t2.prg(62) Error E0030  Syntax error "syntax error at '3'"
t2.prg(63) Error E0030  Syntax error "syntax error at 'RESOURCES'"
t2.prg(68) Error E0030  Syntax error "syntax error at 'FUNCTION'"
----

Viktor

Riaz Khan

unread,
Mar 2, 2012, 5:33:48 AM3/2/12
to Harbour Developers
Okay

Try This ..Thanks

#Include "HBSix.Ch"

*---------------------------------------------------------------------------
*
FUNCTION Main( )
*---------------------------------------------------------------------------
*
LOCAL hBorland
LOCAL x, aDbf[0]
LOCAL DBFPass := 'bogus'
*
FIELD P_NO
FIELD P_DT

SET CENT ON
SET DATE TO BRITISH
SET EPOCH TO 1980
SET DELETED ON

REQUEST DBFNSX,DBFSMT
RDDREGISTER( "DBFNSX" , 1 )
RDDSETDEFAULT( "DBFNSX" )
Sx_AutoOpen(.F.)


*------- Section ( A ) Creates an Encrypted DBF without Memo
Field--------------------------------------------------------------

aSize( aDbf, 0 )

aAdd(aDbf,{"P_NO" ,"C",05,0 })
aAdd(aDbf,{"P_APP_MS" ,"L",01,0 })
aAdd(aDbf,{"P_APP_GM" ,"L",01,0 })

Sx_DBcreate("APur.dbf" , aDbf )

Use APur New VIA "DBFNSX" PASSWORD (DBFPass)
Sx_DBFencrypt()

If SX_TableType() = 1
MsgInfo( 'APur Dbf Is NOT Encrypted SX_TableType = 1')
ElseIf SX_TableType() = 2
MsgInfo( 'APur Dbf Is Encrypted SX_TableType = 2')
Endif

Index On P_NO+Str(RecNo()) TAG "APur1"
Set Index To APur

PACK // NO Errors

MsgInfo( ' APur DBF Packed..NO ERRORS')

DbAppend()

APur->P_No := "0100P"
APur->P_App_MS := .T.
APur->P_App_GM := .F.

DbAppend()

APur->P_No := "0101P"
APur->P_App_MS := .F.
APur->P_App_GM := .T.

DbSelectAr('APur')
If DbSeek('0101P') // Returns .T.
MsgInfo('APur Seek Successful..')
Else
MsgInfo('APur Seek Failed')
Endif

DBCloseAll()

MsgInfo( 'Done With File WithOut Memo Field' )


*----SECTION ( B ) Created an Encrypted DBF File WITH Memo Field
------------------------------------------------------------------

aSize( aDbf, 0 )

aAdd(aDbf,{"P_NO" ,"C",05,0 })
aAdd(aDbf,{"P_APP_MS" ,"L",01,0 })
aAdd(aDbf,{"P_APP_GM" ,"L",01,0 })
aAdd(aDbf,{"P_Memo" ,"M",10,0 })

Sx_DBcreate("BPur.dbf" , aDbf )

Use BPur New VIA "DBFNSX" PASSWORD (DBFPass)
Sx_DBFencrypt()

MsgInfo( 'BPur DBF Has A Memo File '+ BPur->(Sx_MemoExt()) ) //
Returns .SMT

If SX_TableType() = 1
MsgInfo( 'BPur Dbf Is NOT Encrypted SX_TableType = 1'+CHR(13)+;
'SX_DBFencrypt Function did NOT Work..!'+CHR(13)+;
'For File With MEMO Field')
ElseIf SX_TableType() = 2
MsgInfo( 'BPur Dbf Is Encrypted SX_TableType = 2')
Endif

Index On P_NO+Str(RecNo()) TAG "BPur1"
Set Index To BPur

PACK // NO Error Because No Encryption

DbAppend()

BPur->P_No := "0100P"
BPur->P_App_MS := .T.
BPur->P_App_GM := .F.

DbAppend()

BPur->P_No := "0101P"
BPur->P_App_MS := .F.
BPur->P_App_GM := .T.

DbSelectAr('BPur')
If DbSeek('0101P') // Returns .T.
MsgInfo('BPur DBF Seek Successful')
Else
MsgInfo('Seek Failed')
Endif

DbCloseAll()

MsgInfo('PROBLEM'+CHR(13)+;
'File WithOUT memo Field Is Okay to open and seek..'+CHR(13)+;
'File With memo Field Does NOT Get Encryption')

FreeLibrary(hBorland)
RETURN (NIL)

******************************************************************************8

vszakats

unread,
Mar 2, 2012, 6:18:00 AM3/2/12
to harbou...@googlegroups.com
after fixing HBSix.Ch to hbsix.ch, results:

Error BASE/6101  Unknown or unregistered symbol: MSGINFO (Quit) 
Error BASE/6101  Unknown or unregistered symbol: MSGINFO
Called from HB_HRBRUN(0)  
Called from _APPMAIN(0) 

Riaz Khan

unread,
Mar 2, 2012, 7:01:50 AM3/2/12
to harbou...@googlegroups.com
What does this mean.  What is required NOW...
I have provided a self contained sample..I do not get this when chaning to 'hbsix.ch'

vszakats

unread,
Mar 2, 2012, 7:12:43 AM3/2/12
to harbou...@googlegroups.com


On Friday, March 2, 2012 1:01:50 PM UTC+1, Riaz Khan wrote:
What does this mean.  What is required NOW...
I have provided a self contained sample..I do not get this when chaning to 'hbsix.ch'

Never "decorate" the casing of any include file, otherwise 
they won't work on any non-windows machine. It will fail 
with include file not found error.

Furthermore, read INSTALL / TROUBLESHOOTING / 12.:

"Do not use xhb contrib library, or any 3rd party Harbour 
 libraries. The example shall reproduce
 the problem using official stable or nightly Harbour build."

MSGINFO() is not Harbour function.

Viktor

Bacco

unread,
Mar 2, 2012, 7:13:45 AM3/2/12
to harbou...@googlegroups.com
On Fri, Mar 2, 2012 at 09:01, Riaz Khan <amria...@gmail.com> wrote:
> What does this mean.  What is required NOW...
> I have provided a self contained sample..I do not get this when chaning to
> 'hbsix.ch'

This means that

1) Viktor had to change HBSix.Ch to hbsix.ch to test your sample,
because the ch is lowercase, and this makes difference on various
non-win systems.

2) Your code calls MSGINFO, that is not an harbour standard function,
so the error you are reporting couldn't be tested.

A self contained sample should have only the code necessary to show
the error you are reporting, people can't stop everything to fix your
code first so then they could analyze the problem itself. There's an
excellent link in the INSTALL file with many hints about how a proper
SCS should be: http://sscce.org/


Regards,
Bacco

iRochinha

unread,
Mar 2, 2012, 9:46:14 AM3/2/12
to harbou...@googlegroups.com

Hi,

 

Sugestions:

 

-          Never use recno() in the index tags.

-          Pack not perform changes on memo tables

 

For a good life in your memo tables, after pack:

 

-          Open a table with a memo

-          Copy your structure to another file.

-          Rename the old table to tempname

-          Rename the new table to old table name

 

Good luck!

Riaz Khan

unread,
Mar 2, 2012, 10:55:16 AM3/2/12
to harbou...@googlegroups.com


On Tuesday, February 7, 2012 10:59:51 AM UTC+5, Riaz Khan wrote:

Riaz Khan

unread,
Mar 2, 2012, 12:38:54 PM3/2/12
to harbou...@googlegroups.com

Pls. try this for a sample..:


#Include "hbsix.ch"

 FUNCTION Main( )

LOCAL hBorland
LOCAL x, aDbf[0]
LOCAL DBFPass := 'bogus'
*
FIELD P_NO

SET CENT ON
SET DATE TO BRITISH
SET EPOCH TO 1980
SET DELETED ON

REQUEST DBFNSX,DBFSMT
RDDREGISTER( "DBFNSX" , 1 )
RDDSETDEFAULT( "DBFNSX" )
Sx_AutoOpen(.F.)

aSize( aDbf, 0 )

aAdd(aDbf,{"P_NO"      ,"C",05,0 })
aAdd(aDbf,{"P_APP_MS"  ,"L",01,0 })
aAdd(aDbf,{"P_APP_GM"  ,"L",01,0 })

Sx_DBcreate("APur.dbf" , aDbf )

Use APur New VIA "DBFNSX" PASSWORD (DBFPass)
Sx_DBFencrypt()

Index On P_NO+Str(RecNo())  TAG "APur1"
Set Index To APur

PACK   // NO Errors

DbAppend()

APur->P_No     := "0100P"
APur->P_App_MS := .T.
APur->P_App_GM := .F.

DbAppend()

APur->P_No     := "0101P"
APur->P_App_MS := .F.
APur->P_App_GM := .T.

DbSelectAr('APur')
DbSeek('0101P')   // Returns .T.

DBCloseAll()

aSize( aDbf, 0 )

aAdd(aDbf,{"P_NO"      ,"C",05,0 })
aAdd(aDbf,{"P_APP_MS"  ,"L",01,0 })
aAdd(aDbf,{"P_APP_GM"  ,"L",01,0 })
aAdd(aDbf,{"P_Memo"    ,"M",10,0 })

Sx_DBcreate("BPur.dbf" , aDbf )

Use BPur New VIA "DBFNSX" PASSWORD (DBFPass)
Sx_DBFencrypt()

Index On P_NO+Str(RecNo())  TAG "BPur1"
Set Index To BPur

PACK    //  NO Error Because No Encryption

DbAppend()

BPur->P_No     := "0100P"
BPur->P_App_MS := .T.
BPur->P_App_GM := .F.

DbAppend()

BPur->P_No     := "0101P"
BPur->P_App_MS := .F.
BPur->P_App_GM := .T.

DbSelectAr('BPur')
DbSeek('0101P')   // Returns .T.

DbCloseAll()

RETURN (NIL)

Przemysław Czerpak

unread,
Mar 5, 2012, 7:31:43 AM3/5/12
to harbou...@googlegroups.com
On Fri, 02 Mar 2012, Riaz Khan wrote:

Hi,

> Pls. try this for a sample..:

I compiled your example and it works without any errors.
What is the problem?

best regards,
Przemek

Riaz Khan

unread,
Mar 5, 2012, 7:46:45 AM3/5/12
to harbou...@googlegroups.com
Hi Przemek 

The problem is ...

APUR.DBF:

The APur.dbf file is encrypted with password...has NO memo field...Seek and Pack work fine..

The BPur.Dbf file is also encrypted with password....(BUT does not get Encrypted )  and has a memo field....

Results: Encrypting file with a password only is applying to files without memo fields..

Thanks 

Przemysław Czerpak

unread,
Mar 5, 2012, 11:14:12 AM3/5/12
to harbou...@googlegroups.com
On Mon, 05 Mar 2012, Riaz Khan wrote:

Hi Riaz,

> The problem is ...
> APUR.DBF:
> The APur.dbf file is encrypted with password...has NO memo field...Seek and
> Pack work fine..
>
> The BPur.Dbf file is also encrypted with password....(BUT does not get
> Encrypted ) and has a memo field....
> Results: Encrypting file with a password only is applying to files without
> memo fields..

When I was adding support for SIX3 encryption to [x]Harbour i blocked
it for tables with memos. I made it intentionally when I found few
serious bugs in SIX3 implementation when tables with memos are encrypted.
I didn't want to replicate them and make [x]Harbour RDDs bug compatible
with SIX3 because SIX3 is corrupting data in some cases.
I left them to the moment when I'll find some spare time to precisely
document SIX3 bugs and differences in new implementation.
Meanwhile I decided to block support for SIX3 encrypted tables with
memos to not have backward compatibility problems with data created
by [x]Harbour RDDs before I'll introduce workarounds for SIX3 bugs.

best regards,
Przemek

Riaz Khan

unread,
Mar 5, 2012, 11:25:34 AM3/5/12
to harbou...@googlegroups.com
Hi Przemek ,

Oh..thats sad..Well Thanks for your support and goods efforts.
Pls. keep me posted about progress in this matter.

My HR & Payroll Applications uses many memo fields to store employee history.  As I am currently migrating to 32 bit applications, I will have to think of a work around the issue, as I can not lose the memo info history.

Many thanks and best regards..
Reply all
Reply to author
Forward
0 new messages