Skip to main content

Universe 11.3.1 running on AIX

We use a sequentil file (0 bytes) "FLAG FILE" to indicate when a remote system has completed the build of a data file on the primary system.  A program on the primary  system trys to open the file, and loops until it is found (and can then start processing).

Since this 'FLAG FILE" is not in the VOC, I can OPENSEQ it just fine.  But, I have not successfully found a good way to delete it.

Of couse, I can execute a Unix script that will "rm" it, but I would rather do it within the UniVerse Basic program if possible. 

(A DELETESEQ would be a good command, but it does not exist.) 

Suggestions?



------------------------------
Nelson Schroth
president
C3CompleteShop LLC
Harrison OH US
------------------------------

Universe 11.3.1 running on AIX

We use a sequentil file (0 bytes) "FLAG FILE" to indicate when a remote system has completed the build of a data file on the primary system.  A program on the primary  system trys to open the file, and loops until it is found (and can then start processing).

Since this 'FLAG FILE" is not in the VOC, I can OPENSEQ it just fine.  But, I have not successfully found a good way to delete it.

Of couse, I can execute a Unix script that will "rm" it, but I would rather do it within the UniVerse Basic program if possible. 

(A DELETESEQ would be a good command, but it does not exist.) 

Suggestions?



------------------------------
Nelson Schroth
president
C3CompleteShop LLC
Harrison OH US
------------------------------

Hi Nelson,

You can open the folder to a file variable with the OPENPATH statement:

OPENPATH "/folder/path/here" TO FILEVAR ELSE STOP

DELETE FILEVAR, "FILE FLAG"

Just remember you're opening a folder not directly opening the "FILE FLAG".



------------------------------
Joe Goldthwaite
Consultant
Phoenix AZ US
------------------------------

Hi Nelson,

You can open the folder to a file variable with the OPENPATH statement:

OPENPATH "/folder/path/here" TO FILEVAR ELSE STOP

DELETE FILEVAR, "FILE FLAG"

Just remember you're opening a folder not directly opening the "FILE FLAG".



------------------------------
Joe Goldthwaite
Consultant
Phoenix AZ US
------------------------------

I want to verify that the file exists and then delete it.  if it does not exists, I need to sleep for 5 mins and try again, aborting if it fails 5 times.

The folder has hundreds of file in it, so I want to make sure I do not disturb the others.

So, should my logic be:

OPENPATH "/A/B/C" TO FILVAR THEN

         READSEQ "LOCK.TXT" FROM FILVAR THEN

                  DELETE FILVAR,"LOCK.TXT"

         END ELSE

                 CRT 'FILE NOT FOUND'

         END

END



------------------------------
Nelson Schroth
president
C3CompleteShop LLC
Harrison OH US
------------------------------

I want to verify that the file exists and then delete it.  if it does not exists, I need to sleep for 5 mins and try again, aborting if it fails 5 times.

The folder has hundreds of file in it, so I want to make sure I do not disturb the others.

So, should my logic be:

OPENPATH "/A/B/C" TO FILVAR THEN

         READSEQ "LOCK.TXT" FROM FILVAR THEN

                  DELETE FILVAR,"LOCK.TXT"

         END ELSE

                 CRT 'FILE NOT FOUND'

         END

END



------------------------------
Nelson Schroth
president
C3CompleteShop LLC
Harrison OH US
------------------------------

Got it.

OPENPATH opens the folder, which should always be there.

then READ TEMPDATA FROM FOLDER.HANDLE,"LOCK.TXT" ind the record!

DELETE FOLDER.HANDLE,"LOCK.TXT" deletes the file.

Thanks Joe!



------------------------------
Nelson Schroth
president
C3CompleteShop LLC
Harrison OH US
------------------------------