2

I have a .txt file having some text. I want to read this file and store it into a string. Is there available any function for that? Or how to do it ? please help

Bhavin Bhaskaran
  • 572
  • 5
  • 17
  • 41

2 Answers2

5
define variable s as longchar no-undo.

copy-lob from file "fileName.txt" to s.
Tom Bascom
  • 13,405
  • 2
  • 27
  • 33
1

DEF VAR ch-var AS CHARACTER NO-UNDO.

INPUT FROM VALUE(file-name).

REPEAT:

IMPORT UNFORMATTED ch-var.

END.

Tim Kuehn
  • 3,201
  • 1
  • 17
  • 23
  • 1
    Caution if the file is not properly terminated you will end up missing last line or duplicate line.https://knowledgebase.progress.com/articles/Article/000056072 – kiran Feb 24 '21 at 16:12