Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
DB2 Sql Error code -204

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
rohit_naidu

New User


Joined: 18 May 2018
Posts: 3
Location: UK

PostPosted: Fri May 18, 2018 4:40 pm    Post subject: DB2 Sql Error code -204
Reply with quote

Hi,

Am facing a Sql error -204(Object not Found) when trying to open a cursor which has Temporary table reference. Have done below analysis on this issue.

1) Validated Temporaray table creation and records insertion was successfully by displaying and fetching the values from Temp Table.
2) Ensured that Temporary Table was created before opening the cursor
3) Table and Fields name are correct.
4) If replaces Temporary table with hard code values, cursor is working fine.

Below is the Cursor and Temporary table definition followed with open cursor in the sequence executed in the Program

Code:
WORKING STORAGE SECTION.

EXEC SQL
  DECLARE CJLR-OUT-NOTICE-CSR CURSOR FOR
    SELECT DISTINCT
           PARTNO
    FROM  PDDB2DB.PWRSFUP
    WHERE PROD_TYPE||VEHICLE_LINE IN
    (SELECT DISTINCT WWRS_VEHICLE FROM SESSION.VEHICLE
    WHERE WWRS_VEH_REQ = "CJLR")
END-EXEC.


PROCEDURE DIVISION.

EXEC SQL
    DECLARE GLOBAL TEMPORARY TABLE SESSION.VEHICLE
            (WWRS_VEHICLE      CHAR(3) NOT NULL,
             WWRS_VEH_REQ      CHAR(4) NOT NULL)
    ON COMMIT PRESERVE ROWS
END-EXEC

EXEC SQL
     INSERT INTO SESSION.VEHICLE
          (WWRS_VEHICLE,WWRS_VEH_REQ)
     VALUES (:WS-VEHICLE,:WS-VEH-REQ)
END-EXEC

EXEC SQL
    OPEN CJLR-OUT-NOTICE-CSR
END-EXEC


Please adviSe what is causing this issue and how to resolve it.
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2126
Location: UK

PostPosted: Fri May 18, 2018 7:23 pm    Post subject: Reply to: DB2 Sql Error code -204
Reply with quote

What are the pictures for the fields? Have you displayed them between markers e.g.
Code:
>value  <
?
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2064
Location: NY,USA

PostPosted: Fri May 18, 2018 9:26 pm    Post subject:
Reply with quote

It looks like the temp table is getting Dropped during the process before you are opening the cursor.
Try DROPing the temp table before its Declaration and get rid of the DROP from elsewhere( if present).

After opening the cursor what next? are you processing it in the same program like the FETCH?
Back to top
View user's profile Send private message
rohit_naidu

New User


Joined: 18 May 2018
Posts: 3
Location: UK

PostPosted: Fri May 18, 2018 10:46 pm    Post subject: Re: Reply to: DB2 Sql Error code -204
Reply with quote

Nic Clouston wrote:
What are the pictures for the fields? Have you displayed them between markers e.g.
Code:
>value  <
?


Its alphanumeric fields.
WWRS_VEHICLE PIC X(03).
WWRS_VEH_REQ PIC X(04).
Back to top
View user's profile Send private message
rohit_naidu

New User


Joined: 18 May 2018
Posts: 3
Location: UK

PostPosted: Fri May 18, 2018 10:50 pm    Post subject:
Reply with quote

Rohit Umarjikar wrote:
It looks like the temp table is getting Dropped during the process before you are opening the cursor.
==> Have displayed the Value from this temp table before opening the cursor to check if Temp table exist or not. Its displaying required value.

Try DROPing the temp table before its Declaration and get rid of the DROP from elsewhere( if present).
==> It will throw the SQL error, haven't tried yet. Do u want me to try

After opening the cursor what next? are you processing it in the same program like the FETCH?

==> fetching the data and writing into output file
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2064
Location: NY,USA

PostPosted: Fri May 18, 2018 11:01 pm    Post subject:
Reply with quote

Try the other thing suggested of Dropping the temp table if nothing works out then check with the DBA at your site.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts PLI Run JCL error with 806 shrivatsa PL/I & Assembler 6 Wed Dec 05, 2018 12:23 pm
No new posts calling java code(on mainframe from c... elixir1986 COBOL Programming 1 Fri Nov 30, 2018 1:57 am
No new posts Code numeric format to display both '... Time2Live COBOL Programming 7 Wed Nov 21, 2018 10:20 pm
No new posts Will this code extract 1 byte from fi... pkmurali CLIST & REXX 8 Sat Nov 10, 2018 11:13 pm
No new posts Error reading file in REXX module ashek15 CLIST & REXX 3 Wed Oct 24, 2018 4:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us