IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Syncsort: To convert character to numeric and SUM it


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vinu78

Active User


Joined: 02 Oct 2008
Posts: 179
Location: India

PostPosted: Fri Apr 15, 2011 4:34 am
Reply with quote

I have a dataset of FB 436 out of which the amount field starts from 422nd byte and is stored as character format (15bytes). I want to sum the amount based on Policy number (6 bytes char starting from 19th byte) and Effective date (10 bytes char starting from 39th byte).
I tried to make use of below mentioned SORT card but is abending because amount field is not numeric.

Input (putting the amount field alone from 422nd byte - 436th byte)
Code:

          83.33
          83.33
          -8.09
       26995.00
          14.44
         -13.12
         153.07
         -17.23
         200.98
Output (Need to have the whole file with summed amount from 422nd byte)

For example if the first 2 records have same policy number and effective date, we should get it as


Code:
         166.66
          -8.09
       26995.00
          14.44
         -13.12
         153.07
         -17.23
         200.98



Code:
  SORT FIELDS=(19,6,CH,A,39,10,CH,A)
  SUM FIELDS=(422,15,CH)           



Thanks
Vinu
Back to top
View user's profile Send private message
DARAPRADEEP

New User


Joined: 13 Apr 2005
Posts: 7

PostPosted: Fri Apr 15, 2011 2:57 pm
Reply with quote

check this.

Input :-

Code:
ABC -000010.10
ABC 000090.90
ABC 000067.90
QRS 000123.62
QRS -000239.76

Output:-

Code:
ABC 000148.70
QRS -000116.14


JCL:-
Code:
 //STEP01  EXEC PGM=SORT                                     
 //SYSPRINT DD SYSOUT=*                                       
 //SYSOUT   DD SYSOUT=*                                       
 //SORTIN   DD DSN=input file,DISP=SHR           
 //SORTOUT  DD DSN=output file,DISP=(NEW,CATLG,DELETE),
 //             LIKE=input file               
//SYSIN    DD *                                           
  INREC OVERLAY=(5:5,10,SFF,TO=ZD,LENGTH=10)               
  SORT FIELDS=(1,3,CH,A)                                   
  SUM FIELDS=(5,10,ZD)                                     
  OUTREC OVERLAY=(5:5,10,ZD,EDIT=(STTTTTT.TT),SIGNS=(,-)) 
/*
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Apr 15, 2011 3:02 pm
Reply with quote

it is understandable that some initial questions could be poorly formatted
when replying it would be better to be aware of the habits of the forums You participate and behave accordingly
USE THE CODE TAGS
Your post has been edited icon_evil.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Apr 15, 2011 3:33 pm
Reply with quote

How many more posts on the same thing...

www.ibmmainframes.com/viewtopic.php?t=54153&highlight=
www.ibmmainframes.com/viewtopic.php?t=50634&highlight=
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
Search our Forums:

Back to Top