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
 

 

Copying selected record with count from input using ICETOOL.

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

Active User


Joined: 10 Aug 2009
Posts: 158
Location: India

PostPosted: Fri Aug 06, 2010 5:14 pm    Post subject: Copying selected record with count from input using ICETOOL.
Reply with quote

Hi,

Thank you very much for your kind support for all the time.

My requirement is I have an input file as

Sample Input:
Code:

AAA   12   789798
AAA   12   13256 
CCC   12   4654   
BBB   12   654564
BBB   12   1321   
AAA   12   231313
AAA   12   68684 
AAA   12   321   
AAA   12   0     
CCC   12   11     
CCC   12   6546   
CCC   12   1231   
CCC   12   676   
BBB   12   2342   
BBB   12   34645 
BBB   12   457   
BBB   12   3     
CCC   12   567   
AAA   12   69     
BBB   12   5668   
CCC   12   98     


Based on the first 3 character I need to copy first 5 records per key to the output file.

I will be running one sort step first to get the data in sorted. Please help/guide me to copy selected count records from the input file.

My desired output is:

Code:

AAA   12   789798
AAA   12   13256
AAA   12   4654
AAA   12   654564
AAA   12   1321
BBB   12   321
BBB   12   0
BBB   12   11
BBB   12   6546
BBB   12   1231
CCC   12   34645
CCC   12   457
CCC   12   3
CCC   12   567
CCC   12   69


Please help in this regard.

Thanks in advance.
Back to top
View user's profile Send private message

sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Fri Aug 06, 2010 5:55 pm    Post subject:
Reply with quote

satish.ms10,
How do you get below records (shown in code tags) in your expected output?They are not present in your input. AAA is replaced with BBB or CCC!!! Is this just typo?

Quote:
Sample Input:
Code:

AAA 12 789798
AAA 12 13256
CCC 12 4654
BBB 12 654564
BBB 12 1321
AAA 12 231313
AAA 12 68684
AAA 12 321
AAA 12 0
CCC 12 11
CCC 12 6546
CCC 12 1231
CCC 12 676
BBB 12 2342
BBB 12 34645
BBB 12 457
BBB 12 3
CCC 12 567
AAA 12 69
BBB 12 5668
CCC 12 98



Code:

AAA   12   4654        --> How do you get AAA with 4654, in your 
AAA   12   654564      --> expected input its present with CCC or BBB
AAA   12   1321


Quote:
I will be running one sort step first to get the data in sorted. Please help/guide me to copy selected count records from the input file.


You don't need another pass, you can combine your sort and selecting first 3 records in a single pass. Please show us your sort step to get the data sorted.

Also please provide LRECL and RECFM for the input file.

Thanks,
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 158
Location: India

PostPosted: Fri Aug 06, 2010 6:15 pm    Post subject:
Reply with quote

Hi,

Thanks for your quick response. It is a typo only. Do not see the rest of the values. My requirement is need to copy first 5 records based on the key to the output file.

My file is a VB file with 400 LRECL.

Below is my sort card to sort the data.
Code:

SORT FIELDS=(1,3,CH,A)


Let me know if you need more details.
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: Fri Aug 06, 2010 8:48 pm    Post subject:
Reply with quote

Since your input file has VB, the data starts in position 5 after the RDW, not in position 1. Here's a DFSORT/ICETOOL job that will give you the first 5 records with each key (5,3,CH).

Code:

//S1   EXEC  PGM=ICETOOL                       
//TOOLMSG   DD  SYSOUT=*                       
//DFSMSG    DD  SYSOUT=*                       
//IN DD DSN=...  input file (VB/400)
//OUT DD DSN=...  output file (VB/400)         
//TOOLIN DD *                                   
SELECT FROM(IN) TO(OUT) ON(5,3,CH) FIRST(5)     


For your example, OUT will have:

Code:

AAA   12   789798         
AAA   12   13256         
AAA   12   231313         
AAA   12   68684         
AAA   12   321           
BBB   12   654564         
BBB   12   1321           
BBB   12   2342           
BBB   12   34645         
BBB   12   457           
CCC   12   4654           
CCC   12   11             
CCC   12   6546           
CCC   12   1231           
CCC   12   676           


If that's NOT the output you expect, then you need to explain the rules for getting the output you want.
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 158
Location: India

PostPosted: Mon Aug 09, 2010 11:22 am    Post subject:
Reply with quote

Hi Frank,

It worked for me. Thank you very much.
Back to top
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Wed Dec 07, 2011 11:41 pm    Post subject:
Reply with quote

Hi Frank,

I was refering to this sort card for a similar requirement that I have and is using the below sort card.

Code:
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,25,CH) FIRST


I have to tweak this sort card in order to add the below condition.

Code:
When (107,3,CH,EQ,C'PMP')
SELECT FROM(IN) TO(OUT) ON(1,25,CH) FIRST


Could you please let me know if there's any way to combine both?

I am using FB LRECL=275 for both i/p and o/p.
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: Thu Dec 08, 2011 12:12 am    Post subject:
Reply with quote

Change your SELECT operator to:

Code:

SELECT FROM(IN) TO(OUT) ON(1,25,CH) FIRST USING(CTL1)


and add:

Code:

//CTL1CNTL DD *
   INCLUDE COND=(107,3,CH,EQ,C'PMP')


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
Back to top
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Thu Dec 08, 2011 12:20 am    Post subject:
Reply with quote

It worked great!! Thanks Frank.
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 Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


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