text file cobol like index
From: greg (prax_at_chello.fr)
Date: 12/29/04
- Next message: Kevin Saliga: "Media Player and CurrentPosition"
- Previous message: Ian Hinson: "Re: Pointers and string lists?"
- Next in thread: J West: "Re: text file cobol like index"
- Reply: J West: "Re: text file cobol like index"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 29 Dec 2004 22:58:09 +0100
Foremost, thanks for the help with the array/string trouble.
About what is following, as you will see, i ve found a solution that is
working. The thing is i would like to know if there was "another way". This
is just intellectual curiosity (unless I m seduced by another solution).
I have a file that is created by a cobol program. this is a textfile, made
of one big line of text. It s made with set of data that are 271 char long,
each having a DataBase like key on the seven first characters. When produced
by the cobol program, it s indexed (ordered from lower to bigger, with a
name.idx file being the index). The index can t be used outside the cobol
program.
My trouble was to make a Delphi application that use that file, modify it
and add data. I devised it and found a way to put some code at the begining
of the cobol program so it can re-index it before using it. Everything was
going fine until i make a test at full charge. with 75000 dataset, it take
around 20 seconds to find the good line if it s at the end of the file. It
was way too long for me. My solution to find the good set of data was to
look at all the set of data key in a sequential way (because i have to add
data at the end of the file). This being too long, i decided to transfert
the data from the text file to an oracle data base table (with SQLLDR), work
on the data and then recreate the textfile from the Oracle table.
My question is : Is there a way to index a textfile like this one without
adding any kind of data to the file. I ve thought about creating a false
index with a copy of the key and of the position of the key in the text
file, but i dont think i ll gain a lot of time since the program will have
to make as many comparisons. In the same way, i can t reorder the text when
I put new datad in it : it s a multiuser application and i want to have a
minimum of opperations made on the file (one file for many users). The file
not being ordered i dont think i can use any kind of dychotomic research.
Again, I ve found a solution (even if it s a "rich" solution) and i just
want to know if there s something in Delphi 7 that could have made it in a
simpler way.
Cheers,
-- Grégory Privat -------------------------------- http://gloarmy.free.fr http://pavis.free.fr/prax --------------------------------
- Next message: Kevin Saliga: "Media Player and CurrentPosition"
- Previous message: Ian Hinson: "Re: Pointers and string lists?"
- Next in thread: J West: "Re: text file cobol like index"
- Reply: J West: "Re: text file cobol like index"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]