Re: 4GL Newbie: How to do file I/O in 4GL. Create output to file
Posted in 1994
> > > Fellow Informix'ers, > > How does one do file I/O in 4GL? I need to write a 4GL program > thet would generate SQL, but not execute it. This generated SQL needs to > be written to a file, and executed at a different location and time. > > How would I open a file, write to it and then close the file? > I am running 4GL ver 4.00 on an IBM RS6000 AIX 3.2.4. > > Any other ways that I could capture the output? I cannot use > redirect since I have a screen up that prompts the user for input. > > Any and all help on this matter appreciated. Easiest way is to START REPORT report_name TO filename and then issue commands to it. Here is an example (from dbdiff2): (in housekeeping routine) START report dump_SQL TO ofile_name (report routine) ############################################################################ # Easy way to dump to file ############################################################################ REPORT dump_SQL(SQL_line) DEFINE SQL_line CHAR(80) OUTPUT LEFT MARGIN 0 RIGHT MARGIN 80 TOP MARGIN 0 BOTTOM MARGIN 0 PAGE LENGTH 1 # no blank lines please FORMAT ON EVERY ROW print SQL_line END REPORT (in use) OUTPUT TO REPORT dump_SQL(sql_strgs[i]) (don't forget) FINISH REPORT dump_SQL cheers j. _____________________________________________________________________________ Jack Parker | Hewlett Packard, BSMC Boise, Idaho, USA| Oh No! I'm out of Starbucks jparker@hpbs3645.boi.hp.com | - panic - brain will not boot. (208) 396-5388 (W) (208) 384-1623 (H) | _____________________________________________________________________________ Any opinions expressed herein are my own and not those of my employers. _____________________________________________________________________________