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

Extract n records from xth record using DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
seahawk789

New User


Joined: 22 Feb 2010
Posts: 56
Location: Cochin

PostPosted: Tue May 24, 2011 3:35 pm
Reply with quote

I have a file containing 1000 records. I want to extract 200 records from 500th record in the file.

Is it possible to achive it using DFSORT?
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Tue May 24, 2011 3:40 pm
Reply with quote

seahawk789 wrote:
I have a file containing 1000 records. I want to extract 200 records from 500th record in the file.

Is it possible to achive it using DFSORT?



see the dfsort parameter SKIPREC and STOPAFT
go through quick reference for further details.
Back to top
View user's profile Send private message
seahawk789

New User


Joined: 22 Feb 2010
Posts: 56
Location: Cochin

PostPosted: Tue May 24, 2011 3:55 pm
Reply with quote

Thanks..
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed May 25, 2011 2:47 pm
Reply with quote

If you've the PTF which supports SUBSET operator of ICETOOL, try this:
Code:
//S1   EXEC  PGM=ICETOOL                             
//TOOLMSG   DD  SYSOUT=*                             
//DFSMSG    DD  SYSOUT=*                             
//IN DD DSN=...  input file                   
//OUT DD DSN=...  output file                             
//TOOLIN DD *                                         
SUBSET FROM(IN) TO(OUT) KEEP INPUT RRN(500,700)   
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed May 25, 2011 10:32 pm
Reply with quote

FWIW, although SUBSET is generally easier to use and just as efficient, in this particular case, SKIPREC and STOPAFT is actually more efficient since STOPAFT actually stops reading records before end of file whereas SUBSET reads to end of file.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu May 26, 2011 2:07 pm
Reply with quote

Thanks Frank. It's nice to have you around.

Have a good one, icon_smile.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu May 26, 2011 2:13 pm
Reply with quote

Anuj Dhawan wrote:
Thanks Frank. It's nice to have you around.

Hmm.. Really.. I wasn't aware of this fact what Frank mentioned..
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu May 26, 2011 3:00 pm
Reply with quote

Sometimes I feel , how a product developer might look at us, The Application Developers(AD), something like

hey, kiddo, here is a new tool for you to play!

AD1 - oops! it deos not work!
AD2 - Well, it deos work!
.
.
.
chatter
chatter
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu May 26, 2011 3:16 pm
Reply with quote

Lolz.... icon_lol.gif icon_lol.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri May 27, 2011 9:08 pm
Reply with quote

I often wonder if I do more harm than good by mentioning these little tidbits. Both SKIPREC/STOPAFT and SUBSET "work", that is, they produce the correct results.

SKIPREC and STOPAFT are more efficient in some cases vs SUBSET, but limited in what they can do vs SUBSET. So it's six of one and a half dozen of the other. If you have a very large data set, knowing that SKIPREC and STOPAFT are more efficient might make a difference to you. If you don't have a very large data set (or even if you do), you might not care. Choose your poison. icon_wink.gif
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top