getting abend s322 executing a cursor program



IBM's flagship relational database management system

getting abend s322 executing a cursor program

Postby kirangentlebreeze » Fri Oct 29, 2010 7:33 am

identification division.
program-id last.
data division.
working-storage section.
  exec sql
      include sqlca
  end-exec.     
  exec sql
     include empta
  end-exec.
  exec sql
     declare c1 cursor for select empno,empname,activity from empta for fetch only
  end-exec.
  procedure division.
  exec sql
     open c1
  end-exec.
  perform fp-pa until sqlcode=100.
  perform rd-pa.
  exec sql
   close c1
   end-exec.
   stop run.
   fp-pa.
        fetch c1 into:empno,empname,activity.
   rd-pa.
          fetch last c1 into:empno,empname,activity.
          display empno.
          display empname.
          display activity.

hello freinds i am just a beginner in mf
i want to fetch the last record from the cursor memory,but i am getting abend s322 executing this piece of code.can any one help me to resolve my problem.
kirangentlebreeze
 
Posts: 9
Joined: Wed Oct 27, 2010 6:39 pm
Has thanked: 0 time
Been thanked: 0 time

Re: getting abend s322 executing a cursor program

Postby dick scherrer » Fri Oct 29, 2010 8:12 am

Hello,

Your process has "timed out".

Why are you fetching all of the rows when you only want the last row (not record)?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: getting abend s322 executing a cursor program

Postby kirangentlebreeze » Fri Oct 29, 2010 8:20 am

yes i want the last record from the cursor memory
kirangentlebreeze
 
Posts: 9
Joined: Wed Oct 27, 2010 6:39 pm
Has thanked: 0 time
Been thanked: 0 time

Re: getting abend s322 executing a cursor program

Postby dick scherrer » Fri Oct 29, 2010 8:33 am

Hello,

yes i want the last record from the cursor memory
Ok, then fetch the last row. . .

To repeat:
Why are you fetching all of the rows when you only want the last row?

Suggest you read about FETCH LAST in the db2 documentaton and if you find something that is not clear, post what you found and your doubt. Someone will be able to clarify.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: getting abend s322 executing a cursor program

Postby kirangentlebreeze » Fri Oct 29, 2010 8:41 am

i tried using "fetch last c1 into:empno,empname,activity." alone
but i got abend s322
kirangentlebreeze
 
Posts: 9
Joined: Wed Oct 27, 2010 6:39 pm
Has thanked: 0 time
Been thanked: 0 time

Re: getting abend s322 executing a cursor program

Postby dick scherrer » Fri Oct 29, 2010 8:56 am

Hello,

How many rows are in the table?

Is this being run in the correct CLASS?

What do you mean by "cursor memory"? This is not a database term and terminology is critical. . .

It may help if you post the first 3 spooled outputs from the run.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: getting abend s322 executing a cursor program

Postby kirangentlebreeze » Fri Oct 29, 2010 9:17 am

there are 3 rows in my table
kirangentlebreeze
 
Posts: 9
Joined: Wed Oct 27, 2010 6:39 pm
Has thanked: 0 time
Been thanked: 0 time

Re: getting abend s322 executing a cursor program

Postby dick scherrer » Fri Oct 29, 2010 9:40 am

Hello,

When multiple things are asked, they should all be answered. . .

As you are reluctant to post enough info here for someone to help, your best bet is probably to ask a senior or a dba on your system.

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: getting abend s322 executing a cursor program

Postby GuyC » Fri Oct 29, 2010 1:33 pm

1) without "order by" fetch last is a meaningless statement because you have no idea which record will be last.
2) s322 is a jcl problem : exceeding CPU limit. ask your collegues about class and/or time parameters.
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times

Re: getting abend s322 executing a cursor program

Postby kirangentlebreeze » Fri Oct 29, 2010 4:55 pm

any ways i could able to solve my problem
thank you guys
kirangentlebreeze
 
Posts: 9
Joined: Wed Oct 27, 2010 6:39 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to DB2

 


  • Related topics
    Replies
    Views
    Last post