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.

Failing to read correct data using SQR

2 replies [Last post]
krisvamsi2005's picture
User offline. Last seen 6 years 6 weeks ago. Offline
Joined: 03/11/2008
Posts: 17

Hi Guys,

I am trying to load data from an xls file using an SQR into a custom table. The read command used in my sqr is returning some garbage values instead of the correct data.
The file that has to be loaded has a header followed by rows of data....The code looks like this
let #ctr = 1
while 1=1
read 1 into $recorddata:1000
let #ctr = #ctr +1
if (#end-file = 1)
!exit
break
end-if
if isblank(rtrim(ltrim($recorddata,' '),' '))
or substr($recorddata,1,6) = 'Emplid' or substr($recorddata,1,6) = 'EMPLID'
! do nothing
else
do processing
let #record_line_number = #record_line_number + 1
end-if
end-while

The $recorddata is containing garbage values when teh file is read using SQR...
Do you guys think there is some prbelm with the file being loaded...

Thanks,
Vamsi

Thanks,
Vamsi Krishna

Lepa's picture
User offline. Last seen 44 weeks 4 days ago. Offline
Joined: 06/23/2008
Posts: 591
Re: Failing to read correct data using SQR

Vamsi, try saving your excel file as .csv and try loading it again. I think the non-sense data you are getting is because you are attempting to load a .xls file.

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

krisvamsi2005's picture
User offline. Last seen 6 years 6 weeks ago. Offline
Joined: 03/11/2008
Posts: 17
Re: Failing to read correct data using SQR

Hi Lepa,

Thanks for your reply.

Thanks,
Vamsi Krishna