×
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

Print New Line

Print New Line

Print New Line

(OP)
Hello experts
in my 4gl file
I need to print some file names
like resi,busi,cyta etc in some .txt file
they need to be displayed in new line

resi
busi
cyta
..etc

can somebody help me to print new lines in 4gl file coding

Thanks




RE: Print New Line

There are numerous ways of creating text files in 4GL.  Perhaps the most straightforward say is to create a 4GL report printig just one line, and sending the report to a file:

CODE


MAIN

START REPORT my_report TO "/tmp/file.txt"

OUTPUT TO REPORT my_report ("resi")
OUTPUT TO REPORT my_report ("busi")
OUTPUT TO REPORT my_report ("cyta")

FINISH REPORT my_report

END MAIN

REPORT my_report (output_line)
   DEFINE
      output_line CHAR(30)

OUTPUT
   PAGE LENGTH 1
   TOP MARGIN 0
   LEFT MARGIN 0
   BOTTOM MARGIN 0

FORMAT
   ON EVERY ROW
      PRINT COLUMN 1, output_line

END REPORT

Another way is to build a unix command such as echo'ing a string to a file, and using the 4GL RUN command to execute:

CODE

DEFINE output_file CHAR(25)

MAIN

DEFINE string CHAR(100)

LET output_file = "/tmp/file.txt"
LET string = "rm -f ", output_file cLIPPED
RUN string

LET string = build_command("resi")
RUN string

LET string = build_command("busi")
RUN string

LET string = build_command("cyta")
RUN string
END MAIN

FUNCTION build_command(file_name)
   DEFINE
      file_name CHAR(30),
      str CHAR(100)

LET str = "echo \"", file_name CLIPPED, "\" >> ", output_file CLIPPED
RETURN str

END FUNCTION

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