[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
httpapi and csv
Hi,
I've used http_url_post_xml to get a log in csv format (limited numbers of
records) from a webservice.
The server people says it's a LF as a record separator, but when I write the
csv data to IFS, there is no LF in the file.
Is it possible that httpapi/expat removes LF in the csv return?
Can I use the CSVR4 service program to "parse" the csv file with no record
separator? Any ideas on how to "parse" a csv stream?
Here is what I do in INCOMING:
D ValueCSV s 32767A
if (name = 'csv');
//Make sure we don't have an old file that might be in the way
// (ENOENT means it didnt exist to begin with)
if unlink(%trim(IfsFile)) < 0;
err = errno;
Endif;
// Create a new file, and assign it a code page of 819:
fd = open(%trim(IfsFile):
O_CREAT+O_WRONLY+O_CODEPAGE:
S_IWUSR+S_IRUSR+S_IRGRP+S_IROTH:
819);
callp close(fd);
//Now re-open the file in text mode. Since it was assigned a
//code page of 819, and we're opening it in text mode, OS/400
//will automatically translate to/from ASCII for us.
fd = open(%trim(IfsFile):
O_WRONLY+O_TEXTDATA);
ValueCSV = value;
callp write(fd: %addr(ValueCSV): %size(ValueCSV));
callp close(fd);
endif;
best regards,
Magne
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------