Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
To copy every nth record from input to output

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: To copy every nth record from input to output
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: 3158
Location: Tucson AZ

PostPosted: Wed May 23, 2007 3:25 pm    Post subject:
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    Post subject: Selection of nth record in regular intervals
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: 8593
Location: Back in jolly old England

PostPosted: Wed May 23, 2007 6:44 pm    Post subject:
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    Post subject: Reply : use SAMPLE
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 Moderator


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

PostPosted: Sun May 27, 2007 12:33 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts it is possible output a SET value fro... Martylin JCL & VSAM 4 Fri Sep 22, 2017 7:08 am
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Hardcoded negative sign value in output scdinesh SYNCSORT 8 Fri Sep 08, 2017 5:28 am
No new posts XMITIP sends it out. Can it copy on l... Rommel Dayon Rustia IBM Tools 0 Tue Sep 05, 2017 10:16 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us