JCL sum exceeding field length
Posted: Tue Mar 01, 2016 12:13 pm
I have data in a file with the format of "111111122222". The first 7 digits I sort and the I need to add the last 5 digits together for like values. The sum function works properly for the first 4 values but once the sum of the 2 fields exceeds 5 digits the, not fields are not added. I think I need to increase the field length using INREC but I am unsure of how to do this or if this would be the proper way to make it work. Any help would be greatly appreciated.
Here is my code.
Here is my data file
Here is the output
Here is my code.
//SYSIN DD *
****************=(7,1,CH,A)
SORT FIELDS=(1,7,CH,A)
SUM FIELDS=(8,5,ZD)
****************=(7,1,CH,A)
SORT FIELDS=(1,7,CH,A)
SUM FIELDS=(8,5,ZD)
Here is my data file
111111122222
122222233333
133333344444
144444455555
155555566666
166666677777
177777788888
188888899999
111111110000
122222220000
133333330000
144444440000
155555550000
166666660000
177777770000
122222233333
133333344444
144444455555
155555566666
166666677777
177777788888
188888899999
111111110000
122222220000
133333330000
144444440000
155555550000
166666660000
177777770000
Here is the output
111111132222
122222253333
133333374444
144444495555
155555550000
155555566666
166666660000
166666677777
177777770000
177777788888
188888899999
122222253333
133333374444
144444495555
155555550000
155555566666
166666660000
166666677777
177777770000
177777788888
188888899999