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 

SORT SUM FIELDS Help required

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
manojvoona
Beginner


Joined: 05 Jan 2006
Posts: 43
Topics: 14

PostPosted: Thu Apr 06, 2006 3:51 am    Post subject: SORT SUM FIELDS Help required Reply with quote

Hi,

I need some help in DF sort sum feilds.
Code:

Feld-1 Feld-2       Feld-3
AAAA  BBBB     +0000000000100000
AAAA  BBBB     +0000000000100000
BBBB  CCCC     +0000000000100000
BBBB  CCCC     +0000000000100000

I am sorting on field 1 and 2 and the sum feild is on 3rd feild
Feild-3 is of 16 digits prededing with A + or - sign, so total length is 17 bytes.
So I could not use ZD ,FS,CFS formats as it is more that 17 bytes.
I even tried with FL but could not SUM it.

Can you please help me out in writing a sort step for the above.

Thanks in advance
Manoj Voona
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Thu Apr 06, 2006 4:24 am    Post subject: Reply with quote

manojvoona,

Please search before posting. check this link which discusses about the same question

http://mvsforums.com/helpboards/viewtopic.php?t=5686&highlight=numeric

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
manojvoona
Beginner


Joined: 05 Jan 2006
Posts: 43
Topics: 14

PostPosted: Thu Apr 06, 2006 4:44 am    Post subject: Reply with quote

Hi Kolusu,

Thanks a lot for your reply.
I just had a look at the link.
it talks about the "-" at the end but here we have the sign in front.
So ZD format does not work for the our requirement.
it is giving S0C7 error Sad

Our shop does not have a DFsort.
So we need to work with normal sort to arrive to the above results.

Please help us in writing the sort step.

thanks a lot. sorry to bother u again and again.

Manoj Voona
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Thu Apr 06, 2006 4:48 am    Post subject: Reply with quote

manojvoona,
Quote:

I just had a look at the link.
it talks about the "-" at the end but here we have the sign in front.
So ZD format does not work for the our requirement.



Read the entire link and see where I posted a solution using change command. I guess you can atleast change the solution to look for the sign at the beginning instead at the end.

Quote:

Our shop does not have a DFsort.
So we need to work with normal sort to arrive to the above results


There is nothing like normal sort. Your shop will have DFSORT or SYNCSORT or CA-SORT or some other sort product. Most shops have either DFSORT or SYNCSORT.


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
manojvoona
Beginner


Joined: 05 Jan 2006
Posts: 43
Topics: 14

PostPosted: Thu Apr 06, 2006 5:01 am    Post subject: Reply with quote

Hi Kolusu,

Thanks a lot.
It gives S0C7 error when we change the format.
that is : if we convert the preceding "-" sign according to your sort step. Sad


I could not stop asking u this questions.
where are you from and where are you located now?

Thanks
Manoj Voona
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Thu Apr 06, 2006 5:04 am    Post subject: Reply with quote

Quote:

It gives S0C7 error when we change the format.
that is : if we convert the preceding "-" sign according to your sort step.



manojvoona,

*Sigh*

1.Post your input file layout and also recfm of the dataset.
2. Specify the key fields and positions of the fields to be summed

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
manojvoona
Beginner


Joined: 05 Jan 2006
Posts: 43
Topics: 14

PostPosted: Thu Apr 06, 2006 5:44 am    Post subject: Reply with quote

Hi kolusu,

following is the feild that is to be summed

date in the file
+0000000000100000
+0000000000100000

After INREC ( using your change step)
{000000000100000
{000000000100000

After Sum feild
000000002000000

finally I could not change rechange 0 to +0 as the { is missing Sad
Apart of this, if i need to sum 3 to 4 feilds the sort step becomes too combesome as we need to repeat change for each feild.

Is there some other simpler way to do that Sad

sort step I used
Code:

SORT FIELDS=(15,9,CH,A,                       
             3,8,CH,A)                       
SUM FIELDS=(28,16,ZD)                         
INREC FIELDS=(1,27,                           
                 28,02,CHANGE=(1,C'-0',C'}', 
                                 C'-1',C'J', 
                                 C'-2',C'K', 
                                  C'-3',C'L',
                                  C'-4',C'M',
                                  C'-5',C'N',
                                  C'-6',C'O',
                                  C'-7',C'P',
                                  C'-8',C'Q',         
                                  C'-9',C'R',         
                                  C'+0',C'{',         
                                  C'+1',C'A',         
                                  C'+2',C'B',         
                                  C'+3',C'C',         
                                  C'+4',C'D',         
                                  C'+5',C'E',         
                                  C'+6',C'F',         
                                  C'+7',C'G',         
                                  C'+8',C'H',         
                                    C'+9',C'I'),30,15,45,244)



Thanks
Manoj voona
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Thu Apr 06, 2006 7:08 am    Post subject: Reply with quote

Quote:

finally I could not change rechange 0 to +0 as the { is missing
Apart of this, if i need to sum 3 to 4 feilds the sort step becomes too combesome as we need to repeat change for each feild.

Is there some other simpler way to do that


manojvoona,

The best approach to learn something is follow directions. Read my prior post carefully and answer the questions.

I asked specific questions and once you answer them I can suggest a solution. However you seem to ignore them. By doing so you are wasting my time as well as your time. Remember that I also work for someone else for my livelyhood.

So go back and answer my questions.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
manojvoona
Beginner


Joined: 05 Jan 2006
Posts: 43
Topics: 14

PostPosted: Thu Apr 06, 2006 9:59 am    Post subject: Reply with quote

Quote:

1.Post your input file layout and also recfm of the dataset.
2. Specify the key fields and positions of the fields to be summed


Really sorry ,I dint really mean that way.

Please find the anwers for your questions
1. Account number - 8 bytes ZD this is key
2. Amount 17bytes - starts from 9 byted

AMOUNT IS TO BE SUMMED FOR ALL THE SAME ACCOUNT NUMBER

data : 12345678+0000000000100000
12345678+0000000000100000
12345678-0000000000050000
12345679+0000000000100000

OUTPUT
12345678+0000000000150000
12345679+0000000000100000

Thanks Kolusu

Manoj Voona
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Apr 06, 2006 10:47 am    Post subject: Reply with quote

Quote:
So ZD format does not work for the our requirement.


For the record, DFSORT's FS and SFF formats would work for reformatting values like:

+0000000000100000

The maximum length for FS is 32 bytes (with up to 31 digits) and the maximum length for SFF is 44 bytes (with up to 31 digits).
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
manojvoona
Beginner


Joined: 05 Jan 2006
Posts: 43
Topics: 14

PostPosted: Thu Apr 06, 2006 10:58 am    Post subject: Reply with quote

Hi Frank,

Thanks Frank
following is the error I am getting when I submitted it

SYSIN :
SORT FIELDS=(15,9,CH,A,
3,8,CH,A)
SUM FIELDS=(28,17,SFF)
*
WER268A SUM STATEMENT : SYNTAX ERROR


17 byte date is +0000000000000123

can you please help me

Thanks
Manoj Voona
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Thu Apr 06, 2006 11:17 am    Post subject: Reply with quote

manojvoona,

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                           
12345678+0000000000100000                                 
12345678-0000000000050000                                 
12345679+0000000000100000                                 
//SORTOUT  DD DSN=&T1,DISP=(,CATLG),SPACE=(CYL,(1,1),RLSE)
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                       
  INREC FIELDS=(01,08,       $ ACT-NO                     
                10,16,       $ AMOUNT                     
                09,01)       $ SIGN                       
  OUTREC FIELDS=(01,23,                                   
                 24,02,CHANGE=(1,C'0-',C'}',             
                                 C'1-',C'J',             
                                 C'2-',C'K',             
                                 C'3-',C'L',             
                                 C'4-',C'M',             
                                 C'5-',C'N',             
                                 C'6-',C'O',             
                                 C'7-',C'P',             
                                 C'8-',C'Q',             
                                 C'9-',C'R',             
                                 C'0+',C'{',             
                                 C'1+',C'A',             
                                 C'2+',C'B',             
                                 C'3+',C'C',             
                                 C'4+',C'D',             
                                 C'5+',C'E',             
                                 C'6+',C'F',             
                                 C'7+',C'G',             
                                 C'8+',C'H',             
                                 C'9+',C'I'))             
/*                                                       
//STEP0200 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DSN=&T1,DISP=OLD                             
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                             
  SORT FIELDS=(01,08,CH,A)   $ ACT-NO                       
  SUM FIELDS=(09,16,ZD)      $ AMOUNT                       
  OUTREC FIELDS=(1,23,                                     
                 24,1,ZD,M1,LENGTH=2)                       
                                                           
  OUTFIL OUTREC=(1,8,
                 9:25,1,CHANGE=(1,C' ',C'+'),NOMATCH=(25,1),
                 9,16)                                     
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Apr 06, 2006 1:01 pm    Post subject: Reply with quote

Manoj,

I was just pointing out that DFSORT could handle these large numbers with FS and UFF, in response to your statement
Quote:
So I could not use ZD ,FS,CFS formats as it is more that 17 bytes.


Although you said in your first post that you were using DFSORT, you corrected yourself in your second post to say that you were using Syncsort. DFSORT can handle the large SFF numbers. Syncsort doesn't support SFF or large numbers - that's what the WER (Syncsort) messages are telling you.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
manojvoona
Beginner


Joined: 05 Jan 2006
Posts: 43
Topics: 14

PostPosted: Fri Apr 07, 2006 12:28 am    Post subject: Reply with quote

Thanks Frank and Kolusu.

I could use Kolusu's Step and its working.
Thanks a lot

Manoj Voona
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) 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