Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Syncsort: To convert character to numeric and SUM it

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
vinu78

Active User


Joined: 02 Oct 2008
Posts: 151
Location: India

PostPosted: Fri Apr 15, 2011 4:34 am    Post subject: Syncsort: To convert character to numeric and SUM it
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    Post subject: Reply to: Syncsort: To convert character to numeric and SUM
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Fri Apr 15, 2011 3:02 pm    Post subject: Reply to: Syncsort: To convert character to numeric and SUM
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

Senior Member


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

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

How many more posts on the same thing...

http://www.ibmmainframes.com/viewtopic.php?t=54153&highlight=
http://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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts the use of 'B3'x character in a panel Pedro TSO/ISPF 1 Thu Feb 16, 2017 3:09 am
No new posts Convert current to hex value gopurs DFSORT/ICETOOL 4 Wed Feb 15, 2017 5:40 am
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us