How to check if file is empty?

jarrath

New Member
Hi,

I'm not all that familiar with progress code but I need to find if its possible to check to see if a file is empty empty and give a window's pop up message if its not.

Trying to do some file transfer checking for RoundTable.


Thanks,
Ja
 

jarrath

New Member
It's just a txt file and if the file is 0 byte's I would consider that empty..

1) 10.0A, Service Pack 00 Build 1326 (From what I can gather)
2) Windows Server 2003 Standard Edition
3) Haven't tried anything as I'm not a programmer and have very limited knowledge of progress code. But still ended up with trying to find this out
4)
 

RealHeavyDude

Well-Known Member
If your definition of an empty file is file size related then I would try the FILE-INFO system handle:
Code:
 ASSIGN FILE-INFO:FILE-NAME = "appl/admin/batch/db_hammer.p". MESSAGE "Size: " FILE-INFO:FILE-SIZE VIEW-AS ALERT-BOX INFO.

Heavy Regards, RealHeavyDude.
 

jarrath

New Member
Hey Heavy,

Thanks for that.. Would I be right in saying that the below will only send a message if the file is empty?

Code:
IF FILE-INFO:FILE-SIZE = 0 THEN  
MESSAGE "File Transfered " VIEW-AS ALERT-BOX INFO.
END.
 

Cringer

ProgressTalk.com Moderator
Staff member
The END. line needs to be deleted as IF is not bounded by an END. It only applies to the next line of code. You have to physically block larger executable blocks with DO: END.
 

RealHeavyDude

Well-Known Member
Just another thing: MESSAGE will not "send" a message. It will either pop up a message box interactively when used with VIEW-AS ALERT-BOX or write it into the message area of your application.

Heavy Regards, RealHeavyDude.
 
Top