IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Want only selected records in output.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kaushik8205

New User


Joined: 10 Nov 2006
Posts: 49
Location: Canada

PostPosted: Wed Mar 12, 2008 5:51 pm
Reply with quote

Hi,
I have an input file:
Input:

Code:

A        B C    D
----------------------
C1111 A P11 080711
C1111 A P11 080711
C1111 A P11 070711
C1111 A P11 070711
C1111 A P22 080511
C1111 A P22 080511
C1111 B P11 080711
C1111 B P11 080711
C1111 B P11 060711
C1111 B P11 060711
C1111 B P22 060711
C1111 B P22 060711


Output should like:
Code:

A        B C    D
----------------------
C1111 A P11 080711
C1111 A P11 080711
C1111 A P22 080511
C1111 A P22 080511
C1111 B P11 080711
C1111 B P11 080711
C1111 B P22 060711
C1111 B P22 060711


The requirement is for all records having Col A, B and C matching; check Col D. , and out records having greatest value of Col D.

Now if Col A and Col B are matching and Col C is different no need to check Col D.

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

Senior Member


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

PostPosted: Wed Mar 12, 2008 9:50 pm
Reply with quote

Code:

//STEP0100 EXEC PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//IN       DD * 
----+----1----+----2----+----3                                                   
C1111 A P11 080711                                                 
C1111 A P11 080711                                                 
C1111 A P11 070711                                                 
C1111 A P11 070711                                                 
C1111 A P22 080511                                                 
C1111 A P22 080511                                                 
C1111 B P11 080711                                                 
C1111 B P11 080711                                                 
C1111 B P11 060711                                                 
C1111 B P11 060711                                                 
C1111 B P22 060711                                                 
C1111 B P22 060711                                                 
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)           
//OUT      DD SYSOUT=*                                             
//TOOLIN   DD *                                                     
  SORT   FROM(IN) USING(CTL1)                                       
  SPLICE FROM(T1) TO(OUT) ON(1,12,CH) WITH(1,19) WITHALL USING(CTL2)
//CTL1CNTL DD *                                                     
  SORT FIELDS=(01,11,CH,A)                                         
  OUTREC OVERLAY=(20:6X)                                           
  OUTFIL FNAMES=T1,REMOVECC,                                       
  SECTIONS=(01,11,                                                 
  TRAILER3=(01,12,20:MAX=(13,6,ZD,M11,LENGTH=6)))                   
//CTL2CNTL DD *                                                     
  SORT FIELDS=(01,12,CH,A,                                         
               20,06,CH,D)                                         
  OUTFIL FNAMES=OUT,BUILD=(01,19),                                 
  INCLUDE=(13,06,CH,EQ,20,06,CH)                                   
/*


Hope this helps...
Back to top
View user's profile Send private message
kaushik8205

New User


Joined: 10 Nov 2006
Posts: 49
Location: Canada

PostPosted: Thu Mar 13, 2008 7:04 pm
Reply with quote

Thanks for the response.
There is a bit of modification in the requirement.
Input file:
X C1111 A P11 080711 Y
Y C1111 A P11 080711 X
X C1111 A P11 070711 X
Y C1111 A P11 070711 Y
Z C1111 A P22 080511 Z
S C1111 A P22 080511 S
AZ C1111 B P11 080711 AZ
ZA C1111 B P11 080711 ZA
AZ C1111 B P11 060711 AZ
ZA C1111 B P11 060711 ZA
A C1111 B P22 060711 A
B C1111 B P22 060711 B

Output file should like:
X C1111 A P11 080711 Y
Y C1111 A P11 080711 X
Z C1111 A P22 080511 Z
S C1111 A P22 080511 S
AZ C1111 B P11 080711 AZ
ZA C1111 B P11 080711 ZA
A C1111 B P22 060711 A
B C1111 B P22 060711 B

i.e if Col A, B and C matching; check Col D. , and out records having greatest value of Col D.
So all other values of the record being selected should be from the records having greatest value of Col D.

With your solution I am getting output as:
Y C1111 A P11 080711 Y
Y C1111 A P11 080711 Y
S C1111 A P22 080511 S
S C1111 A P22 080511 S
ZA C1111 B P11 080711 ZA
ZA C1111 B P11 080711 ZA
B C1111 B P22 060711 B
B C1111 B P22 060711 B

Please let me know if you have a solution to above requirement.
Thanks
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 0
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
Search our Forums:

Back to Top