Script in OpenVMS to read files

September 24, 2010 at 05:04:56
Specs: OpenVMS
Hey guys,

I need to write a script in OpenVMS 7.3 to read files in a directory and count the number of files in that directory with a particular occurence of data.

Could you help me out with this?

could you also tell me how and where to run this scri

See More: Script in OpenVMS to read files

Report •

September 27, 2010 at 01:44:48
The loop would look like this:
If symbol dirspec conntains the directory list e.g. "disk$data:[data]*.dat":

$ nextfile=f$search(dirspec)
$ if nextfile.eqs."" then goto end !done
$ search/output=NL: 'nextfile' searchcriteria
$ if f$integer($severity).ne.1 then goto loop
$! do whatever with nextfile'
$ goto loop
$end: EXIT

For details of f$search and search read DCL help:
HELP lexical f$search
HELP search

and the VMS DCL disctionary manual (online on the HP OpenVMS homepage) has more deatils.

Joseph Huber,

Report •

February 25, 2011 at 11:39:20
Hi Joseph

I wonder if you woul be able to help me at all ?

I need a DCL script which will allow me to ask a user to input their username and from here allow them to add a search criteria to extract certain files from theire directory and list the attributes of these files, for example creation date, modified date.

Am having nightmares about this so if you could help I will owe you big time

Thanks for reading

Report •

April 19, 2011 at 20:35:20
$ define /user sys$output tempfile
$ search 'dirspec' 'searchcriteria' /stat /out=nl:

tempfile contains the statistics results of the search. Read that file for the count of occurrences. The "/user" switch means the define statement is valid only for the next program run.

This is far more efficient that invoking search command numerous times, because search gets invoked exactly once.

Report •

Related Solutions

Ask Question