Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Datatrieve help needed

SOLVED
Go to solution

Datatrieve help needed

I am using datatrieve for querying records of a file and there are about 6300 records in the file I need only one record for testing and that one is some where in the between the records and all the records are randomly placed Is there any way that i can select only that record and delete all the remaining records and continue my testing.and also is there any way i can get the record numbers in the file by using datatrieve
1 REPLY
Hein van den Heuvel
Honored Contributor
Solution

Re: Datatrieve help needed

To delete records the file needs to be an indexed file. Is it?

Why not just create a fresh file with the target record(s)?
That's easy enough, although the request to select a record by number is 'odd'.
What identifies that record?
Why not use that in the record-selection-expression?

To select a particular record to work on in datatrieve you can use SELECT [collection]

I would use something like:

DTR> show yachts
DOMAIN YACHTS USING YACHT ON YACHT.DAT;
DTR> define domain test using yacht on test.tmp;
DTR> define file for test;
DTR> ready yachts read
DTR> ready test write
DTR> test = yachts with running count = 42
DTR> print test

MANUFACTURER MODEL RIG ALL WEIGHT BEAM PRICE

FJORD MS 33 MS 33 14,000 11

But why not select by contents, rather than number....
Obviously here this will create a second instance of the same:

DTR> test = yachts with MANUFACTURER = "FJORD" and model = "MS 33"
DTR> print test
MANUFACTURER MODEL RIG ALL WEIGHT BEAM PRICE

FJORD MS 33 MS 33 14,000 11
FJORD MS 33 MS 33 14,000 11

Also... you can probably just use DCL or read and write old and new files.

Or even an editor? Why not?

Now did you want an index or two to go with that?

hth,
Hein.