MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Copying few records in a big file!!!!

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
lal
Beginner


Joined: 21 Oct 2003
Posts: 70
Topics: 25

PostPosted: Sat Apr 17, 2004 1:27 am    Post subject: Copying few records in a big file!!!! Reply with quote

Hi Friends,
I have a Input sequential file containing around 1 lakh records and want to copy around 30000 records to the output sequential file. But the 30000 records to be copied are in the following sequence
a) From 1 to 10000
b) From 40000 to 50000
c) From 90000 to 100000
ie around 30000 records in the output file
This is the requirement friends...can I do it by fileaid online/batch or any other tool..
Thanx in advance..
Regards,
Lal..
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Sat Apr 17, 2004 8:20 am    Post subject: Reply with quote

LAL,

Here is a simple 1 pass sort step which will give you the desired results. I assuming that your input file is 80 bytes in length and is of FB recfm format.

A brief explanation of the Job. We a seqnum which acts like a rec no at the end of every record. Now we will use include on the outfil and select only the records which are needed. And finally while writting out we strip off the seqnum using outrec.

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DSN=MYINPUT FILE,
//            DISP=SHR
//SORTOUT  DD DSN=OUTPUT FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE),
//SYSIN    DD *
  SORT FIELDS=COPY     
  INREC FIELDS=(1,80,SEQNUM,8,ZD)
  OUTFIL INCLUDE=(81,8,ZD,LE,10000,OR,
                 (81,8,ZD,GE,40000,AND,81,8,ZD,LE,50000),OR,
                 (81,8,ZD,GE,90000,AND,81,8,ZD,LE,100000)), 
  OUTREC=(1,80)
/*                                   


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Sat Apr 17, 2004 9:41 am    Post subject: Reply with quote

Lal,

Kolusu's one pass DFSORT job is the most efficient, but it must be changed for different LRECLs. For what it's worth, here's a two pass DFSORT/ICETOOL that doesn't have to be changed for different LRECLs:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T3 DD DSN=&&T3,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
//    DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,PASS)
//    DD DSN=*.T3,VOL=REF=*.T3,DISP=(OLD,PASS)
//OUT DD DSN=...  output file
//TOOLIN DD *
  COPY FROM(IN) USING(CTL1)
  COPY FROM(CON) TO(OUT)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=T1,ENDREC=10000
  OUTFIL FNAMES=T2,STARTREC=40000,ENDREC=50000
  OUTFIL FNAMES=T3,STARTREC=90000,ENDREC=100000
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Aug 14, 2008 1:58 pm    Post subject: Reply with quote

And here's a simpler and much better one pass job that doesn't have to be changed for different LRECLs. It uses DFSORT's new SUBSET function available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008):

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(1,10000) RRN(40000,50000) RRN(90000,100000)
/*


For complete details on the new SUBSET function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Fri Oct 17, 2008 6:12 am    Post subject: Frank's effort is laudable ! Reply with quote

Frank,

I am really surpirsed and must praise you for your effort to post new solutions to the already given solutions using new features of DFSORT. I must appreciate you and your effort is definitely laudable as far as DFSORT solutions are concerned. claps

For this particular thread, the solution was given in year 2004 and you have given a new solution to the same in year 2008 (this uses new feature of DFSORT) !!! How do you keep track of this Exclamation Question You are really making wonders with your acumen of DFSORT product & the greatest thing is the DFSORT help has been multiplied now with KOLUSU joining you. Very Happy

GREAT.......GREAT......GREAT........ 8) Surprised

You are a great institute yourself. I wish and pray God to give you great health and keep going like this forever.

Thank You
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
callanand
Beginner


Joined: 12 Jun 2007
Posts: 23
Topics: 2

PostPosted: Fri Oct 17, 2008 9:02 am    Post subject: Reply with quote

I would agree with MF User. Both Frank and Kolusu are absolute genious when it comes to providing solution in Sort(They are also genious in other areas of Mainframe too Very Happy ). I have been so inspired by their solutions that whenever I am assigned any task, the first thought that comes to my mind is how to achieve this using SORT. Great work guys and thanks a lot for such a great help and great product. Very Happy
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Oct 17, 2008 11:42 am    Post subject: Reply with quote

Thanks for all of the kind words. Kolusu and I really appreciate them. I'm extremely happy that Kolusu took me up on my invitation to join the DFSORT Team!

Quote:
How do you keep track of this


By doing exactly that - I keep track of them in a file by URL so I can refer back to them.

Quote:
They are also genious in other areas of Mainframe too


Kolusu's broad knowledge of other Mainframe areas never ceases to amaze me. But I can't claim that kind of knowlege except for DFSORT and ICETOOL.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Fri Oct 17, 2008 11:45 am    Post subject: Reply with quote

Quote:

Kolusu's broad knowledge of other Mainframe areas never ceases to amaze me.


I am envious about it......... Laughing Just kidding. I wonder how Kolusu gets time to do that.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group