Re: 4GL Newbie: How to do file I/O in 4GL. Create output to file
Posted in 1994
In article <2oubrs$499@emory.mathcs.emory.edu> alan@po.den.mmc.com (Alan Popiel) writes: >Raj, > >File output, such as you want, is easy. I still haven't found a good way >for file *input*; maybe newer versions of 4GL than mine have this feature. Here's what I have done in the past. I doubt that anyone would call it a good way to do file input, but it is a method of sorts. In the 4gl program, do something like: run "sed 's/^/0|/g' input_file | sed 's/$/|/g' > /tmp/t1" This is meant to take input_file, paste a "0|" onto the beginning of every line and a "|" on the end of every line, and put the result into /tmp/t1. Then create a temp table such as temp1 ( a serial, b txt char(80) ) ; Then load /tmp/t1 into temp1. Then you have the whole of the text, with line numbers, in the table and you can do whatever you want with it from there. This assumes that you can anticipate a maximum line length, and that you can identify a character that won't be appear in the text, to use as a delimiter ("|" in the above, but it could be anything). Paul