New language feature: INPUT CSV into a dynamic array. Syntax:
DIMX ary(n), X, 0, auto_extend
...
INPUT CSV #ch, ary()
The above syntax is equivalent to...
INPUT CSV #ch, ary(1), ary(2), ...
where the number of array elements specified is automatically adjusted at runtime to the number of fields on the line.
Requirements / Comments:
• | Compiler edit 854+ |
• | The ary() must be allocated with DIMX, and must be of type X. |
• | The array element size doesn't have to be 0 (i.e. dynamically sized), but if not, individual fields may be truncated as needed. |
• | For auto_extend arrays (highly recommended), the extent will be set to the number of fields input, with 0 indicating none (probably EOF). |
• | In the case of a non auto_extend array, any fields on the input line beyond the fixed extent of the array will be discarded. |
See the SOSFUNC:FNCSVUTL.BSI module for an example of using INPUT CSV into an array to convert each line of a CSV file into an ordmap.