Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need help With Sampling & Include in same card.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
rajat.madhok20

New User


Joined: 26 May 2012
Posts: 4
Location: India

PostPosted: Tue Feb 18, 2014 3:08 pm    Post subject: Need help With Sampling & Include in same card.
Reply with quote

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
Code:
12345678912347  X2


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
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Tue Feb 18, 2014 3:27 pm    Post subject: Reply to: Need help With Sampling & Include in same card
Reply with quote

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
View user's profile Send private message
rajat.madhok20

New User


Joined: 26 May 2012
Posts: 4
Location: India

PostPosted: Tue Feb 18, 2014 4:58 pm    Post subject: Reply to: Need help With Sampling & Include in same card
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Feb 19, 2014 3:28 am    Post subject: Re: Reply to: Need help With Sampling & Include in same
Reply with quote

ramprakashn wrote:
Pandora,

I couldn't test it as I am on leave today icon_neutral.gif . 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
View user's profile Send private message
rajat.madhok20

New User


Joined: 26 May 2012
Posts: 4
Location: India

PostPosted: Wed Feb 19, 2014 1:36 pm    Post subject: Reply to: Need help With Sampling & Include in same card
Reply with quote

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 icon_biggrin.gif
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
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
This topic is locked: you cannot edit posts or make replies. Sort card to replace text using cross... Susanta SYNCSORT 32 Tue Sep 13, 2016 4:17 pm
No new posts Creating a dynamic sort card in JCL u... ChitraChhabra DFSORT/ICETOOL 4 Wed Aug 03, 2016 6:15 pm
No new posts INCLUDE condition questions van bui DFSORT/ICETOOL 1 Thu Jun 30, 2016 9:52 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us