You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

Reading data from .CSV File using SQR

1 reply [Last post]
Guest's picture
Guest

Hi All,
I have the below requiremnet to add DESCRLONG column to the Input File(CSV) to load data from SQR to Job code Table,but there could be special character (Comma) ‘,’ in the DESCRLONG Column, So when I am trying to read data from CSV,it is treating ‘,’ (comma) in DESCR LONG Column as delimiter and remaining part after the Comma is getting assigned to the Next column.

I tried many ways to read the DESCRLONG column as single but unable to fix the Issue.

In File layout(People tools) ,there is option for the Field to Format for the above issue like where we can specify Delimiter (Double quotes) if a field value contains comma, I tried this way also but in SQR it is not working .

With the below code in the SQR, when it encounters ‘,’ in the Input file, it is treating as separate column

unstring $Record by ',' into $Add-Chg-Ind $Setid $Jobcode $Effdt $Status $Descr $Descrshort $Job_Function $Descrlon.
Cany anybody suggest on this?

Thanks in advance,
Sudha...

Lepa's picture
User offline. Last seen 8 weeks 6 days ago. Offline
Joined: 06/23/2008
Posts: 591
Re: Reading data from .CSV File using SQR

You will have a problem if your $descrlon data in the file are not placed between double quotes. You must have that to be able to read it as one field otherwise there is nothing that tells the program to treat it as one field.

Is the string in double quotes and you are still having a problem?

Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog