Re: DCL script for a dummy like me ...
From: JF Mezei (jfmezei.spamnot_at_teksavvy.com)
Date: 01/28/05
- Next message: warren sander: "Re: OpenVMS What's New - January Announcements Updated"
- Previous message: tim.beaudin_at_hp.com: "Re: Problems with Oracle 9i / PHP/ Apache"
- In reply to: eiderdoo: "DCL script for a dummy like me ..."
- Next in thread: Jerry Alan Braga: "Re: DCL script for a dummy like me ..."
- Reply: Jerry Alan Braga: "Re: DCL script for a dummy like me ..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 28 Jan 2005 17:30:51 -0500
eiderdoo wrote:
>
> I'm trying to do my first DCL scripts but I'm in trouble.
> I need to count the number of lines for each file at a given directory
> and keep the result (name of the file and number of lines) in a new
> output file.
You will want to look at the lexicals: F$SEARCH (HELP LEX F$SEARCH )
To go through list of files in a directory:
$SAY :== " write sys$output"
$OPEN/WRITE logfile MYLOGFILE.TXT
$!
$LOOP1:
$ myfile = F$SEARCH("$disk1:[dir1.dir2]*.*")
$ if myfile .eqs. "" then goto endloop1
$! myfile now contains a valid fully qualified file name
$ say "Processing: ''myfile'"
$ call COUNTREC myfile
$ write logfile "''myfile' contains ''records' records"
$goto LOOP1
$!
$ENDLOOP1:
$say "Done with list of files"
$close logfile
$EXIT
$!
$!
$COUNTREC: SUBROUTINE
$ OPEN/READ/SHARE TEMP 'p1
$ records == 0
$ LOOP2:
$ READ/END=endloop2 temp buffer
$ records == records + 1
$ GOTO LOOP2
$!
$ ENDLOOP2:
$ CLOSE TEMP
$ EXIT
$ENDSUBROUTINE
Using the HELP command you can pretty much get detailed information on
the above verbs used. F$things are lexicals and can be reached with HELP
LEXICAL F$thing
the "==" sets a scobe to be global so that the value is shared between
portions of scripts and between scripts executing in the same process
(eg: one scruiupt invoking another).
If you want the output written to file in a neater way, you can lookup
F$FAO which is a glorified equivalent of printf.
Obiwan may have told Luke to use the Force. But the VMS engineers tell
us to use HELP :-)
- Next message: warren sander: "Re: OpenVMS What's New - January Announcements Updated"
- Previous message: tim.beaudin_at_hp.com: "Re: Problems with Oracle 9i / PHP/ Apache"
- In reply to: eiderdoo: "DCL script for a dummy like me ..."
- Next in thread: Jerry Alan Braga: "Re: DCL script for a dummy like me ..."
- Reply: Jerry Alan Braga: "Re: DCL script for a dummy like me ..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|