Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Where is output from PARM ABEXIT (SNA... packerm CA Products 3 Thu Sep 28, 2017 4:06 pm
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us