If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > write a log file with 4ge

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-07-07, 10:19
patriceguic patriceguic is offline
Registered User
 
Join Date: Feb 2007
Location: Nantes, France
Posts: 2
write a log file with 4ge

Hello,

I want to write into a file during the execution of my 4ge.
But i don't know how open a file and how write into a file.

thank for your reply.
Reply With Quote
  #2 (permalink)  
Old 05-11-07, 15:22
artemka artemka is offline
Registered User
 
Join Date: May 2004
Location: New York
Posts: 248
use a RUN function in your code, create a string and have it say something like "echo (your text here) >> /tmp/log_file"
and then in 4gl
RUN string

I have not used 4gl in a while but i think it should work
Reply With Quote
  #3 (permalink)  
Old 05-13-07, 06:35
Tyveleyn Tyveleyn is offline
Registered User
 
Join Date: Aug 2006
Location: The Netherlands
Posts: 248
Hi,

You can write text to stdout with the DISPLAY statement. During execution the stdout of the program can be redirected into a file on the command line.
Another way to write to file with a 4GL program is to define a REPORT function and make calls in the program to it with every line of output. E.g.
Code:
REPORT tab_fld (result)     
DEFINE result CHAR(603)     
                               
OUTPUT                         
    LEFT MARGIN 0              
    RIGHT MARGIN 0             
    TOP MARGIN 0               
    BOTTOM MARGIN 0            
    PAGE LENGTH 1              
                               
FORMAT                         
    ON EVERY ROW               
        PRINT result CLIPPED
END REPORT
This report has to be invoked in the program with something like:
Code:
OUTPUT TO REPORT tab_fld (textstring)
And around the program part that contains the OUTPUT TO statements you have to call:
Code:
START REPORT tab_fld TO "fullpathname/filename"
and:
Code:
FINISH REPORT tab_fld
Regards
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On