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
 

 

Want only selected records in output.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Want only selected records in output.
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    Post subject:
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    Post subject: Hi
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    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 Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am


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