Page 1 of 2

declare cursor in CICS and sqlcode = -904

PostPosted: Thu Nov 01, 2012 5:19 pm
by ChenTao
here is my code,
it's in CICS environment:
EXEC SQL
DECLARE CUR1 INSENSITIVE SCROLL CURSOR
FOR SELECT GOODID,INDATE,INPIECE
FROM STSTORAGE
WHERE GOODID = :COMM-GOID
i,debug the program in the CEDF ,and when the program comes to this sentence, the sqlcode returned -904,the table exists.
i don't konw if i should do something special to execute this sentence. i use scrollble cursor the first time.

Re: declare cursor in CICS and sqlcode = -904

PostPosted: Thu Nov 01, 2012 5:31 pm
by Pandora-Box
Is the tablespace in RW mode?

To check that try to execute the command

-DIS DB(<DATABASE>) SPACE(<TABLESPACE>)

Re: declare cursor in CICS and sqlcode = -904

PostPosted: Thu Nov 01, 2012 7:30 pm
by ChenTao
premkrishnan wrote:Is the tablespace in RW mode?

To check that try to execute the command

-DIS DB(<DATABASE>) SPACE(<TABLESPACE>)


i'm sorry,i don't define any tablespace before i execute this program, and don't know how to and why i must define the tablespace, and maybe it's the reason why i can't execute the program correctly. :(
here is the error information, wish it help.
SQLCABC = 136
SQLCODE = -904
SQLERRMC = 'UPDATABLE WORKFILE,100,TEMP DATABASE '
SQLERRP = 'DSNXISCR'
......
By the way , where should i input the command you said before? i have been stuck in this proble for two days. i want to scroll page up and down to show all records in the map, maybe it's too hard for me.. :(

Re: declare cursor in CICS and sqlcode = -904

PostPosted: Thu Nov 01, 2012 7:52 pm
by Pandora-Box
-DIS DB(<DATABASE>) SPACE(<TABLESPACE>)


could be executed as job too using

//STEP01 EXEC PGM=IKJEFT01
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(<SSID>)
-DIS DB(<DATABASE>) SPACE(<TABLESPACE>)
END
//SYSIN DD DUMMY


You need get the Database and Tablespace where your table resides and execute the job

The reason why I am asking to execute the command is to check if the Tablespace is in RW mode (Read write)

You would get -904 also when your table is in check pending , Recover pending , Copy pending etc

Re: declare cursor in CICS and sqlcode = -904

PostPosted: Thu Nov 01, 2012 7:55 pm
by Pandora-Box
Do you use any of the tools

Db2 admin tool,BMC,Platinum?

Re: declare cursor in CICS and sqlcode = -904

PostPosted: Thu Nov 01, 2012 8:08 pm
by ChenTao
premkrishnan wrote:Do you use any of the tools

Db2 admin tool,BMC,Platinum?


maybe i'm too beginner...
i haven't learned nothing but program on the MVS for about 2 months. i wish you can tell me some essential knowledge i should know before i can handle this problem. thank you.
is the problem occurs because i haven't define the tablespace ?

Re: declare cursor in CICS and sqlcode = -904

PostPosted: Thu Nov 01, 2012 8:14 pm
by Pandora-Box
For a quick fix do you have any mentor in your team whom you could reach for help?

Re: declare cursor in CICS and sqlcode = -904

PostPosted: Thu Nov 01, 2012 8:27 pm
by ChenTao
i got no one to reach for :( , i'm a student and i have 5 parterner in my group, i'm sorry but i'm the group leader. we both want to fulfill scroll page , and i'm the one who are occupid to finish this job. besides this problem, we both did well :) . now we have no teacher, but we all try our best to use what we have learned. maybe i should learn more and than come back for this problem.

Re: declare cursor in CICS and sqlcode = -904

PostPosted: Thu Nov 01, 2012 8:59 pm
by Pandora-Box
What I would say is try to identify the database and tablespace of your table STSTORAGE you can get

So to get that you need to write a query to SYSIBM.SYSTABLES to get DBNAME and TSNAME of your table

So query will be

SELECT DBNAME , TSNAME FROM SYSIBM.SYSTABLES WHERE NAME ='STSTORAGE'


After that you get the name of your table's Database and Tablespace

With that value

Substitute in the job I gave earlier and execute it.

and let me know the output you get

Re: declare cursor in CICS and sqlcode = -904

PostPosted: Thu Nov 01, 2012 9:11 pm
by ChenTao
premkrishnan wrote:What I would say is try to identify the database and tablespace of your table STSTORAGE you can get

So to get that you need to write a query to SYSIBM.SYSTABLES to get DBNAME and TSNAME of your table

So query will be

SELECT DBNAME , TSNAME FROM SYSIBM.SYSTABLES WHERE NAME ='STSTORAGE'


After that you get the name of your table's Database and Tablespace

With that value

Substitute in the job I gave earlier and execute it.

and let me know the output you get


thank you very much! i will try tomorrow when i go to school, since it's already been bed time, tomorrow morning i will have a try and then give you a reply .