next up previous contents
Next: 3.2.2 Horizontal Arrays (1 Up: 3.2 How to Process Previous: 3.2 How to Process   Contents


3.2.1 Vertical Arrays (m x 1)

A vertical array is simply an array that is 1 value wide and M values deep. M can be defined in the FSML code or can be read from the input file. In the simple example below, the value of M is read from the file and that value, defined as numships, is used to count through a loop three times.

For a more complex example of vertical arrays, see the loop example in Section 3.3. In the loop example, the data is arranged in a multi-column data file. The data is processed as three vertical arrays, each of which is 101 records long.

Snippet from the Input Deck

Presidential
3
Kennedy
Monroe
Harrison

Snippet from the FSML File

<FileData>
  <String name="shipclass"/>
  <Integer name="numships"/>
  <Array name="shipname" ndims="1" dim="numships" baseType="String"/>
</FileData>
 
<FileStructure>
  <Record ignoreOnRead="false"/>
    <SetValue target="shipclass"/>
  </Record>
  <Record ignoreOnRead="false">
    <SetValue target="numships"/>
  </Record>
  <Loop loopVariable="i" start="1" end="numships" incr="1" doOnce="false">
    <Record ignoreOnRead="false"/>
      <AddValue target="shipname"/>
    </Record>
  </Loop>
</FileStructure>


next up previous contents
Next: 3.2.2 Horizontal Arrays (1 Up: 3.2 How to Process Previous: 3.2 How to Process   Contents

SAIC Ship Technology Division, Annapolis, Maryland, USA
2004-10-26