MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

-540 Sqlcode when trying to insert into a newly created tbl

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
coolguy
Beginner


Joined: 01 Dec 2004
Posts: 82
Topics: 28

PostPosted: Thu Mar 15, 2007 8:27 am    Post subject: -540 Sqlcode when trying to insert into a newly created tbl Reply with quote

Hi

I have creared one Table in Db2 with primary keys and views, while insering some values or trying select from the table

i am getting the error msg
Code:

DSNT408I SQLCODE = -540, ERROR:  THE DEFINITION OF TABLE TRP01.EMP
         IS INCOMPLETE BECAUSE IT LACKS A PRIMARY INDEX OR A REQUIRED UNIQUE   
         INDEX                                                                 
DSNT418I SQLSTATE   = 57001 SQLSTATE RETURN CODE                               
DSNT415I SQLERRP    = DSNXOTL SQL PROCEDURE DETECTING ERROR                     
DSNT416I SQLERRD    = -550  0  0  -1  0  0 SQL DIAGNOSTIC INFORMATION           
DSNT416I SQLERRD    = X'FFFFFDDA'  X'00000000'  X'00000000'  X'FFFFFFFF'       
         X'00000000'  X'00000000' SQL DIAGNOSTIC INFORMATION   


Could you please provide me what are the steps we need to do to cretare that table in DB2 and
how to connect with new DB2 table with our cobll db2 program

PS: we are started the proj from the begining

jsut now we have creted the database and table space

pls provide me your valuable ideas

Thanks
cool
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Thu Mar 15, 2007 8:46 am    Post subject: Reply with quote

Can you post the DDL for your table creation so that we can see exactly what you are doing?
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
coolguy
Beginner


Joined: 01 Dec 2004
Posts: 82
Topics: 28

PostPosted: Thu Mar 15, 2007 9:06 am    Post subject: Reply with quote

Pls find the below ddl
Code:

CREATE TABLE TRP01.TPAS_DLY_TRN_SMY                               
   (PLNNUM                 CHARACTER(6) FOR SBCS DATA not NULL   
   ,PAPRD                  CHARACTER(2)FOR SBCS DATA NOT NULL     
   ,PADTRADE               DATE           NOT NULL               
   ,EXL_TAX_TYP_CD         CHARACTER(3)   FOR SBCS DATA NOT NULL 
   ,DYA_TRN_CD             CHARACTER(4)   FOR SBCS DATA NOT NUll 
   ,TRN_SBT_CD             DECIMAL(2,0)   nOT NULL               
   ,PASRC                  CHARACTER(1)   FOR SBCS DATA NOT null 
   ,TRN_ADJ_IN             CHARACTER(20)  FOR SBCS DATA NOT NULL 
   ,ADJ_FIN_DT             DATE           wITH DEFAULT NULL       
   ,TRN_DLR_AM             DECIMAL(17,2) NOT NULL                 
   ,TRN_SHR_QT             DECIMAL(15,3) NOT NULL                 
   ,TRN_CST_AM             DECIMAL(17,2) WITH DEFAULT NULL       
   ,NET_TRN_AM             DECIMAL(17,2) NOT NULL                 
   ,NET_TRN_SHR_QT         DECIMAL(15,3) NOT NULL                 
   ,TRN_CSH_AM             DECIMAL(17,2) NOT NULL                 
,VCH_NU                 DECIMAL(9,0)  WITH DEFAULT NULL         
,ORG_USR_NU             CHARACTER(8)   FOR SBCS DATA NOT NULL   
,ORG_USR_ACV_TS         TIMESTAMP      NOT NULL WITH DEFAULT   
,LTS_UPD_USR_NU         CHARACTER(8)   FOR SBCS DATA NOT NULL   
,LTS_UPD_USR_TS         TIMESTAMP      NOT NULL WITH DEFAULT   
, PRIMARY KEY (PLNNUM                                           
               ,PAPRD                                           
               ,PADTRADE                                       
               ,EXL_TAX_TYP_CD                                 
               ,DYA_TRN_CD                                     
               ,TRN_SBT_CD                                     
               ,PASRC) )                                       
 IN  TRPDB.TRPTS01;                                             

This is my ddl

Thanks
Cool
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Mar 15, 2007 9:15 am    Post subject: Reply with quote

coolguy,

The table is marked as unavailable until its primary index is explicitly created unless the CREATE TABLE statement is processed by the schema processor. In that case, DB2 implicitly creates an index to enforce the uniqueness of the primary key and the table definition is considered complete.

First go and create index on the primary key before you perform any inserts/updates

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
videlord
Beginner


Joined: 09 Dec 2004
Posts: 147
Topics: 19

PostPosted: Thu Mar 15, 2007 2:24 pm    Post subject: Reply with quote

Hi kolusu,

Do you have any experience of "schema processor" mentioned in your reply?
Or do you have any document/reference link about it?

Thanks.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Mar 15, 2007 5:09 pm    Post subject: Reply with quote

videlord,

check this link

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/dsnagh13/2.3.4.2?SHELF=DSNSHHA4&DT=20030505155352&CASE=

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
coolguy
Beginner


Joined: 01 Dec 2004
Posts: 82
Topics: 28

PostPosted: Thu Mar 15, 2007 11:52 pm    Post subject: Reply with quote

Could you please provide me how to connect with new DB2 table with our cobll db2 program Or do you have any document/reference link about it?
Please help in that
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Mar 16, 2007 2:45 am    Post subject: Reply with quote

Which manuals have you referred to and which bits of them do you not understand, or are confusing you?
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
coolguy
Beginner


Joined: 01 Dec 2004
Posts: 82
Topics: 28

PostPosted: Fri Mar 16, 2007 6:23 am    Post subject: Reply with quote

I in the appliction side only ,i am not having much idea about the DBA activity ,while doing this one i facing this problem that's reason i asked for some useful links

Cool
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Mar 16, 2007 6:59 am    Post subject: Reply with quote

Your DB2 programming course should have covered this - it is not DBA activity. But you need the programming guide - (DB2 V7 Application Programming and SQL Guide) accessible via the link at the top. And Section 5 is probably the best answer to your query.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group