Include file problem.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Include file problem.

drfg2008
SPSS 20 (64bit)

Include file problem.

We try to start several SPSS/SQL-codes in different sps-programs (Syntax-Files) from a central SPSS file.

The first GET DATA command deletes the old table in the database. The second GET DATA command creates the new table. The two codes are integrated in one SPSS-syntax file.

Now we have more than one tables to create.

Each syntax file (with two SQL-statements)  alone is working fine, unless it is not started with ‘include file’. If, however, the program is started with include file = '...'  from a central SPSS-syntax file, SPSS returns an error and aborts.

> Warning on line 136th Command name: GET DATA
> SQLNumResultCols Failure

It seems that SPSS breaks off after clearing the table.


Here's the code (abridged)

--Filename: SPSS1000.sps --------------- *.

GET DATA
   / TYPE = ODBC
   / CONNECT = 'DSN = Data Bank;'
   / SQL = 'DROP TABLE This_Table;'
   / ASSUMEDSTRWIDTH = 255
CACHE.
EXECUTE.


GET DATA
   / TYPE = ODBC
   / CONNECT = 'DSN = Data Bank;'
   / SQL = 'CREATE TABLE This_Table

(...)

…..end of file …………………………
Dr. Frank Gaeth

Reply | Threaded
Open this post in threaded view
|

Re: Include file problem.

Jon K Peck
Please try with the INSERT command instead of INCLUDE, which is obsolete.  INCLUDE has different syntax parsing behavior.  I noted also that there is a missing period after the first GET command below.

Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        drfg2008 <[hidden email]>
To:        [hidden email]
Date:        03/07/2012 05:55 AM
Subject:        [SPSSX-L] Include file problem.
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




SPSS 20 (64bit)

Include file problem.

We try to start several SPSS/SQL-codes in different sps-programs
(Syntax-Files) from a central SPSS file.

The first GET DATA command deletes the old table in the database. The second
GET DATA command creates the new table. The two codes are integrated in one
SPSS-syntax file.

Now we have more than one tables to create.

Each syntax file (with two SQL-statements)  alone is working fine, unless it
is not started with ‘include file’. If, however, the program is started with
include file = '...'  from a central SPSS-syntax file, SPSS returns an error
and aborts.

> Warning on line 136th Command name: GET DATA
> SQLNumResultCols Failure

It seems that SPSS breaks off after clearing the table.


Here's the code (abridged)

--Filename: SPSS1000.sps --------------- *.

GET DATA
  / TYPE = ODBC
  / CONNECT = 'DSN = Data Bank;'
  / SQL = 'DROP TABLE This_Table;'
  / ASSUMEDSTRWIDTH = 255
CACHE.
EXECUTE.


GET DATA
  / TYPE = ODBC
  / CONNECT = 'DSN = Data Bank;'
  / SQL = 'CREATE TABLE This_Table

(...)

…..end of file …………………………


-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Include-file-problem-tp5544019p5544019.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Reply | Threaded
Open this post in threaded view
|

Re: Include file problem.

Bruce Weaver
Administrator
In reply to this post by drfg2008
When you have syntax that runs fine interactively, but not via INCLUDE FILE, one possibility is that the syntax does not adhere to batch processing rules (which is required for INCLUDE FILE).  You could try INSERT FILE instead.  It allows you to specify either interactive or batch processing rules.  Look it up in the fine manual.

HTH.


drfg2008 wrote
SPSS 20 (64bit)

Include file problem.

We try to start several SPSS/SQL-codes in different sps-programs (Syntax-Files) from a central SPSS file.

The first GET DATA command deletes the old table in the database. The second GET DATA command creates the new table. The two codes are integrated in one SPSS-syntax file.

Now we have more than one tables to create.

Each syntax file (with two SQL-statements)  alone is working fine, unless it is not started with ‘include file’. If, however, the program is started with include file = '...'  from a central SPSS-syntax file, SPSS returns an error and aborts.

> Warning on line 136th Command name: GET DATA
> SQLNumResultCols Failure

It seems that SPSS breaks off after clearing the table.


Here's the code (abridged)

--Filename: SPSS1000.sps --------------- *.

GET DATA
   / TYPE = ODBC
   / CONNECT = 'DSN = Data Bank;'
   / SQL = 'DROP TABLE This_Table;'
   / ASSUMEDSTRWIDTH = 255
CACHE.
EXECUTE.


GET DATA
   / TYPE = ODBC
   / CONNECT = 'DSN = Data Bank;'
   / SQL = 'CREATE TABLE This_Table

(...)

…..end of file …………………………
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Include file problem.

drfg2008
In reply to this post by Jon K Peck
Thanks

INSERT FILE works.

(The period must have disappeared when pasting the program here.)
Dr. Frank Gaeth