I think you've been through this exercise before Jerry.  See:
http://archive.midrange.com/midrange-l/200707/msg00810.html
And it's not even Friday :)
Elvis
Celebrating 10-Years of SQL Performance Excellence on IBM i5/OS and OS/400
www.centerfieldtechnology.com
 
-----Original Message-----
Subject: QTEMP and SQL DDL
Whenever I try to use RUNSQLSTM to create a table from DDL statements 
and use DFTRDBCOL(QTEMP), it fails - but only if the table has a key 
constraint.  Non-keyed tables are created without incident.
The error in the listing is: SQL0199  30      46  Position 29 Keyword 
KEY not expected. Valid tokens: (.
The statement is: CONSTRAINT APOITM UNIQUE  KEY( ASCO# , ASDIV# ,   
ASDP# , ASACCT , ASSUB , ASVEN# , ASVREF , ASTRCD )
Not much in the job log except RUNSQLSTM failed.
Now, when is use PRIMARY, instead of UNIQUE, I get a job log message 
CPD32B0 with reason code 15 - The file cannot be in the QTEMP library.  
And the listing has: SQL7008  30       1  Position 1 APOITM in QTEMP not 
valid for operation.
I've use RUNSQLSTM to process the DDL statements against other libraries 
and the table gets created.  And I have created, as I said, non-keyed 
tables with DDL in QTEMP.
For what it's worth, I created the table using iNav and then generated 
the SQL using iNav over that table.
Did I fubar the definition, or is this an SQL limitation?
As an Amazon Associate we earn from qualifying purchases.