Sounds like an array would do the trick here — or a vector or adjustable-length array, depending on the language that you’re using. But basically, you want to create an array called dia with at least (spanNo_MAX) elements, and then reference dia (and the same for length).
If you are using Visual Basic, you could define a type like this:
<pre>Private Type span
dia As Integer
length As Integer
and then define an array of this type, this way:
<pre>Dim Spans(100) As span</pre>
You can then use it this way:
Spans(1).dia = 5
Spans(1).length = 10</pre>
In this example we are assigning values to the position 1 in the array (i.e spanno = 1)
Hope this helps.