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

What is Spufi equivalent to SKIPAFT


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

New User


Joined: 10 Nov 2006
Posts: 19
Location: New York

PostPosted: Thu Apr 28, 2011 10:13 pm
Reply with quote

I want to select from a table x-nbr of rows after skipping the first x-nbr of rows. Like this...

Select *
From db2table.abcd
skip first 10000 rows
fetch 1000 rows
;

Can this be done?
Thanks.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Apr 28, 2011 10:24 pm
Reply with quote

SKIPAFT
just curious... in what language did You find the SKIPAFT function ???
Back to top
View user's profile Send private message
ywheeler

New User


Joined: 10 Nov 2006
Posts: 19
Location: New York

PostPosted: Thu Apr 28, 2011 11:07 pm
Reply with quote

SKIPAFT- Its either sort or fileaid I don't remember right now.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Fri Apr 29, 2011 1:53 pm
Reply with quote

at minimum you would need an "order by"
without order by the first n rows is meaningless.
In Spufi/qmf
Code:
select * from
(select T.*,row_number() over (order by col1) as rn from table1 T) A
where rn  between 10001 and 11001

or if you don't want to order by
Code:
select * from
(select T.*,row_number() over (order by 1) as rn from table1 T) A
where rn  between 10001 and 11001


In an application program I would use "scrollable cursors"
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 DELETE SPUFI DB2 1
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
No new posts File matching functionality in Easytr... DFSORT/ICETOOL 14
No new posts Beautifying the SPUFI output DB2 5
No new posts Cobol Db2 program (inserting Char Equ... COBOL Programming 0
Search our Forums:

Back to Top