Dear All,

I have a input file which is processed at regular intervals ( 2 secs). I have tried OS-COMMAND MOVE, OS-COMMAND RENAME the but at times the file remains in the input folder.

I am wondering is there any PROgRESS function to get around this?
 

GregTomkins

Active Member
Try being in the directory that Progress runs in, and being the user that Progress runs as, and figuring out what command you need to make this work (eg. 'mv' on Unix or whatever). You could also add a '> log.txt' to the command or otherwise capture whatever error message it is producing.
 
Greg Thanks for the reply.

Its on Windows server. The tricky thing - only few of them are left behind. Is there a proofing that can be done to avoid this.

TIA.
 

sdjensen

Member
What version of Progress?

OS-RENAME has been around for a long time. Use that instead of os-command.

Please note that OS-Rename does not always work of on different disks (*). Use os-copy and check if os-error is 0 and the delete the file by os-delete.

*) We had the problem on Suse 10 (OpenEdge 10.x).
Code:
inputfile = "/workingspace/file1".
outputfile = "/processsedspace/file1".
os-rename value(inputfile) value(outputfile).
The file was not renamed and os-error was 0 as in no error.
 
Hello Everyone, hope you all are well.

OS-RENAME is not working properly when i want to move the file between different directories(I face this issue at my shop). when i tried this on my laptop then i am able to move files from one to other directory like from C to D or vice-versa.

I am unable to understand this because OS-RENAME is supposed to work on different directories as per documentation. what can i do for this problem, please suggest.

Thanks & Regards!
Rajat.
 

Cecil

19+ years progress programming and still learning.
As you are using Windows you could use .NET (because that's what all the 'cool' kids are using) to do the file move. See the code below:

Code:
USING System.*.
USING System.IO.*.

DEFINE VARIABLE chSourceFile AS CHARACTER   NO-UNDO.
DEFINE VARIABLE chTargetFile AS CHARACTER   NO-UNDO.

chSourceFile = 'D:\temp\somefile.txt'.
chTargetFile = 'D:\temp\processed_file.txt'.

IF NOT File:Exists(chSourceFile) THEN
DO:

    MESSAGE
        SUBSTITUTE('The Source File does not exist &1',
                   chSourceFile)
        VIEW-AS ALERT-BOX ERROR.

    RETURN.
END.

/** If the target file exist the delete it. **/
IF File:Exists(chTargetFile) THEN
    File:Delete(chTargetFile).

/** Move the source file to the taget file... **/
File:Move(chSourceFile, chTargetFile).

IF File:Exists(chTargetFile) THEN
    MESSAGE 'Success. The file has moved.'
        VIEW-AS ALERT-BOX INFO.
ELSE
    MESSAGE 'Fail. The file has not moved.'
        VIEW-AS ALERT-BOX ERROR.
 
Hello Everyone,

Thanks Cecil, your code works fine but slight different from my requirement and my curiosity as well.

I am still confuse with OS-RENAME, i found that OS-RENAME doesn't work on different file system but here i am unable to understand the meaning of file system(is it bin sort of directories or something?). My OS-RENAME issue is being solved by using UNIX SILENT command like UNIX SILENT /bin/mv -f VALUE() VALUE() > dev/null, out of this, I could understand mv(MOVE) with -f parameter but i am unable to understand how this UNIX SILENT command works with bin and dev directories.Please suggest.

Thanks & Regards!
Rajat.
 
Hello Everyone,

I forgot to mention that i found the solution of my problem with new progress version because in older version OS-RENAME cause some issues with different file systems.

Thanks & Regards!
Rajat.
 
Top