View previous topic :: View next topic
|
Author |
Message |
Purnendu.it
New User
Joined: 11 May 2007 Posts: 57 Location: chennai
|
|
|
|
I am trying to run a simple cobol-db2 program but getting error.while precompilation state i have got rc=04 and while binding i also got rc=0.I ran the run cobol jcl and it showing below error in SYSOUT.
and not able to print the employee name..see below
Code: |
********************************* TOP OF DATA ***************
SQL FAILED.
SQL CODE = 000000206
*INTO THE PROGRAM JUNK *
EMLOYEE NAME IS :
******************************** BOTTOM OF DATA ************* |
Now DCLGEN looks like this
Code: |
******************************************************************
EXEC SQL DECLARE IBMGRP.PEMP TABLE
( EMPID CHAR(6) NOT NULL,
EMPNAME VARCHAR(20) NOT NULL,
DEPARTMENT CHAR(2) NOT NULL,
SALARY DECIMAL(6, 2) NOT NULL,
DESIGNATION CHAR(20) NOT NULL
) END-EXEC.
******************************************************************
* COBOL DECLARATION FOR TABLE IBMGRP.PEMP *
******************************************************************
01 DCLPEMP.
10 EMPID PIC X(6).
10 EMPNAME.
49 EMPNAME-LEN PIC S9(4) USAGE COMP.
49 EMPNAME-TEXT PIC X(20).
10 DEPARTMENT PIC X(2).
10 SALARY PIC S9(4)V9(2) USAGE COMP-3.
10 DESIGNATION PIC X(20). |
querry in the program is
Quote: |
EXEC SQL
SELECT EMPNAME
INTO :EMPNAME
FROM IBMGRP.PEMP
WHERE EMPID = '111111'
END-EXEC.
|
Now i know -206 comes for below reason.
column-name IS NOT A COLUMN OF AN INSERTED TABLE, UPDATED TABLE, OR ANY TABLE IDENTIFIED IN A FROM CLAUSE..
If you can see the querry I have used EMPID which is the correct column name defined in the DCLGEN given above.Then why I am getting the -206?Please suggest. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
The Dclgen what you see could still be deceiving
Please check the table and its columns in Catalog tables or admin tool |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Pandora-Box wrote: |
The Dclgen what you see could still be deceiving |
Unlikely, as DCLGEN dates from the time that IBM still did things the proper way, with well trained staff!
The answer is here. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Prino,
I saw that link but yet to insist on my point we could still edit DCLGEN after all it is just another form of COPYBOOK and I am no where blaming IBM |
|
Back to top |
|
|
Purnendu.it
New User
Joined: 11 May 2007 Posts: 57 Location: chennai
|
|
|
|
Hi Pandora,
I autogenerated DCLGEN using Spufi.I tried to run another queries like
Quote: |
EXEC SQL
SELECT EMPNAME
INTO :EMPNAME
FROM IBMGRP.PEMP
*WHERE EMPID = '111111' //COMMENTED OUT
FETCH FIRST ROW ONLY
END-EXEC
|
And this was working fine.But coming to my point why i am getting -206 for wrong column name whereas i have given correct column name? |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Purnendu.it wrote: |
Hi Pandora,
I autogenerated DCLGEN using Spufi.I tried to run another queries like
Quote: |
EXEC SQL
SELECT EMPNAME
INTO :EMPNAME
FROM IBMGRP.PEMP
*WHERE EMPID = '111111' //COMMENTED OUT
FETCH FIRST ROW ONLY
END-EXEC
|
And this was working fine.But coming to my point why i am getting -206 for wrong column name whereas i have given correct column name? |
Are you really stupid, or just pretending?
The answer is here |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
curious and tested ...
Code: |
*****EXEC SQL
***** DECLARE OWN.TAB TABLE
***** ( KEY CHAR(8) NOT NULL ,
***** DATA CHAR(8) NOT NULL )
*****END-EXEC .
*****EXEC SQL
***** SELECT DATA INTO :DATA
***** FROM OWN.TAB
***** WHERE KEY = '11111111'
*****END-EXEC .
|
ends with a RC 4
and the message ...
Code: |
DSNH206I W DSNHANAL LINE 22 COL 17 STATEMENT REFERENCES COLUMN 'OWN'.'TAB''11111111', WHICH IS NOT DECLARED IN THE SPECIFIED
TABLE(S)
SELECT DATA INTO : DATA FROM OWN.TAB WHERE KEY ='11111111'
|
meditate a bit, meditate on
APOST/QUOTE APOSTSQL/QUOTESQL
Code: |
running the same with
//PC EXEC PGM=DSNHPC,PARM='HOST(IBMCOB),APOSTSQL' |
ends with a RC 0 |
|
Back to top |
|
|
Purnendu.it
New User
Joined: 11 May 2007 Posts: 57 Location: chennai
|
|
|
|
Quote: |
meditate a bit, meditate on
APOST/QUOTE APOSTSQL/QUOTESQL
Code:
running the same with
//PC EXEC PGM=DSNHPC,PARM='HOST(IBMCOB),APOSTSQL'
ends with a RC 0
|
Hi enrico-sorichetti,
I tried to pass the PARM='HOST(IBMCOB),APOSTSQL while running the the program though it returned RC=0 but still i am getting -266.. can you please explain what you meant by above quote of yours. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
that too often an improper specification of APOST QUOTE and friends
might yield unexpected results
and it is always better to use them consistently |
|
Back to top |
|
|
Purnendu.it
New User
Joined: 11 May 2007 Posts: 57 Location: chennai
|
|
|
|
you are right ..it solved now..
Thanks Enrico.. |
|
Back to top |
|
|
|