Need help on SORT



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

Need help on SORT

Postby venkmangav » Tue Dec 10, 2013 1:30 pm

INPUT FILE:

----+----1----+----2----+----3----+----4----+----5----+----6----+
***************************** Top of Data ***********************
R11111111111110000003   ZZZZZZZZ   AAAAAP0000A0000000001ZZZZZZZZ
R11111111111110000004   ZZZZZZZZ   AAAAAP0000A0000000001ZZZZZZZZ
R11111111111110000005   ZZZZZZZZ   BBBBBP0000A0000000001ZZZZZZZZ
R11111111111110000005   ZZZZZZZZ   BBBBBP0000A0000000001ZZZZZZZZ
R11111111111110000005   ZZZZZZZZ   BBBBBP0000A0000000001ZZZZZZZZ
R11111111111110000005   ZZZZZZZZ   CCCCCP0000A0000000001ZZZZZZZZ
R11111111111110000005   ZZZZZZZZ   CCCCCP0000A0000000001ZZZZZZZZ
R22222222222230000001   ZZZZZZZZ   AAAAAP0000A0000000001ZZZZZZZZ
R22222222222230000002   ZZZZZZZZ   AAAAAP0000A0000000001ZZZZZZZZ

EXPECTED OUTPUT:

----+----1----+----2----+----3----+----4----+----5----+----6----+
***************************** Top of Data ***********************
R11111111111110000003   ZZZZZZZZ   AAAAAP0000A0000000002ZZZZZZZZ 
R11111111111110000005   ZZZZZZZZ   BBBBBP0000A0000000003ZZZZZZZZ
R11111111111110000005   ZZZZZZZZ   CCCCCP0000A0000000002ZZZZZZZZ
R22222222222230000001   ZZZZZZZZ   AAAAAP0000A0000000002ZZZZZZZZ




Hi, i have input file in the above format with positions below

2-14: emp code
36-40: dept no
47-55: emp sal

i am trying to do with the sort , but i am not getting required result. Below is the sort card i am using

//SYSIN DD *                     
 SORT FIELDS=(2,13,CH,A,13,5,CH,A)
 SUM FIELDS=(47,9,ZD)             
/*         


could you pls suggest how can i get the required result using sort.
venkmangav
 
Posts: 10
Joined: Wed Oct 30, 2013 3:31 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Need help on SORT

Postby NicC » Tue Dec 10, 2013 2:40 pm

I have "coded" your data up so that it now aligns. Please do it yourself next time. I got rid of your 'BOLDing' as it is not respected within code tags and you made no mention as to why some stuff was in bold and some was not.

What are you trying to achieve with your sort? A description please and what was wrong with the output you got?
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: Need help on SORT

Postby venkmangav » Tue Dec 10, 2013 2:52 pm

Hi Nic,

i need the sum of the 'emp sal' (47-55 columns) with department wise for an employee, but when i tried with this sort card,

//SYSIN DD *
SORT FIELDS=(2,13,CH,A,13,5,CH,A)
SUM FIELDS=(47,9,ZD)
/*

i am getting only two records with employee.
venkmangav
 
Posts: 10
Joined: Wed Oct 30, 2013 3:31 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Need help on SORT

Postby NicC » Tue Dec 10, 2013 4:14 pm

Please learn to use the code tags - as previously requested.

Why are you sorting on columns 2 - 14 then 13 - 17?
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: Need help on SORT

Postby venkmangav » Tue Dec 10, 2013 5:48 pm

Hi Nic,

Sorry for the mistake. I have changed my sort card as below, i got the required output with dept wise sal, thanks for your support.

//SYSIN DD *                     
 SORT FIELDS=(2,13,CH,A,36,5,CH,A)
 SUM FIELDS=(47,9,ZD)             
/*                               
venkmangav
 
Posts: 10
Joined: Wed Oct 30, 2013 3:31 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Need help on SORT

Postby NicC » Tue Dec 10, 2013 5:55 pm

Good to hear that it is doing the right thing now. Also, thanks for using the code tags! But...one more overall comment: the title of the topic "Need help on SORT" is totally useless! The fact that you are posting in the sort section of the forum denotes that you are, probably, needing help. The topic title should relate to the kind of problem you are having.
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


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post