Page 1 of 1

Need help on SORT

PostPosted: Tue Dec 10, 2013 1:30 pm
by venkmangav
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.

Re: Need help on SORT

PostPosted: Tue Dec 10, 2013 2:40 pm
by NicC
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?

Re: Need help on SORT

PostPosted: Tue Dec 10, 2013 2:52 pm
by venkmangav
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.

Re: Need help on SORT

PostPosted: Tue Dec 10, 2013 4:14 pm
by NicC
Please learn to use the code tags - as previously requested.

Why are you sorting on columns 2 - 14 then 13 - 17?

Re: Need help on SORT

PostPosted: Tue Dec 10, 2013 5:48 pm
by venkmangav
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)             
/*                               

Re: Need help on SORT

PostPosted: Tue Dec 10, 2013 5:55 pm
by NicC
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.