For Programmers: Free Programming Magazines  


Home > Archive > Cobol > July 2006 > INDEXES: BTRIEVE vs EXTFH









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author INDEXES: BTRIEVE vs EXTFH
alexandretalbert@gmail.com

2006-06-30, 7:55 am

Hi folks!

I have some betrieve files created by Microfocus Cobol (trough
FILETYPE"6" directive), and accessed trough DDF files created with
"CREATE TABLE" statements. My (BIG) problem concern to the INDEXES.
With BUTIL -STAT, I can see that every index on the data file is
created eith type=3DString.

So, the DDF index definition will never match. For example, for the
table:

FD DC0030.
01 DC0030-REG.
2 DC0030-CODE PIC 9(3).
2 DC0030-NAME PIC X(50).

SELECT DC0030 ASSIGN TO WS0030-CAM-GERAL
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
LOCK MODE IS AUTOMATIC
FILE STATUS IS WS-8005-STATUS
RECORD KEY IS DC0030-CODE
James J. Gavan

2006-06-30, 6:55 pm

alexandretalbert@gmail.com wrote:
> Hi folks!
>
> I have some betrieve files created by Microfocus Cobol (trough
> FILETYPE"6" directive), and accessed trough DDF files created with
> "CREATE TABLE" statements. My (BIG) problem concern to the INDEXES.
> With BUTIL -STAT, I can see that every index on the data file is
> created eith type=String.
>
> So, the DDF index definition will never match. For example, for the
> table:
>
> FD DC0030.
> 01 DC0030-REG.
> 2 DC0030-CODE PIC 9(3).
> 2 DC0030-NAME PIC X(50).
>
> SELECT DC0030 ASSIGN TO WS0030-CAM-GERAL
> ORGANIZATION IS INDEXED
> ACCESS MODE IS DYNAMIC
> LOCK MODE IS AUTOMATIC
> FILE STATUS IS WS-8005-STATUS
> RECORD KEY IS DC0030-CODE
> .
>
> I have the following CREATE TABLE:
>
> CREATE TABLE DC0030 USING 'DC0030.MKD' (CODE NUMERIC(3,0), NAME
> CHAR(50),PRIMARY KEY(CODE))
>
> Then the PRIMARY INDEX CODE is NUMERIC on DDF but STRING on the data
> file....For this reason, some queries doesnīt work.....
>
> Any suggestion??
>
> Thanks!!!!
>



Don't know whether it will help at all but check out the following N/E
4.0 example which writes Btrieve records :-

http://supportline.microfocus.com/e...ties/nesamp.asp

Under the heading "General" download btrvtest.zip

Jimmy
alexandretalbert@gmail.com

2006-06-30, 6:55 pm

Thanks James...I=B4ll check it out.

James J. Gavan wrote:
> alexandretalbert@gmail.com wrote:
>
>
> Don't know whether it will help at all but check out the following N/E
> 4.0 example which writes Btrieve records :-
>
> http://supportline.microfocus.com/e...ties/nesamp.asp
>=20
> Under the heading "General" download btrvtest.zip
>=20
> Jimmy


alexandretalbert@gmail.com

2006-07-03, 6:55 pm

One more detail: I only have problems when I try to query a table with
a SEGMENTED KEY. For example:

FD DC0099.
01 DC0030-REG.
2 DC0099-ORDER.
3 DC0099-DOC-CODE PIC 9(1).
3 DC0099-ORDER-CODE PIC 9(6).
2 DC0099-ORDER-DESCR PIC X(30).

SELECT DC0099 ASSIGN TO "DC0099"
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
LOCK MODE IS AUTOMATIC
FILE STATUS IS WS-8005-STATUS
RECORD KEY IS DC0099-ORDER


The FD / SELECT above, cause Microfocus to create a btrieve data file
with one KEY (1) which contains only ONE STRING SEGMENT ( 7 caracters
length (1+6) ).

But when I run the CREATE STATEMENT for the table, the INDEX will be
formed by 2 SEGMENTS (NUMERIC LENGTH 1 + NUMERIC LENGTH 6). Then my
queries don=B4t work properly.

select * from dc0099 where doc_code =3D 1 (doesn=B4t work)

select * from dc0099 where convert(doc_code,sql_numeric) =3D 1 (works,
but using no index)


Thanks again!


alexandretalbert@gmail.com wrote:[color=darkred]
> Thanks James...I=B4ll check it out.
>
> James J. Gavan wrote:

James J. Gavan

2006-07-03, 6:55 pm

alexandretalbert@gmail.com wrote:
> One more detail: I only have problems when I try to query a table with
> a SEGMENTED KEY. For example:
>
> FD DC0099.
> 01 DC0030-REG.
> 2 DC0099-ORDER.
> 3 DC0099-DOC-CODE PIC 9(1).
> 3 DC0099-ORDER-CODE PIC 9(6).
> 2 DC0099-ORDER-DESCR PIC X(30).
>
> SELECT DC0099 ASSIGN TO "DC0099"
> ORGANIZATION IS INDEXED
> ACCESS MODE IS DYNAMIC
> LOCK MODE IS AUTOMATIC
> FILE STATUS IS WS-8005-STATUS
> RECORD KEY IS DC0099-ORDER
>
>
> The FD / SELECT above, cause Microfocus to create a btrieve data file
> with one KEY (1) which contains only ONE STRING SEGMENT ( 7 caracters
> length (1+6) ).
>
> But when I run the CREATE STATEMENT for the table, the INDEX will be
> formed by 2 SEGMENTS (NUMERIC LENGTH 1 + NUMERIC LENGTH 6). Then my
> queries donīt work properly.
>
> select * from dc0099 where doc_code = 1 (doesnīt work)
>
> select * from dc0099 where convert(doc_code,sql_numeric) = 1 (works,
> but using no index)
>


I don't know Btrieve. Period. If you don't get an answer here join the
Forum at microfocus.com - it's free ! Post a question under your product
- if it's old and not listed put your query under 'Other Micro Focus
Products".


Jimmy
Blondie

2006-07-14, 6:55 pm

alexandretalbert@gmail.com wrote:
> One more detail: I only have problems when I try to query a table with
> a SEGMENTED KEY.


In order for Btrieve to recognize the segments defined in your program
they must be defined in your SELECT statement (in MicroFocus anyway).
Instead of refering to the group name as the key use an undefined name
and specify the segments:

SELECT DC0099 ASSIGN TO "DC0099"
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
LOCK MODE IS AUTOMATIC
FILE STATUS IS WS-8005-STATUS
RECORD KEY IS DC0099-ORDER-KEY = DC0099-DOC-CODE,

DC0099-ORDER-CODE

Cheers,
Gord

Blondie

2006-07-14, 6:55 pm

alexandretalbert@gmail.com wrote:
> One more detail: I only have problems when I try to query a table with
> a SEGMENTED KEY.


In order for Btrieve to recognize the segments defined in your program
they must be defined in your SELECT statement (in MicroFocus anyway).
Instead of refering to the group name as the key use an undefined name
and specify the segments:

SELECT DC0099 ASSIGN TO "DC0099"
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
LOCK MODE IS AUTOMATIC
FILE STATUS IS WS-8005-STATUS
RECORD KEY IS DC0099-ORDER-KEY = DC0099-DOC-CODE,

DC0099-ORDER-CODE

Cheers,
Gord

Blondie

2006-07-14, 6:55 pm

sorry about the double post - is that what preview does?

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com