Question

I am writing an application in C++ that interfaces with SPSS 15 using their I/O DLL.

Our SPSS database is made of a number of cases, each with their unique "ID" field.

What I need to do is open the database in read/write, find the case with the matching ID and modify some of the variables according to CSV files that my program parses.

There are 2 obvious cases from the start:

  • The matching case does not exist (In which case, I can easily use spssOpenAppend() to add the case.

  • The matching case exists. (And this is the problematic case)

In the latter, I need to use spssOpenWriteCopy() to get a write Handle and spssOpenRead() to have a read handle. While I'm not too keen on that, it seems it's the only way to do it with their DLL. The problem is that I cannot move the case pointer on the write file (Apparently, moving the case pointer is a read-only operation)

That means I am stuck trying to figure out how to modify a case without having to iterate over all the file and copy all the data, case by case, until I find the case I'm interested in.

I'd like to add that upgrading SPSS is not an option.

I'd also like to avoid having to manually iterate case-by-case and build a new file from scratch.

Was it helpful?

Solution

I figure no one is going to bother answering now that it's solved.

Anyway, it is not possible to insert a case in the middle of a database. You could potentially write wrappers around the API to simulate it, but otherwise there is no way to do what I am trying to do without manually iterating through each case and copying it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top