View previous topic :: View next topic
|
Author |
Message |
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
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 |
|
|
DARAPRADEEP
New User
Joined: 13 Apr 2005 Posts: 7
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
Back to top |
|
|
|