FORTRAN 90 Tracking cumulative emissions read in from txt file

I am attempting to modify an original set of code which uses a spline interpolator to plot a curve representing cumulative emissions (and its derivative annual emissions). The goal is to read in the historical emissions (from histem.txt) and then track the cumulative emissions (read integral of annual emissions) which I will tack onto the cumulative emissions spit out by the spline interpolator in cumemC.txt.

program sat_profile

! This program can be used to create a smooth temperature profile starting from! a specified slope at the year 2005 and stabilizing (with zero slope) at 2300.! The starting slope can be calculated from the last 10 years of the simulation! providing the initial condition at 2005. A starting temperature and final! temperature also need to be specified. The final target temperature should be! the modelled preindustrial temperature plus the temperature target (1.5, 2, 3,! and 4 degrees C). An arbitrary mid point year and temperature (between 2005! and 2300) is also specified. This may need some adjustment in order to! generate a smoothly changing profile without overshoot. The output is a text! file with annual values from 2005 to 2500. This can be adjusted to provide! interpolated values at other time intervals by changing the loop that! generates tval and calculates yval.

is storing these each as a 1-column vector. Since I need to be tracking a running sum of emissions, what I really need to be doing is storing these as 257 scalar values instead (or so I believe?). However, I am uncertain of how to do this. I have attempted using a do loop in earlier versions of the code, but was unsuccessful.