View previous topic :: View next topic
|
Author |
Message |
Abhijat Sinha
New User
Joined: 22 Jun 2007 Posts: 11 Location: India
|
|
|
|
Hi,
I have a following set of input data
Code: |
col1 col2 col3 col4
======================
001 aaa 1234 xxx
002 aaa 5678 xxx
003 aaa 1234 xxx
004 aaa 5678 xxx
|
When i try to use the ICEMAN to sort these records on the basis of following sort card -
Code: |
SORT FIELDS=(col2,03,CH,A,col4,03,CH,A,col3,04,CH,A)
SUM FIELDS=NONE
|
we are getting the follwing out put-
Code: |
col1 col2 col3 col4
======================
001 aaa 1234 xxx
004 aaa 5678 xxx |
Now I was expecting 001 and 002 in the col1 instead am getting 001 and 004. Is there any specific reason for this specific type of data? Can anyone please explain how the data was processed to get me the above result?
Thank you, |
|
Back to top |
|
|
nuthan
Active User
Joined: 26 Sep 2005 Posts: 146 Location: Bangalore
|
|
|
|
Try with SORT FIELDS=(col2,03,CH,A,col4,03,CH,A,col3,04,CH,A), EQUALS
SUM FIELDS=NONE |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
This is what i got when i tried with your sort card
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
001 AAA 1234 XXX
002 AAA 5678 XXX
003 AAA 1234 XXX
004 AAA 5678 XXX
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(8,3,CH,A,20,3,CH,A,14,4,CH,A)
SUM FIELDS=NONE
/*
|
output:
Code: |
001 AAA 1234 XXX
002 AAA 5678 XXX
|
|
|
Back to top |
|
|
Abhijat Sinha
New User
Joined: 22 Jun 2007 Posts: 11 Location: India
|
|
|
|
Hi Nuthan,
The sort card with EQUALS worked. But is there any explanation for this? Is there any link for this EQUALS that i can go through?
Thanks.
Aaru,
I tried to run your JCL itself but i got 001 and 004 itself instead of your suggested 001 and 002. Can you please re-check?
Thank you |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
The sort card with EQUALS worked. But is there any explanation for this? |
EQUALS tells the process to preserve the original order of the data within the "sort keys". If EQUALS is not specified, the order of the data will be unpredictable beyond the specified keys. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Abhijat,
Quote: |
Aaru,
I tried to run your JCL itself but i got 001 and 004 itself instead of your suggested 001 and 002. Can you please re-check? |
I ran the same JCL again and the output is still the same (001 and 002). |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Aaru,
Your site default is probably EQUALS. Abhijit's site default is NOEQUALS. DFSORT is shipped with NOEQUALS as the default, but the site can change that to EQUALS.
If you're using DFSORT (and I'm not sure you are), you can see the value for EQUALS in message ICE128I ... it will have EQUALS=N or EQUALS=Y.
You can try using:
to turn off EQUALS and see what you get. However, you still might get 001 and 002 since with NOEQUALS, either record can be kept.
The only way to ensure that the first record is kept is to use EQUALS. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Frank,
You are correct. Had a look at the sysout and found that the option EQUALS is in effect.
Code: |
WER072I EQUALS IN EFFECT |
Thanks a ton. |
|
Back to top |
|
|
venktv
New User
Joined: 29 Mar 2006 Posts: 59 Location: Montreal
|
|
|
|
With EQUALS, the SORT program will give the first record of the identical records(duplicate records) found when it sorts.
WIth regs
Venkat |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Aaru,
As I guessed, you're using Syncsort (WER messages), not DFSORT.
Since this is the DFSORT Forum and you can't test with DFSORT, your results will not always be relevant. You might want to think about that, especially in regard to making statements about what works for you since DFSORT and Syncsort do have differences. |
|
Back to top |
|
|
|