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

To copy every nth record from input to output


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

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Wed May 23, 2007 2:40 pm
Reply with quote

Hi,

Say input has 1200 records and need to copy every 400th record to o/p.
So o/p should contain 400th, 800th,1200th records in the o/p
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Wed May 23, 2007 3:25 pm
Reply with quote

On a sort's OUTFIL, use the SAMPLE command.
Back to top
View user's profile Send private message
op

New User


Joined: 31 Oct 2006
Posts: 48
Location: Chennai

PostPosted: Wed May 23, 2007 6:40 pm
Reply with quote

Hi,

I have to selct every 400th record from input and write it to the output.
i.e. i should write 400th, 800th, 1200th record etc. into the output.

Can someone tell me if there is any SORT option for this?

Many Thanks.

Best Regards,
OP
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed May 23, 2007 6:44 pm
Reply with quote

WOW, the same question on the same day ...... in fact the top topic before you posted, so obviously you did not search.

Try the link below to get the solution for your HOMEWORK

http://ibmmainframes.com/viewtopic.php?t=21141
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri May 25, 2007 11:38 am
Reply with quote

senjay
HERE is a example which samples every 4 record from the i/p file into o/p.

Code:
//*******************************************************               
//STEP001  EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                         
1111111111111111.....111111                                             
1111111111111111.....111112                                             
1111111111111111.....111113                                             
1111111111111111.....111114                                             
1111111111111111.....111115                                             
1111111111111111.....111116                                             
1111111111111111.....111117                                             
1111111111111111.....111118                                             
1111111111111111.....111119                                             
1111111111111111.....111111                                             
1111111111111111.....111112                                             
2222222222222222.....222223                                             
3333333333333333.....333334                                             
4444444444444444.....444445                                             
/*                                                                     
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
 COPY FROM(IN1)  TO(OUT) USING(CP01)                                   
/*                                                                     
//CP01CNTL DD   *                                                       
  OUTFIL FNAMES=OUT,SAMPLE=(4,1),STARTREC=4                             
/*                                                                     


The o/p OUT contains:
Code:
1111111111111111.....111114
1111111111111111.....111118
2222222222222222.....222223


For your request, you need to put the control card as:
Code:
//CP01CNTL DD   *                                                       
  OUTFIL FNAMES=OUT,SAMPLE=(400,1),STARTREC=400                             
/*                                                                     
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: Sun May 27, 2007 12:33 am
Reply with quote

Senthil,

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  OUTFIL STARTREC=400,SAMPLE=400
/*
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top