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

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

PSPP-BUG: CLOSE FILE HANDLE not working


From: knassen
Subject: PSPP-BUG: CLOSE FILE HANDLE not working
Date: Mon, 6 Mar 2023 20:53:28 -0500

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 .

      |                   ^~~

 

 

 

 

 

 


reply via email to

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