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 

Is sorting and filtering of records with SYNCSORT possible?

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


Joined: 26 Feb 2009
Posts: 4
Topics: 1

PostPosted: Fri Feb 27, 2009 8:32 am    Post subject: Is sorting and filtering of records with SYNCSORT possible? Reply with quote

Hello, i'm looking for a possibility to reduce this 2 SORTs to 1 SORT?

I get data from 3 different files which have, as you see, 3 different CH-characters in POS 1; 'D', 'E' and 'I'.

Here is the data of my 3 input files:
Code:

//SORTIN    DD *
I Test 00       
I Test 10       
I Test 20       
//          DD *
D Test 00       
//          DD *
E Test 00       
E Test 10       

At the moment i do the job with 2 sorts:
1.
Code:

   SORT FIELDS=(3,5,CH,A,1,1,CH,A)   
   INCLUDE COND(1,1,SS,EQ,L(C'D',C'E',C'I'))
   END

Result:
Code:

D Test 00       
E Test 00       
I Test 00       
E Test 10       
I Test 10       
I Test 20       

2.
Code:
   
  SORT FIELDS=(3,5,CH,A)   
   SUM  FIELDS=NONE         
   END

result:
Code:

D Raab 00
E Raab 10
I Raab 20


Is it possible do get this result with one SORT-statement?

I tried to find a solution within our SYNCSORT-manual, but did not succeed.

Thanks,
Retep.
Back to top
View user's profile Send private message
retep baar
Beginner


Joined: 26 Feb 2009
Posts: 4
Topics: 1

PostPosted: Fri Feb 27, 2009 9:23 am    Post subject: Reply with quote

Sorry, but i made a mistake!

2.
Code:
SORT FIELDS=(3,5,CH,A)
SUM FIELDS=NONE
END

result:
Code:

D Test 00      <-
E Test 10      <-
I Test 20      <-

bonk
Back to top
View user's profile Send private message
amargulies
Beginner


Joined: 10 Jan 2007
Posts: 123
Topics: 0

PostPosted: Fri Feb 27, 2009 11:25 am    Post subject: Reply with quote

Hello retep baar and welcome to the Forum.

Just to clarify, you want 2 separate output files, correct?

In the first step, why are you coding an include statement if you want all the records? Will your actual input data contain other values in that field (other than D, E or I)? If not, then you can remove the INCLUDE statement. Also, the output you posted for the first step is incorrect. The output that would be produced from these control statements is as follows:
Code:
D TEST 00
E TEST 00
E TEST 10
I TEST 00
I TEST 10
I TEST 20

If you want the output produced as your posted result, then you would need to code:
Code:

SORT FIELDS=(3,5,CH,A,8,2,CH,A) 

In regards to your second step, your output is also incorrect. For what you coded, you would only get 1 record in the output. Please be more specific as to the rules. Are you looking to produce only the last record for each sort key, or the maximum value for field (8,2) for each sort key, which happens to be the last record in your sample input records? Or something else?
_________________
Alissa Margulies
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
retep baar
Beginner


Joined: 26 Feb 2009
Posts: 4
Topics: 1

PostPosted: Tue Mar 03, 2009 7:33 am    Post subject: Reply with quote

Hello & sorry for the very unclear question. Embarassed

I will try to explain in a shorter way:

I have input from 3 files. Each can contain in Pos 1 any possible alpha-char, but i to want look only at 'D', 'E' and 'I'.

The output goes in 1 file.

The input:
//SORTIN DD *
I TEST 00
I TEST 10
I TEST 20
// DD *
D TEST 00
// DD *
E TEST 00
E TEST 10

The result should look like:
D TEST 00
E TEST 10
I TEST 20

Is it possible do get this result with one SORT-statement?

Thank you & i hope this makes the case more clear.
Back to top
View user's profile Send private message
Brian Wood
Beginner


Joined: 14 Jan 2009
Posts: 37
Topics: 0
Location: USA

PostPosted: Tue Mar 03, 2009 11:23 am    Post subject: Reply with quote

retep baar: Here is a single sort coding solution that retains the MAX value from each of the D, E and I records:

Code:

//SYSIN  DD *
  SORT FIELDS=(3,5,CH,A,1,1,CH,A)
  INCLUDE COND=(1,1,CH,EQ,L(C'D',C'E',C'I'))
  DUPKEYS MAX=(8,2,ZD)




Hope this helps! Please let me know if you require additional assistance with this.
_________________
Brian Wood
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
retep baar
Beginner


Joined: 26 Feb 2009
Posts: 4
Topics: 1

PostPosted: Wed Mar 04, 2009 2:37 am    Post subject: Reply with quote

Thats exactly i was looking for!

Thank you very much for your help.

Retep Baar <- Mr. Green
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