Wrong year of last update in header of dbf for 2020...

113 views
Skip to first unread message

oleksa

unread,
Oct 1, 2020, 5:11:24 AM10/1/20
to harbou...@googlegroups.com
Hi!

The year of last update in header of dbf is wrong for 2020, look at sample:

proc main
local cYear
local hFile

dbcreate( "test_y", {{"F1","C",10,0}},, .T. )
dbAppend()
?lUpdate()
use

cYear := hb_BChar( 0 )
IF ( hFile := hb_vfOpen( "test_y.dbf" ) ) != NIL
 hb_vfSeek( hFile, 1 )
 hb_vfRead( hFile, @cYear , hb_BLen( cYear ) )
 ? "Last update (year):", Bin2I( cYear )
 hb_vfClose( hFile )
ELSE
 ? "Cannot open file"
ENDIF

return

The year is 120, why?

Regards,
Oleksii Myronenko

Klas Engwall

unread,
Oct 1, 2020, 6:47:37 AM10/1/20
to harbou...@googlegroups.com
Hi Oleksii,

To get just 20 instead of 120, you need the following line:

hb_rddInfo( RDDI_SETHEADER, DB_SETHEADER_YYEAR )

Search this group for more info about DB_SETHEADER_YYEAR. It was
discussed in several threads in 2015.

Regards,
Klas

oleksa

unread,
Oct 1, 2020, 7:20:06 AM10/1/20
to harbou...@googlegroups.com
Ok, thank you.
Need we correct the sample of Bin2I in core/doc/en/binnum.txt?

Regards,
Oleksii Myronenko

1 жовтня 2020, 13:47:40, від "Klas Engwall" <har...@engwall.com>:

Hi Oleksii,

To get just 20 instead of 120, you need the following line:

hb_rddInfo( RDDI_SETHEADER, DB_SETHEADER_YYEAR )

Search this group for more info about DB_SETHEADER_YYEAR. It was 
discussed in several threads in 2015.

Regards,
Klas


Den 2020-10-01 kl. 11:11, skrev oleksa:
> Hi!
> 
> The year of last update in header of dbf is wrong for 2020, look at sample:
> 
> proc main
> local cYear
> local hFile
> 
> dbcreate( "test_y", {{"F1","C",10,0}},, .T. )
> dbAppend()
> ?lUpdate()
> use
> 
> cYear := hb_BChar( 0 )
> IF ( hFile := hb_vfOpen( "test_y.dbf" ) ) != NIL
>  hb_vfSeek( hFile, 1 )
>  hb_vfRead( hFile, @cYear , hb_BLen( cYear ) )
>  ? "Last update (year):", Bin2I( cYear )
>  hb_vfClose( hFile )
> ELSE
>  ? "Cannot open file"
> ENDIF
> 
> return
> 
> The year is 120, why?
> 
> Regards,
> Oleksii Myronenko

-- 
You received this message because you are subscribed to the Google Groups "Harbour Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-devel/37c4b65a-4299-943e-4d72-dc895bc603ed%40engwall.com.

Klas Engwall

unread,
Oct 1, 2020, 8:03:14 AM10/1/20
to harbou...@googlegroups.com
Hi Olekeii,

> Ok, thank you.
> Need we correct the sample of Bin2I in core/doc/en/binnum.txt?

I don't see a good reason for doing that. It has nothing to do with
number conversions. The 120 result is Clipper compatible and refers to
the year 1900 rather than to the beginning of the current century. The
DB_SETHEADER_YYEAR setting is a convention, not a correction, and is
related to 1) concurrent DBF file use between Harbour and tools that are
not Clipper compatible and 2) whether you want to see the century
(1900++) in the lupdate() year or not, which is entirely up to the user
to decide.

Regards,
Klas

oleksa

unread,
Oct 1, 2020, 8:28:22 AM10/1/20
to harbou...@googlegroups.com
Ok. Thanks again, Klas.

Regards,
Oleksii Myronenko

1 жовтня 2020, 15:03:16, від "Klas Engwall" <har...@engwall.com>:

Hi Olekeii,

> Ok, thank you.
> Need we correct the sample of Bin2I in core/doc/en/binnum.txt?

I don't see a good reason for doing that. It has nothing to do with 
number conversions. The 120 result is Clipper compatible and refers to 
the year 1900 rather than to the beginning of the current century. The 
DB_SETHEADER_YYEAR setting is a convention, not a correction, and is 
related to 1) concurrent DBF file use between Harbour and tools that are 
not Clipper compatible and 2) whether you want to see the century 
(1900++) in the lupdate() year or not, which is entirely up to the user 
to decide.

Regards,
Klas

-- 
You received this message because you are subscribed to the Google Groups "Harbour Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-devel/cd3527f1-6d2d-09d4-2d44-4c165eb5f2e2%40engwall.com.
Reply all
Reply to author
Forward
0 new messages