problem with import

DivyaRajesh

New Member
Hi ,


I have a CSV file with the below data
1000,1200,1300,100,charges
2000,1200,1300,-300,Charges


input from "test.csv".
repeat:
import m_line1 m_line2 m_line3 m_line4 m_line5 m_line6.
assign m_line_no = m_line_no + 1.
input close.

/* m_line1 m_line2 etc are local variables */

when I try to display values for m_line1 in UNIX environment, I get the value as 1000
where as in the windows environment, m_line1 = the entire line (1000,1200,1300,100,charges)

could anyone help me with this please??

Rgds,
Divya
 

ttobba

New Member
Use a delimiter or remove the "," in the csv file and replace it with a space.

/* Temp-table for Input from a file */
/* Note : tt1 = the first column in cvs file
tt2 = the second column in cvs file
tt3 = third
ect.
*/

define temp-table tt-Table
field tt1 as char
field tt2 as char
field tt3 as char
field tt4 as char
field tt5 as char
field tt6 as char.
INPUT FROM input.txt.

REPEAT:
CREATE tt-Table.
IMPORT delimiter "," tt1 tt2 tt3 tt4 tt5 tt6.
END.
INPUT CLOSE.

for each tt-Table:
disp tt1 tt2 tt3 tt4 tt5 tt6.
end.
 
Top