samtg:
The first question I would ask, is why not use a report. OK, you have your reasons:
1) How about loading your array into a temp table and use the informix unload command?
unload to "/tmp/file.unl" select * from temp_table
This syntax works in 4GL as well isql/dbaccess.
You can even make it a little dynamic:
FUNCTION test_function(table_name, file_name)
DEFINE
sel_string CHAR(80),
file_name CHAR(10),
emp_no CHAR(12),
table_name CHAR(15)
LET sel_string = "select * from ", table_name"
# override the default | if you want to
UNLOAD TO file_name DELIMITER ":" sel_string
IF sqlca.sqlcode != 0
THEN
display "unload problem"
ELSE
display "unload count: ", sqlca.sqlerrd[3]
END IF
END FUNCTION
2) Build strings from the array, and echo it to a file:
main
define
str1 CHAR(10),
str2 CHAR(10),
run_str CHAR(30)
let str1="1|2|3|"
let str2="4|5|6|"
run "rm -f file.unl"
let run_str="echo \"", str1 clipped, "\" >> file.unl"
run run_str
let run_str="echo \"", str2 clipped, "\" >> file.unl"
run run_str
end main
3) Informix 4GL is brain dead when communicating with the OS. I've developed callable "C" functions that will also do this job. Check out the FAQ over in the Informix Online
forum if you're interested.
Regards,
Ed