Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2007
    Location
    Nantes, France
    Posts
    2

    Unanswered: 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.

  2. #2
    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

  3. #3
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •