MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ICETOOL - drop records and keep last duplicate key record

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
tcurrier
Intermediate


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Fri Jun 15, 2012 3:04 pm    Post subject: ICETOOL - drop records and keep last duplicate key record Reply with quote

We ran into a production problem with
this. Apparently the 'LAST USING(CTL1)' first retained only the last record (with the 'A'), then dropped the record because of the 'INCLUDE=(7,1,CH,NE,C'A')'.
So the end result was that NO records were written out.
Is there a way to recode this so that the last record will be dropped (because of the 'A'), but the second record kept? (the '11111 2')

Code:
//S01A1100 EXEC PGM=ICETOOL                         
//TOOLMSG  DD SYSOUT=*                               
//DFSMSG   DD SYSOUT=*                               
//IN       DD *                                     
11111      1                                         
11111      2                                         
11111 A    3                                         
/*                                                   
//OUT      DD SYSOUT=*                               
//TOOLIN   DD *                                     
  SELECT FROM(IN) TO(OUT) ON(1,5,CH) LAST USING(CTL1)
/*                                                   
//CTL1CNTL DD *                                     
  OUTFIL FNAMES=OUT,                                 
  INCLUDE=(7,1,CH,NE,C'A')                           
/* 
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Fri Jun 15, 2012 3:55 pm    Post subject: Reply with quote

tcurrier,

You can actually avoid the whole problem by moving the INCLUDE condition to the beginning , so that you read less number of records.

I would also check for a positive condition instead of a negative condition.

Use the following DFSORT ICETOOL JCL which will give you the desired results. I assumed that your data is already sorted on the key. If Not then just remove the statement OPTION=COPY

Code:

//STEP0100 EXEC PGM=ICETOOL                           
//TOOLMSG  DD SYSOUT=*                                 
//DFSMSG   DD SYSOUT=*                                 
//IN       DD *                                       
11111      1                                           
11111      2                                           
----+----1----+----2----+----3----+----4----+----5----+
11111 A    3                                           
//OUT      DD SYSOUT=*                                 
//TOOLIN   DD *                                       
  SELECT FROM(IN) TO(OUT) ON(1,5,CH) LAST USING(CTL1)
//CTL1CNTL DD *                                       
  OPTION COPY                                         
  OMIT COND=(7,1,CH,EQ,C'A')                           
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tcurrier
Intermediate


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Fri Jun 15, 2012 4:32 pm    Post subject: Reply with quote

perfect .... thanks very much Kolusu...

now we don't have to add an additional step to the job and change the existing one.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group