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

Help on Sorting


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

New User


Joined: 13 Feb 2013
Posts: 2
Location: INDIA

PostPosted: Wed Feb 13, 2013 4:31 pm
Reply with quote

Hi,

Need Help on below.

I have input file with data below. f1,f2,f3,q1,q2 are the field names that mentioned here for understanding purpose, below them actual data that each field contains.
q1 contains postive value or zeros
q2 contains negative value or zeros

Have to sort the input file based on f1,f2,f3 and the output file we should get a unique record which has a non zero value.
Could you please let us know how to do this.
I have given the input and output file conents for better understanding.

Input file:

Code:
               f1   f2  f3   q1     q2 
              abc def ghi  0      0
              abc def ghi  20     0
              abc def ghi  20     0
              abc def ghi  20     0
              pqr stu vwx  0      0
              pqr stu vwx  0     -90
              pqr stu vwx  0     -90




Output file should contains

Code:
            abc def ghi  20     0
            pqr stu vwx  0     -90
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Feb 13, 2013 4:43 pm
Reply with quote

How about OMIT where q1 and q2 equal zero.

You could then do a simple SUM with FIELDS=NONE (with you data shown).
Back to top
View user's profile Send private message
kenar.t

New User


Joined: 13 Feb 2013
Posts: 2
Location: INDIA

PostPosted: Wed Feb 13, 2013 5:14 pm
Reply with quote

Have forgot to include one scenario, i have one more record in the the input file as below, this should also appear in my output file

Code:
ijk lmn opq 0 0


My output file looks like this.

Code:
abc cde fgh 20 0
ijk  lmn opq 0 0
pqr stu vwx 0 -90
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Feb 13, 2013 5:22 pm
Reply with quote

Omit all the records with two 0 except for this ijk lmn opq 0 0

Which is OMIT q1 and q2 equal 0 and f1 not equal to ijk , f2 is not equal to lmn and f3 not equal to opq

and do SUM FIELDS=NONE
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Feb 13, 2013 5:42 pm
Reply with quote

Are all your non-zero values always guaranteed to be the same?

Have a look at ICETOOL's SELECT operator. Sort on your three key fields AND the s new key field which you make by adding together the two numeric values, and sort on that descending.

Use FIRST on ICETOOL.
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
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
No new posts Sorting a record spanned over multipl... DFSORT/ICETOOL 13
No new posts Creating additional seqnum/Literal wh... DFSORT/ICETOOL 4
No new posts ICETOOL Sorting and Discarding DUPS SYNCSORT 11
No new posts Sorting on text - but in non-alphabet... SYNCSORT 5
Search our Forums:

Back to Top