Progress 4GL: Regarding OUTPUT TO statement

Viewed 551

What happens when I don't give directory path? Where the file is exported?

DEFINE VARIABLE cPath AS CHARACTER NO-UNDO.
cPath = STRING(MTIME) + "_user.out".

OUTPUT TO VALUE (cPath).
MESSAGE "In side a file".
OUTPUT CLOSE.
2 Answers

The file is exported to your client's working directory. That is typically the directory where you've been in when you have started the client process (_progres, prowin, prowin32).

You can use FILE-INFO to find out:

DEFINE VARIABLE cPath AS CHARACTER NO-UNDO.
cPath = STRING(MTIME) + "_user.out".

OUTPUT TO VALUE (cPath).
MESSAGE "In side a file".
OUTPUT CLOSE.

file-info:file-name = "./" + cPath.
message cPath file-info:full-pathname.

By the way - if you are hoping that using MTIME() to prefix the file name is going to result in a unique file name then you may be disappointed. Multiple processes running at the same time could have collisions. Or you may have old stale files left over from crashed sessions.

Related