Page 2 of 2
Re: Scott Klement's Working With CSV Data in RPG
Posted: Tue Aug 03, 2021 10:24 am
by csvrpg
2 more attachments to go with my saga.
Re: Scott Klement's Working With CSV Data in RPG
Posted: Tue Aug 03, 2021 7:25 pm
by Scott Klement
Sorry, I don't understand the question.
The first screenshot you posted today is SUPER tiny and hard to read... Can you tell me what the error message says? The second screenshot says something like "Line number 9: price: Must be a number" (and various other things after that). Well, what is in the price column on line 9?
Re: Scott Klement's Working With CSV Data in RPG
Posted: Tue Aug 03, 2021 8:37 pm
by Scott Klement
Looking at your original inventoryBefore.csv file, the 'description' column has double quotes surrounding it. You are losing those in this case because you are using STRDLM(*NONE) on the CPYTOIMPF command. This means that when there is a comma in the data it will throw everything off.
Will they accept the file with STRDLM(*DBLQUOTE)?
inventoryBefore.csv has quotes around just that one column -- but not around all of the character columns. If you use STRDLM(*DBLQUOTE) it'll put quotes around all of them. So, you'd need to ask if that would be problematic for whomever is processing this file.
The alternative might be to manually put quotes around columns that contain a comma in the RPG code... but this seems like a PITA to do. It'd be much nicer if the format was consistent.