Computing.Net > Forums > OpenVMS > DCL script to check for empty file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

DCL script to check for empty file

Reply to Message Icon

Name: jinlong
Date: May 24, 2004 at 00:11:19 Pacific
OS: VMS
CPU/Ram: DS20E
Comment:

Hi,

I need a DCL script in VMS to check for empty file. Is any one could help ?

:)
Tom



Sponsored Link
Ads by Google

Response Number 1
Name: Hakan Andersson (by HakAnd)
Date: May 24, 2004 at 06:17:12 Pacific
Reply:

Quick and Dirty but functional.........
It doesn't check if the file exist or not

$ SET NOON
$ OPEN/READ FILE EMPTY_FILE.TXT
$ READ/END_OF_FILE=EOF FILE DUMMY_STRING
$ !!!! IF NOT EMPTY !!!!
$ WRITE SYS$OUTPUT "THIS FILE IS NOT EMPTY"
$ GOTO END
$EOF:
$ !!!! IF EMPTY !!!!
$ WRITE SYS$OUTPUT "THIS FILE IS EMPTY"
$END:
$ CLOSE FILE
$ EXIT


0

Response Number 2
Name: erensm
Date: May 24, 2004 at 12:04:07 Pacific
Reply:

A little less dirty :

if f$file_attribute("EMPTY_FILE.TXT","ALQ") .eq. 0 then write sys$output "Empty"


0

Response Number 3
Name: erensm
Date: May 24, 2004 at 12:11:46 Pacific
Reply:

OR, depending on what you call an empty file :

if f$file_attribute("EMPTY_FILE.TXT","EOF") .eq. 0 then write sys$output "Empty"


0

Response Number 4
Name: jinlong
Date: May 24, 2004 at 19:07:55 Pacific
Reply:

Thank you very much is working


0

Response Number 5
Name: jinlong
Date: May 24, 2004 at 19:43:34 Pacific
Reply:

Hi Hakan & Me,

Thank you very for your scripts and it working very well.

:)
Tom


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to OpenVMS Forum Home


Sponsored links

Ads by Google


Results for: DCL script to check for empty file

how to check if a file exists using www.computing.net/answers/openvms/how-to-check-if-a-file-exists-using/336.html

script to restart process www.computing.net/answers/openvms/script-to-restart-process/488.html

dcl script help www.computing.net/answers/openvms/dcl-script-help/334.html