Write a log file in 4gl
Write a log file in 4gl
(OP)
Hello,
I want to write a file during the execution of my 4ge.
I don't know how open and write into a file.
thank for your reply.
I want to write a file during the execution of my 4ge.
I don't know how open and write into a file.
thank for your reply.
RE: Write a log file in 4gl
1) After a call to the Informix startlog function:
CODE
You can then append any text using the errorlog function to /path/to/errorfile :
CODE
2) You can use the Informix 4GL REPORT option:
CODE
START REPORT errReport TO "/path/to/myerrorfile"
OUTPUT TO REPORT errReport("a string of text")
FINISH REPORT errReport
Your errReport might look like this:
CODE
DEFINE p_errMsg CHAR(80)
ON EVERY ROW
PRINT column 2, p_errMsg
END REPORT
The drawback of the REPORT option is it truncates the file when the REPORT is started.
3) You can input text into a database table and then unload to a file using the Informix 4GL unload syntax. I think that is dumb for this case, so I won't even cover it.
Finally, there's a 4th way; I've created a FAQ over in the IBM: Informix Dynamic Server forum:
FAQ179-2007: How can Informix 4GL interact with Unix?
The FAQ describes "C" functions that let you interact with the Unix OS. This includes reading and writing to disk files "on the fly". You really don't have to be a "C" programmer to use them. Just link them into your code and call them correctly.