LoadCSVFile Method (DATATABLE)


10.5, PLBCMP GUI Only

 

The LoadCSVFile method loads the contents of a CSV file into a DATATABLE. The method uses the following format:

 

[label]

{object}.LoadCSVFile

[GIVING {return}]:

 

 

USING [*FileName=]{fname}[:

 

 

[*Options=]{options}][:

 

 

[*Delimiter=]{delim}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A DATATABLE object.

return

Optional. A Numeric Variable that indicates the success or failure of the method.

fname

Required. A Character String Variable or literal that specifies the file name.

options

Optional. A decimal number or Numeric Variable that has a bit mask value described below.

delim

Optional. A Character String Variable or literal that specifies the delimiter character.

Flags Affected: EOS, OVER, ZERO

Note the following:

  1. This method deletes all rows before loading.

  2. The EOS flag is always cleared.

  3. The ZERO flag is set if the {return} value is zero.

  4. The OVER flag is set if the {return} variable is too small to receive the return value.

  5. The {options} bit mask values indicate one of the following:

  6.  

    Value

    Constant

    Meaning

    0x1

    $TBL_CSVRD_QUOTED

    Input is quoted.

    0x8

    $TBL_CSVRD_INPUTHEADER

    Input the header column text

    0x10

    $TBL_CSVRD_NOZEROWIDTH

    Input skips zero width columns

     

  7. If not specified, {delim} defaults to a comma.

  8. A return value of zero (0) indicates success. Failures return one of the following values:

  9.  

    Value

    Meaning

    200

    There is a file name problem.

    201

    There are no columns defined in the DATATABLE.

    202

    Unable to open the specified file.

    203

    Unable to read the specified file.

    204

    A long record was encountered.

 

 

See Also: Method Syntax, DATATABLE Methods

 



PL/B Language Reference HtmlUpdate Method (DATATABLE) Rollback Method (DATATABLE)