|
View previous topic :: View next topic
|
| Author |
Message |
rajat.madhok20
New User
Joined: 26 May 2012 Posts: 4 Location: India
|
|
|
|
Hi,
i have a input file like this:
| Code: |
12345678912341 X1
12345678912342 X1
12345678912343 X1
12345678912344 X1
12345678912345 X1
12345678912346 X1
12345678912347 X2
12345678912348 X3
12345678912349 X3
12345678912350 X3
12345678912351 X3
12345678912352 X2
12345678912353 X2
12345678912354 X2
12345678912355 X2
12345678912356 X1
12345678912357 X1
12345678912358 X1
12345678912359 X1
12345678912360 X1
12345678912361 X1
12345678912362 X1
12345678912363 X1
12345678912364 X2
12345678912365 X3
12345678912366 X3
12345678912367 X3
12345678912368 X3
12345678912369 X1
12345678912370 X1
12345678912371 X1
12345678912372 X1
12345678912373 X1
12345678912374 X2
12345678912375 X3
12345678912376 X3
12345678912377 X3 |
i want the output like this:
File X1: will have every 10th record out of total records
| Code: |
12345678912341 X1
12345678912360 X1 |
File X2: will have every 10th record out of total records
File X3: will have every 10th record out of total records
| Code: |
12345678912348 X3
12345678912377 X3 |
My control card:
| Code: |
OUTFIL FNAMES=TEMPX1,INCLUDE=(17,2,CH,EQ,C'X1'),STARTREC=1,SAMPLE=10
OUTFIL FNAMES=TEMPX2,INCLUDE=(17,2,CH,EQ,C'X2'),STARTREC=1,SAMPLE=10
OUTFIL FNAMES=TEMPX3,INCLUDE=(17,2,CH,EQ,C'X3'),STARTREC=1,SAMPLE=10 |
now when i am running the
My job Is Shown Below:
| Code: |
//STEP10 EXEC PGM=ICETOOL
//*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//*
//I1 DD *
12345678912341 X1
12345678912342 X1
12345678912343 X1
12345678912344 X1
12345678912345 X1
12345678912346 X1
12345678912347 X2
12345678912348 X3
12345678912349 X3
12345678912350 X3
12345678912351 X3
12345678912352 X2
12345678912353 X2
12345678912354 X2
12345678912355 X2
12345678912356 X1
12345678912357 X1
12345678912358 X1
12345678912359 X1
12345678912360 X1
12345678912361 X1
12345678912362 X1
12345678912363 X1
12345678912364 X2
12345678912365 X3
12345678912366 X3
12345678912367 X3
12345678912368 X3
12345678912369 X1
12345678912370 X1
12345678912371 X1
12345678912372 X1
12345678912373 X1
12345678912374 X2
12345678912375 X3
12345678912376 X3
12345678912377 X3
/*
//*
//X1 DD SYSOUT=*
//X2 DD SYSOUT=*
//X3 DD SYSOUT=*
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(I1) USING(CTL1)
/*
//CTL1CNTL DD *
SORT FIELDS=(17,2,A,1,14,A),FORMAT=CH
OUTFIL FNAMES=X1,INCLUDE=(17,2,CH,EQ,C'X1'),STARTREC=1,SAMPLE=10
OUTFIL FNAMES=X2,INCLUDE=(17,2,CH,EQ,C'X2'),STARTREC=1,SAMPLE=10
OUTFIL FNAMES=X3,INCLUDE=(17,2,CH,EQ,C'X3'),STARTREC=1,SAMPLE=10
/* |
Don't know how to Include & Sample the same time cause from the result i understand that Sampling is happening first & then Include condition is applied.
Code'd and shifted data |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Yes, SAMPLE= is happening first, as the manual says it will.
Add sequence numbers to your three values, calculate the sample yourself, INCLUDE= on successful sample. |
|
| Back to top |
|
 |
rajat.madhok20
New User
Joined: 26 May 2012 Posts: 4 Location: India
|
|
|
|
What i am looking at is first it created the list based on include condition and then it performs the sampling....
so that for example for X1 is filtered and then out of 25 records it pics based on the sample...
i know it can be done in 2 passes first creating a temporary file based on Include condition and then perform sampling on that..
i was thinking if we can perform in 1 PASS. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| ramprakashn wrote: |
Pandora,
I couldn't test it as I am on leave today . But I hope that the solution would work. |
ramprakashn,
Please do not post the solutions without testing. If you do feel the urge to post a solution please notify that you haven't tested the solution.
Your solution will not work as INREC is processed before the SORT and hence your sequence numbers are off. Also remember that this is a DFSORT forum and the syntax you have posted is of syncsort which is not valid with DFSORT. You also need to understand how SAMPLE=10 works, Sample =10 will pick records 1, 11,21,31,41..., but your code will select 1,10,101,110,201,210,301,310.... records which is not what OP wanted.
rajat.madhok20,
Use the following control cards.
| Code: |
//SYSIN DD *
SORT FIELDS=(17,1,CH,A),EQUALS
OUTREC OVERLAY=(19:SEQNUM,8,ZD,RESTART=(17,1))
OUTFIL FNAMES=X1,BUILD=(1,17),
INCLUDE=(17,1,CH,EQ,C'1',AND,26,1,CH,EQ,C'1')
OUTFIL FNAMES=X2,BUILD=(1,17),
INCLUDE=(17,1,CH,EQ,C'2',AND,26,1,CH,EQ,C'1')
OUTFIL FNAMES=X3,BUILD=(1,17),
INCLUDE=(17,1,CH,EQ,C'3',AND,26,1,CH,EQ,C'1')
//* |
|
|
| Back to top |
|
 |
rajat.madhok20
New User
Joined: 26 May 2012 Posts: 4 Location: India
|
|
|
|
Skolusu,
Thank you !!! i see that you are adding the sequence # & picking up the records where 1 is in the last position.... Yup it makes sense..
Cool  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|