How to tell CSVINTO file is ccsid 1208?

Scott Klement's tool for processing CSV files in an RPG program. http://www.scottklement.com/csv/
Post Reply
cmurray
Posts: 3
Joined: Wed Apr 19, 2023 2:37 pm

How to tell CSVINTO file is ccsid 1208?

Post by cmurray »

Hi,

I try to import a csv which data is french with accent and csvinto is blanking out all fields after those that have «accent» in text.

i used chgatr to chagne the file to csid 1208 but csvinto is putting it back to utf8.
I tried to use ccsid in options, but it is rejected with following error:

Message . . . . : Option 'ccsid=1208' is not valid for DATA-INTO; reason
code 3;
Cause . . . . . : An RPG procedure attempted to use an option string
containing option 'ccsid=1208' which is not valid in the context of the
DATA-INTO operation. The reason code is 3. The full option string is
"doc=file allowextra=yes allowmissing=yes ccsid=1208". Recovery . . . :
Contact the person responsible for program maintenance to determine the
cause of the problem. Technical description . . . . . . . . : Reason codes
and their meanings are as follows: 1. The syntax of an option is not valid.
Options must be specified in the form opt=value. 2. The option is not valid
in the context of DATA-INTO. 3. The value of the option is not recognized or
it is not valid in the context. 4. The "path" option must be specified for
DATA-INTO.

Tks for the help!
Scott Klement
Site Admin
Posts: 636
Joined: Sun Jul 04, 2021 5:12 am

Re: How to tell CSVINTO file is ccsid 1208?

Post by Scott Klement »

Are you certain that your job CCSID is set correctly?

CSVINTO will (unless you've changed it) do all of it's processing in Unicode -- so there shouldn't be any problems with French accents (or any other commonly used characters) unless your job or file are set to the wrong ccsids.
cmurray
Posts: 3
Joined: Wed Apr 19, 2023 2:37 pm

Re: How to tell CSVINTO file is ccsid 1208?

Post by cmurray »

Hi Scott,

Like I said, I received the csv file and did chgatr ccsid(1208) to make it accent readable. (this is what we do usually to keep the accent in the files)
Then I follow the csvintoin debug and here is where its go wrong:

QrnDiReportValueCCSID( parm.handle:%addr(val:*data):%len(val)*2:1200);

this dont return any data on column 11 up to 20 because I have an accent in 11th column.

my job is setted as following (i'm in Montreal, Canada):

Language ID . . . . . . . . . . ENU
Country or region ID . . . . . . US
Coded character set ID . . . . . 65535

I tried to setup the «Coded character set ID» to 1208 but this is not a valid value.
i tried also 256, but doesnot changes anything...

Im a programmer, not an iseries manager.

Tks for your help.
cmurray
Posts: 3
Joined: Wed Apr 19, 2023 2:37 pm

Re: How to tell CSVINTO file is ccsid 1208?

Post by cmurray »

Scott Klement wrote: Thu Apr 20, 2023 4:52 am Are you certain that your job CCSID is set correctly?

CSVINTO will (unless you've changed it) do all of it's processing in Unicode -- so there shouldn't be any problems with French accents (or any other commonly used characters) unless your job or file are set to the wrong ccsids.
Here what I have after the parsing... as you can see the accent is readable but all the remaining data is not parsed into next fields.

CSV.FIELD5(2) = '18250'
CSV.FIELD6(2) = '2023-04-17 16:10:59.0 '
CSV.FIELD7(2) = '18250'
CSV.FIELD8(2) = '2023-04-17 16:13:54.0 '
CSV.FIELD10(2) = 'Capture décran,COMPLETED,2023-04-17 16:10:14.0,cna'
CSV.FIELD17(2) = ' ' <-- not suppose to be empty!
CSV.FIELD18(2) = ' ' <-- not suppose to be empty!
CSV.FIELD19(2) = ' ' <-- not suppose to be empty!

Any idea?
Scott Klement
Site Admin
Posts: 636
Joined: Sun Jul 04, 2021 5:12 am

Re: How to tell CSVINTO file is ccsid 1208?

Post by Scott Klement »

Your job CCSID should be the correct one for French speaking people in Canada. You have your language set to ENU (USA English), and your CCSID set to 65535 (which essentially means "I did not set the ccsid" -- it is not a CCSID in itself). This means that it will default to CCSID 37 for your job -- and I don't know if that's what you expect?

But much more important than the CCSID of the job is the CCSID of the CSV file that you are reading. Please examine that and make sure it is 1208.

Also, after seeing all of the data in one big string like you've shown, I'm not convinced that the problem is CCSID related at all. As near as I can tell, the accented character in "Capture décran" is represented correctly. As such, the problem isn't a CCSID problem, it's a problem locating the delimiter, right?

Can you send me a copy of the file you're reading so I can debug it?
Post Reply