SORT Card to sum the values of same-keys records



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Re: SORT Card to sum the values of same-keys records

Postby vvkswm » Tue Jul 30, 2013 2:47 pm

Hi BillyBoyo,

Please can you tell me the difference between EQUALS and NOEQUALS?

Still I am confused about it.

Thanks,Vivek.
vvkswm
 
Posts: 5
Joined: Fri Jul 26, 2013 3:15 pm
Has thanked: 7 times
Been thanked: 0 time

Re: SORT Card to sum the values of same-keys records

Postby NicC » Tue Jul 30, 2013 3:11 pm

As mentioned before there is NO "EQUALS" (or "NOEQUALS") in JCL. They are part of the SORT control records/cards. Please use the correct terminology. Also, you were asked to use the code tags when posting code/data. This is important to help present your data correctly as the correct spacing and alignment is maintained.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: SORT Card to sum the values of same-keys records

Postby BillyBoyo » Tue Jul 30, 2013 3:59 pm

Where keys are duplicate (keys being the fields on a SORT statement) EQUALS will preserve the input order through to output. NOEQUALS will output records with equal keys as is most convenient at the time (and which is unpredictable).
A1
A2
A3
B9
C8


If your SORT on 1,1,CH,A, with EQUALS you can guarantee that the A records will always be in the order 1,2,3. With NOEQUALS there is no guarantee. It might happen, it might not.

If you SUM, EQUALS is important if you want to base the final output on the first input record, from the input file, of that key.

It is all documented. Read the documentation, and ask if you are not clear about what is written.

These users thanked the author BillyBoyo for the post:
vvkswm (Wed Jul 31, 2013 4:28 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: SORT Card to sum the values of same-keys records

Postby skolusu » Tue Jul 30, 2013 10:04 pm

vvkswm wrote:Hi,I tried the Below JCL with NOEQUALS.Then also the output is same as EQUALS.
Please can you explain me the use of EQUALS in jcl while sorting records.


wow really? Did you even read my prior response?

skolusu wrote:If you really want to see the difference between EQUALS and NOEQUALS you need to play with input that has more duplicates.


I have no idea why people are so persistent on trying to prove EQUALS and NOEQUALS gets the same results.

Run this JCL and pay attention to the 6th byte, which is in the ascending order. I am sorting on the first 3 bytes which is basically the word "key" for every record.

//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                       
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
KEY0 A                                                               
KEY3 B                                                               
KEY4 C                                                               
KEY1 D                                                               
KEY2 E                                                               
KEY3 F                                                               
KEY4 G                                                               
KEY5 H                                                               
KEY6 I                                                               
KEY7 J                                                               
KEY0 K                                                               
KEY0 L                                                               
KEY0 M                                                               
KEY0 N                                                               
KEY0 O                                                               
KEY0 P                                                               
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  INREC OVERLAY=(250:C'VVKSWM STRONGLY BELIEVES EQUALS HAS NO VALUE')
  SORT FIELDS=(1,3,CH,A),NOEQUALS                                     
//*


Copy the output and now re-run the job with EQUALS and then compare the output.

P.S: If you strongly believe that EQUALS and NOEQUALS makes no difference to the order of the Output , you can stop coding it and get burned. It is up to you. Good Luck
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

These users thanked the author skolusu for the post:
vvkswm (Wed Jul 31, 2013 4:29 pm)
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: SORT Card to sum the values of same-keys records

Postby vvkswm » Wed Jul 31, 2013 4:42 pm

Hi skolusu,

I tried the above JCL Using both EQUALS & NOEQUALS, But output is same in both the case.

Please can you tell me why it is showing like this.

Output of above JCL:
EQUALS     NOEQUALS
KEY0 A      KEY0 A
KEY3 B      KEY3 B
KEY4 C      KEY4 C
KEY1 D      KEY1 D
KEY2 E      KEY2 E
KEY3 F      KEY3 F
KEY4 G      KEY4 G
KEY5 H      KEY5 H
KEY6 I      KEY6 I
KEY7 J      KEY7 J
KEY0 K      KEY0 K
KEY0 L      KEY0 L
KEY0 M      KEY0 M
KEY0 N      KEY0 N
KEY0 O      KEY0 O
KEY0 P      KEY0 P

Thanks,
VIvek.
vvkswm
 
Posts: 5
Joined: Fri Jul 26, 2013 3:15 pm
Has thanked: 7 times
Been thanked: 0 time

Re: SORT Card to sum the values of same-keys records

Postby NicC » Wed Jul 31, 2013 4:50 pm

Once again you have failed to use the code tags so your table was all to pieces. I have coded it for you but this is the last time.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: SORT Card to sum the values of same-keys records

Postby BillyBoyo » Wed Jul 31, 2013 5:32 pm

With EQUALS the order for duplicate keys is predictable.

With NOEQUALS the order for duplicate keys is whatever DFSORT feels like at the time.

Show the sysout for both steps, inside the code tags please.

If you really believe there is no difference, use NOEQUALS where the order of duplicate keys is important for your work, and wait for the complaints.

If all input keys are unique, you get sorted output which is no affected by EQUALS.

If you have non-unique keys, all the output will be in key order - in addition, for the non-unique keys (any unique keys in the same dataset are unaffected), with EQUALS the output for non-unique keys will be in "input order", with NOEQUALS the output will be whatever is most convenient at the time for DFSORT.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: SORT Card to sum the values of same-keys records

Postby skolusu » Wed Jul 31, 2013 10:42 pm

vvkswm wrote:Hi skolusu,

I tried the above JCL Using both EQUALS & NOEQUALS, But output is same in both the case.

Please can you tell me why it is showing like this.


vvkswm,

You sure that you are indeed SORTING and not COPYing the data? I need to see the complete Sysout from both the Jobs.

I have no idea as to why you want to increase the font to stress the parms. We get it and you don't have to shout it aloud.

Either way unless you are showing us the complete sysout, I am not going to spend any more time on this issue.
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Previous

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post