The data statement is an non-executable statement.
In some programs it is desirable to "pre-load" certain values into variables. The data statement provides a way to do this for all variable types. Unlike the PARAMETER statement, any variable declared in a data statement can have its value changed later in the program.
data i,j/#,#.......,#/
From this you can see the only things that are required with the data statement are some variables ( they can be arrays or scalars in any data type), and a string of values to be assigned that are enclosed be to forward slashes.
To preload values for two INTEGER variables:
data i,j/5,8/
To load an array with values:
data values/1.,2.,3.,4.,5.,5*0./
Where the final assignment 5*0. means take the next 5 elements and pre-load the value of zero.
Now to assign an initial value to a character variable called string, of length 15.
data string/'example '/
Notice that when the value is loaded, the full length of the variable must be filled out with spaces.
parameter statement
lectures six, nineteen, twenty five
examples: arith.f and grades1.f
Written by Jason Wehr : jcw142@psu.edu and Maintained by John Mahaffy : jhm@cac.psu.edu