Re: 4GL Newbie: How to do file I/O in 4GL. Create output to file
Posted in 1994
->From: manmetha@gauss.rutgers.edu (Rajesh Malhotra) ->Subject: 4GL Newbie: How to do file I/O in 4GL. Create output to file ->Date: 15 Apr 94 21:37:25 GMT ->Reply-To: manmetha@gauss.rutgers.edu (Rajesh Malhotra) ->Organization: Rutgers Univ., New Brunswick, N.J. -> ->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. -> ->Thanx, -> ->Raj. 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. Anyway, for file output, use a REPORT, as suggested by Dennis Pimple. Key features of the report used this way are specified in the OUTPUT section: OUTPUT LEFT MARGIN 0 RIGHT MARGIN 128 { Or whatever is appropriate for your output. } TOP MARGIN 0 { These are the important values. } BOTTOM MARGIN 0 { In effect, they turn off page formatting. } PAGE LENGTH 1 { So you get unstructured text output. } Obviously you won't use PAGE HEADER/TRAILER sections in a report like this. The only bit of page formatting that I have not been able to suppress using these values is a single blank line at the end of the file. If you are writing SQL to run later, this blank line is no problem. Regards, Alan ___________________________ ______________________| R. Alan Popiel |__________________________ \\ Internet: | Martin Marietta, SLS | / \\ alan@den.mmc.com | P.O. Box 179, M/S 3810 | Std disclaimers apply. / )Voice: | Denver, CO 80201-0179 USA | ( / 303-977-9998 |___________________________| (But you knew that!) \\ /________________________) (____________________________\\