bug-gnu-pspp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PSPP-BUG: CLOSE FILE HANDLE not working


From: knassen
Subject: Re: PSPP-BUG: CLOSE FILE HANDLE not working
Date: Tue, 7 Mar 2023 17:37:32 -0500

It’s working now!  Thank you for the fix.  I’ll test it on Windows when I get an updated install.  I’ve tried it on FreeBSD 12.4-stable, and it works like a charm (pspp and psppire).  No error.  I’ve tried closing a file handle in the same program and reusing it for a new file handle command and a new close file handle, which also works.  No warning or error.  Also works on my Debian Buster system.

 

I’m running out of things to report.  I think I found one minor doc issue, which I’ll send you.  And if I see any other documented syntax items that aren’t working, I’ll let you know.  I’m coming across things by trying things.  Pspp is working a lot better for me now!

 

I hope you are in better shape for a 2.0 release now.

 

From: Ben Pfaff <blp@cs.stanford.edu>
Sent: Tuesday, March 7, 2023 3:46 PM
To: knassen@chartermi.net
Cc: bug-gnu-pspp@gnu.org
Subject: Re: PSPP-BUG: CLOSE FILE HANDLE not working

 

Thank you for reporting this bug! I applied a fix.

 

On Mon, Mar 6, 2023 at 5:53 PM <knassen@chartermi.net> wrote:

The CLOSE FILE HANDLE command gives me a syntax error (expecting end of command) when used as the docs show.  See the example below.

 

I don’t know if it’s something in my OS environment (like a compiler or option) or what.  If you can’t confirm, then it’s likely something like that.

 

In PSPPIRE, I’d like to close the file handle so that rerunning a program doesn’t gives me a warning about a file handle already in use.  Thus, I can make changes, add code, and rerun entire programs in psppire without dealing with warnings.  The pspp docs say to close a file handle before using it again, and I agree.

 

In batch mode, the file gets closed when the run ends, I hope.  But if you have a CLOSE FILE HANDLE in a batch file, the same syntax error happens.

 

For some reason, pspp gives a syntax error “expecting end of command” but there is a period there to end the command, and the file handle name is not recognized.  The error is pointing at the file handle name.  It’s as if the file handle name isn’t retained.

 

Here’s a simple example with delimited data.  It’s enough for me to issue a CLOSE FILE HANDLE command with an existing file handle name, though.

 

> more rawdata.csv

PATID,INFO1,INFO2,INFO3

A01,10,23,11

A02,12,20,15

A03,9,18,6

A05,2,3,4

 

/* Read CSV data using a file handle */

 

FILE HANDLE raw /NAME="rawdata.csv" /MODE=CHARACTER.

 

GET DATA /TYPE=TXT /FILE=raw /ARRANGEMENT=DELIMITED /DELIMITERS="," /FIRSTCASE=2

   /VARIABLES=PATID A3 INFO1 F2 INFO2 F2 INFO3 F2.

 

LIST.

  

CLOSE FILE HANDLE raw .

 

Results of the run:

 

        Data List

+-----+-----+-----+-----+

|PATID|INFO1|INFO2|INFO3|

+-----+-----+-----+-----+

|A01  |   10|   23|   11|

|A02  |   12|   20|   15|

|A03  |    9|   18|    6|

|A05  |    2|    3|    4|

+-----+-----+-----+-----+

 

rawdata2.sps:10.19-10.21: error: CLOSE FILE HANDLE: Syntax error expecting end

of command.

   10 | CLOSE FILE HANDLE raw .

      |                   ^~~

 

 

 

 

 

 

_______________________________________________
Bug-gnu-pspp mailing list
Bug-gnu-pspp@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-gnu-pspp


reply via email to

[Prev in Thread] Current Thread [Next in Thread]