INPUT CSV Refinement

Runtime refinement: INPUT CSV #ch, ary() (where ary() is a DIMX array with the AUTO_EXTEND option) now updates the ary() extent based on the number of elements input. Previously it expanded the array extent as needed, but would not contract it. The new behavior matches the original intent (and documentation). As an illustration, you can now replicate a CSV file using the following:

dimx ary(0), x, 0, auto_extend

open #1, "in.csv", input

open #2, "out.csv", output

do

    input csv #1, ary()

    if eof(1) then

        exit

    else

            writecd #2, ary()

    endif

loop

close #1

close #2

 

Note that the explicit test for eof(1) prior to the writecd is only needed to prevent an extra blank line at the end of the output file resulting from the final writecd with a zero element ary(). If a blank line at the end isn't a bother, then you could simplify the loop to:

do

    input csv #1, ary()

    writecd #2, ary()

loop until eof(1)