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 

Sum on edited display field - Using sort

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Wed Oct 27, 2004 2:59 pm    Post subject: Sum on edited display field - Using sort Reply with quote

Hi
Can I use SYNCSORT for the following requirement?
Code:

Input File
---------
LRECL = 80, KEY FIELD is at POSITION 1 and LENGTH 2

----+----1----+----2
11 ABC 2,000.04     
22 CDE    10.05     
11 ABC    20.00     
22 CDE 3,000.00     

Code:

OutPut
-------
----+----1----+----2
11 ABC 2,000.04     
11 ABC    20.00     
11 ABC 2,020.04 
22 CDE    10.05     
22 CDE 3,000.00     
22 CDE 3,010.05 



_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Oct 27, 2004 3:32 pm    Post subject: Reply with quote

Somuk,

Try this Job. A brief explanation of the job. since the amount is numeric edited we need to convert it into zoned decimal to perform the sum.

So using INREC FIELDS we copy the 80 bytes as is and we put the amount field in 81st byte removing the comma and decimal point.

Using OUTREC FIELDS we convert the amount at 81st byte which is of floating sign format to zoned decimal for a length of 6.

Now using SECTIONS on OUTFIL we achieve the desired results.


Code:

//STEP0100 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD *                               
11 ABC 2,000.04                               
22 CDE    10.05                               
11 ABC    20.00                               
22 CDE 3,000.00                               
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                               
  INREC FIELDS=(01,80,                         
                08,1,                           
                10,3,                           
                14,2)                           
  SORT FIELDS=(1,2,CH,A)                       
  OUTREC FIELDS=(01,80,                         
                 81,6,FS,ZD,LENGTH=6)           
  OUTFIL OUTREC=(1,80),REMOVECC,               
    SECTIONS=(1,2,                             
      TRAILER3=(1,7,TOT=(81,6,ZD,M2),80:X))     
/*


The output from this job is :

Code:

11 ABC 2,000.04                 
11 ABC    20.00                 
11 ABC             2,020.04     
22 CDE    10.05                 
22 CDE 3,000.00                 
22 CDE             3,010.05     


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
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Wed Oct 27, 2004 5:35 pm    Post subject: Reply with quote

Thank you very much Kolusu.
If my input dateset is FBA and the output needs to be FB ,do I need to change anything in this job?
_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Oct 28, 2004 4:41 am    Post subject: Reply with quote

somuk,

Just Code RECFM=FB on the SORTOUT dataset.

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
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities 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