IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Getting -504 Cursor Name GTT-ARTS-CURSOR is not Declared


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Robin Sulsona

New User


Joined: 14 Dec 2015
Posts: 10
Location: United States

PostPosted: Fri Mar 17, 2017 1:43 am
Reply with quote

I have a COBOL program (RSJUNK) that is calling a Stored Procedure (SPJUNK). The Stored Procedure is building my GTT and when I am done I open a cursor that is defined "WITH RETURN TO CALLER" as part of the DECLARE.

When I return to RSJUNK, I look to see if it found data or not based on the content of my "output" parm of my stored procedure. When I have data I am doing the "ASSOCIATE LOCATORS (:L0C) WITH PROCEDURE SPJUNK " and the "ALLOCATE GTT CURSOR FOR RESULT SET :LOC".

When I then try to fetch this cursor, I am getting a -504 Cursor name is not declared. Could someone please shed some light on what I am missing?

Thanks for any help you can provide.
Back to top
View user's profile Send private message
Robin Sulsona

New User


Joined: 14 Dec 2015
Posts: 10
Location: United States

PostPosted: Sat Mar 18, 2017 12:50 am
Reply with quote

I have found my problem. Stored Procedures are new for me so I didn't know that I needed to do the Create Procedure with a RESULT SET 1. I copied my create from the other Stored Procedure and it was RESULT SET 0. I found another person in our dept. that had done this and he gave me 2 sample programs to look at. My code was good but I decided to look at the create procedure DDL and found that he had a value other than 0.

Now everything is working like I need it to for unit testing.

Hope that this may help someone else in the future. icon_biggrin.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Mon Mar 20, 2017 8:11 pm
Reply with quote

Yes, it will . Thanks
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Is SQLCODE -811 possible while fetchi... DB2 1
No new posts Restart logic by using cursor name in... DB2 1
No new posts Seeking Resolution for SQKCODE -991 o... DB2 2
No new posts Multiple rows within Cursor when Coun... DB2 14
Search our Forums:

Back to Top