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

How to find the nth record from a huge dataset?


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

New User


Joined: 15 Apr 2007
Posts: 8
Location: Foster City, CA

PostPosted: Mon Apr 16, 2007 12:30 am
Reply with quote

Is there a way to get the nth record from a huge dataset? Lets say I have a dataset of 75 million records and the 4 millionth records is erraneous. How can I just fetch that record using DFSORT/ICETOOL or in any other way in JCL?

Thanks in advance.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Apr 16, 2007 12:39 am
Reply with quote

Hello,

How do you know exactly which record is the problem record? Might there be more "bad" records after the 4millionth one? What makes the record(s) erroneous?

If you want to do something with only the one record (specified by number of records from the beginning of the file, you can do this with SKIPREC and STOPAFT.
Back to top
View user's profile Send private message
kc.karthik

New User


Joined: 15 Apr 2007
Posts: 8
Location: Foster City, CA

PostPosted: Mon Apr 16, 2007 12:43 am
Reply with quote

Thanks for your quick reply. Druing my DB loading process the records that have been rejected are filtered separately with the exact sequence no. in the dataset. SO I have more than one erroneous data but not in sequence but at irregulare intervals in the dataset.

I am new to mainframe sine this is teh first time I am dealing with mainframe datasets as sources. Could you pls tell me how cna you use SKIPREC to locate a particular record?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Apr 16, 2007 1:02 am
Reply with quote

Sort material is here: DFSORT/ICETOOL Reference Material
IDCAMS can do it also.
It might be easier to use OMIT to re-filter the bad records out.
It would make the most sense for the loading program to filter them out upon loading.
Back to top
View user's profile Send private message
kc.karthik

New User


Joined: 15 Apr 2007
Posts: 8
Location: Foster City, CA

PostPosted: Mon Apr 16, 2007 1:42 am
Reply with quote

Thanks a lot for your help. I will be modifying the DB loading process to filter out properly formatted records so we can use them directly to correct. Currently it is an existing process which I am taking over.

Thanks again for all your help.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Apr 16, 2007 3:28 am
Reply with quote

You're welcome icon_smile.gif

Are you able to continue or is there something else needed?
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: Tue Apr 17, 2007 10:34 pm
Reply with quote

SKIPREC and STOPAFT are fine for extracting one record or a contiguous group of records. OUTFIL with STARTREC and ENDREC can do that too.

If you want to extract specific records with different relative record numbers, you can use OVERLAY to add a sequence number to the records and then use OUTFIL INCLUDE to select the records you want. For example, if you wanted records 5002, 9003 and 28002 from an input file with RECFM=FB and LRECL=80, you could use a DFSORT job like this:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC OVERLAY=(81:SEQNUM,8,ZD)
  OUTFIL BUILD=(1,80),
   INCLUDE=(81,8,ZD,EQ,+5002,OR,
            81,8,ZD,EQ,+9003,OR,
            81,8,ZD,EQ,28002)
/*
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: Tue Sep 02, 2008 11:33 pm
Reply with quote

If you want to extract specific records with different relative record numbers, you can now do that quite easily using the new SUBSET operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008). For example:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DISP=...  output file
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) INPUT KEEP RRN(5002) RRN(9003) RRN(28002)
/*


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

Use [URL] BBCode for External Links
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
Search our Forums:

Back to Top