Re: INDEXES: BTRIEVE vs EXTFH (cobol)
- From: "alexandretalbert@xxxxxxxxx" <alexandretalbert@xxxxxxxxx>
- Date: 3 Jul 2006 11:36:05 -0700
Hi Bill,
One 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)
Thanks again!
Bill Bach wrote:
If your Btrieve indices are strings, yet the data is Numeric, then the
Btrieve file structure is incorrect. You may need to contact
Microfocus to determine how to get the file definition to be created
properly at the Btrieve layer.
You *MAY* be able to make the repair yourself, but I do not know if
this will impact the MF operating environment or not. Luckily, a
simple PIC 9(3) field has a range of "000" through "999", so treating
it as a string works. However, if SQL looks at it as a signed value,
everything gets messed up. So, you MUST fix the problem to get good
queries from SQL.
Goldstar Software Inc.
Pervasive-based Products, Training & Services
Bill Bach
BillBach@xxxxxxxxxxxxxxxxxxxx
http://www.goldstarsoftware.com
*** Chicago: Pervasive Service & Support Class - 07/2006 ***
alexandretalbert@xxxxxxxxx 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!!!!
.
- Follow-Ups:
- Re: INDEXES: BTRIEVE vs EXTFH (cobol)
- From: Bill Bach
- Re: INDEXES: BTRIEVE vs EXTFH (cobol)
- References:
- Re: INDEXES: BTRIEVE vs EXTFH (cobol)
- From: Bill Bach
- Re: INDEXES: BTRIEVE vs EXTFH (cobol)
- Prev by Date: Re: INDEXES: BTRIEVE vs EXTFH (cobol)
- Next by Date: Re: Inser Trigger problem
- Previous by thread: Re: INDEXES: BTRIEVE vs EXTFH (cobol)
- Next by thread: Re: INDEXES: BTRIEVE vs EXTFH (cobol)
- Index(es):
Relevant Pages
|