ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

CSVUtil - CSVINTO with Multiple-byte Field Delimiter

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CSVUtil - CSVINTO with Multiple-byte Field Delimiter

    Hi all,

    I convinced a colleague to use Scott Kement’s CSVLIB, specifically data-into with CSVINTO, to make his life easier.

    The problem is that our customer’s source data is UTF-8 and unfortunately uses a field delimiter that is three bytes (‡).
    Our version of CSVLIB seems to support only one-byte delimiters—flddel is char(1).

    The likelihood is probably low, but before we try to do it ourselves I want to ask if there is a way to use multibyte delimiters we overlooked or maybe someone already enhanced CSVLIB accordingly?

    Thank you

  • #2
    Scott has a forum dedicated to this utility (although it has only recently opened and has but one thread) you can find it here: https://www.scottklement.com/forums/viewforum.php?f=8 Probably a much better spot to pose the question.

    I have not personally had a need to do this and don't have time to study the source right now but I would suggest you study not the code of CSVINTO specifically but rather the underlying routines that it uses - that's going to be where the action is.

    Comment


    • #3
      All you have to do is to change the ifs files CCSID to 1208 ( UTF-8 ).

      When the file is read conversion to EBCDIC is handled automatically.
      When receiving the file the CCSID is set default to 1252 ( Windows )

      CHGATR OBJ('/tmp/myfile.csv') ATR(*CCSID) VALUE(1208)

      Comment

      Working...
      X