×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Write a log file in 4gl

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.

RE: Write a log file in 4gl

There are three typical ways of creating log files in Informix 4GL:

1) After a call to the Informix startlog function:

CODE

call startlog("/path/to/errorfile")

You can then append any text using the errorlog function to /path/to/errorfile :

CODE

call errorlog("my test line")

2)  You can use the Informix 4GL REPORT option:

CODE

# untested
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

REPORT errReport(p_errMsg)
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.



Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close