View previous topic :: View next topic
|
Author |
Message |
senjay
Active User
Joined: 10 May 2007 Posts: 147 Location: India
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
On a sort's OUTFIL, use the SAMPLE command. |
|
Back to top |
|
|
op
New User
Joined: 31 Oct 2006 Posts: 48 Location: Chennai
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|