Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 04:37 AM
03-09-2009 04:37 AM
DCL
to an variable
I shall be thank full if you share some DCL scripting guide/book/document
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 05:00 AM
03-09-2009 05:00 AM
Re: DCL
The simplest way to get the output of a command to a place where it can be read and analyzed is to use the ASSIGN/USER_MODE to route the logical name SYS$OUTPUT to a temporary file.
For an introduction to logical names, see "Logical Names (Part 1)", part of The OpenVMS Consultant series of columns on OpenVMS.org (see http://www.openvms.org/gezelter ).
The "DCL Dictionary" manual is available on the OpenVMS www site at http://h71000.www7.hp.com/doc/83final/9996/9996pro.html
- Bob Gezelter, http://wwws.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 05:18 AM
03-09-2009 05:18 AM
Re: DCL
In general, this doesn't work. Symbols are "bigger" on recent OpenVMS releases, but not big enough to contain the output from many DCL commands.
The OpenVMS User's Guide is the manual you want to read here. This is in the OpenVMS documentation set.
http://www.hp.com/go/openvms/doc
That material will help you understand symbols and logical names and how to deal with /OUTPUT qualifiers and command redirection and such.
The OpenVMS Frequently Asked Questions (FAQ) has how to pass command output around using the PIPE command and logical names. There's a copy of the FAQ here:
http://www.hoffmanlabs.com/vmsfaq/
There's another book around, _Writing Real Programs in DCL_ by Paul Anagnostopoulos and somebody named Hoffman, but that book is presently out of print and used copies of the second edition are reportedly expensive. It's now conceivable that this book might come back into print if there's enough demand, though not through the fine folks over at the Elsevier Digital Press imprint; the previous publishers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 05:25 AM
03-09-2009 05:25 AM
Re: DCL
But most importantly you need to realize that often you do NOT need a command. DCL has a set of powerful LEXICAL to do what on other platforms (Unix) is done using a command.
For example, check out HELP LEXI F$SEARCH as a (better!) alternative to capture the DIRECTORY command output. Ans G$GETDVI and F$FILE and so on.... Check HELP and... RTFM!
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 04:15 AM
03-10-2009 04:15 AM
Re: DCL
$ dir/size=all/grand [...]*.*.*
Grand total of 38 directories, 697 files, 26981/71686 blocks.
Now lets say you want to assign the #of files and total blocks to symbols to use within a script. If P1 is the directory listing ("[...]*.*.*"), then the following command will define the symbols; NFiles = "number of files", and NBlks = Total Blocks.
$ Pipe Dir/Size=all/grand 'P1' | (Read Sys$Input Line ; Read Sys$Input Line ; -
Files = f$elem(5," ",Line) ; -
Blks = f$elem(1,"/",f$elem(7," ",Line)) ; -
define/job/NoLog Nfiles &files ;-
define/job/NoLog Nblks &blks)
$ Nfiles == F$TrnLnm("NFiles","Lnm$Job")
$ NBlks == F$TrnLnm("NBlks","Lnm$Job")
Its a bit clunky, but it is very flexible.
Dave.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 04:42 AM
03-10-2009 04:42 AM
Re: DCL
$ perl -e "for (qx(dir/size=all/grand *.*)){ if (/(\d+) fil.*\/(\d+)/) { $ENV{files}=$1; $ENV{blocks}=$2}}"
$ show log files, blocks
"FILES" = "514" (LNM$PROCESS_TABLE)
"BLOCKS" = "421728" (LNM$PROCESS_TABLE)
$
Same thing using those LEXICALS and a DCL loop:
-----------------------
$files == 0
$blocks == 0
$loop:
$ file = F$SEARCH ("*.*;*")
$ IF file .EQS. "" THEN EXIT
$ files == files + 1
$ blocks == blocks + F$FILE(file,"ALQ")
$ GOTO loop
--------------------------
$SHOW SYMBOL files ...
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 11:39 AM
03-10-2009 11:39 AM
Re: DCL
I agree. On UNIX, it often makes sense to
use the `` or $() notation in a script to
collect the output from some command. On VMS
it seldom does. DCL has lexical functions
which can be used in expressions, and these
are more often the better way to do things.
For example, on UNIX, one might try to parse
"df" output to find the free space on a file
system. On VMS, it makes little sense to try
the same thing with SHOW DEVICE /FULL output
when the F$GETDVI lexical function can do it
easily:
alp $ write sys$output f$getdvi( "dka0:", "freeblocks")
16733466
> You may want to describe the specific
> problem [...]
Another good idea. Asking how to implement a
particular poor solution to a problem is
often less useful than asking how to solve
the actual problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2009 12:14 AM
03-11-2009 12:14 AM
Re: DCL
1. I have a recording of monitor system command which is taken after every 5 mins
$
and this output is stored into files with time stamp in there name
2. I have to generate a report of last one week disk IO's
so I create a list of monitor record files into a list file
$ dir
3. then I read this file line by line and parse it to monitor command
$ open /read rec dir.lis
$ rdloop:
$ read /end_of_file=endit rec val
$ define /user sys$output monrep.out
$ pipe monitor disk /input='val | sea sys$input dka0
$ goto rdloop
$ append monrep.out;* monrep.report
4. then I read the monrep.report file and fetch out the desired information
$open /read inpt monrep.report
$ read /end_of_file=clsit inpt val2
$ val2=f$edit(val2,"compress,trim")
$ dsk=f$element(0,"",val2)
$ ios=f$element(4,"",val2)
QUERY
========
IN STEP 3 WHERE I AM DEFINING THE OUTPUT TO A FILE TO WRITE TO THE FILE IS THERE OTHER WAY TO DO THAT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2009 01:27 AM
03-11-2009 01:27 AM
Re: DCL
Unless I misunderstood what you are trying to achieve....
Craig
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2009 01:59 AM
03-11-2009 01:59 AM
Re: DCL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2009 04:58 AM
03-11-2009 04:58 AM
Re: DCL
Ah, now we have a specific, and I think even a tricky question.
Yikes, what an unpleasant task.
Mopping up after a poor past setup.
Be sure to check out T4 for the future!
So anyway, they must have created those files with something like:
$date = f$extract(0,16,f$cvtime()) -"-"-"-"-" "-":"-":"
$end = f$cvti("+0:1:0","ABSOLUTE")
$moni/end=&end/rec='date'.mon/nodisp disk
?
>> IN STEP 3 WHERE I AM DEFINING THE OUTPUT TO A FILE TO WRITE TO THE FILE IS THERE OTHER WAY TO DO THAT
Well, you could add further pipe segments, but it gets really nasty quickly. Too hard!
Next best _should_ be to be able to not to create the individual output files, but just make the output append with a ">>" style operator. But DCL does not have that.
For non-pipe situations you can pre-open a file in DCL, and use that logical name as output device, but that does not work in pipe it seems (process permanent file in the wrong process).
So IF I were to use only DCL for this mission then I would go the hard route, as you outlined already.
Mind you... I would NOT use DIR/BEF to select files which are known to have a timestamp. Why become dependent on the file dates when you can avoid it?
I would use a loop along the lines of:
$loop:
$ file = f$search("*.mon")
$ IF file .EQS. "" THEN GOTO done
$ date = F$EXTR(1,12,file) ! Adapt
$ IF date .LT. "200901010101" THEN GOTO loop
$ files = files + 1
$ PIPE MONI/INPU='file'/DISP=...
But then, I would not use DCL for this task.
I would use PERL.
It will allow me to do much more with the data gathered, and it will not mind dealing with decimal values.
---------------------- test.pl -----------
use strict;
use warnings;
my $files = 0;
for my $file (<*.mon>) {
my $date = substr($file,0,12); # adapt
next if $date lt "200901010101";
$files++;
my ($time, $disk, $rate);
for (qx(MONI/INPU=$file/DISP=SYS\$OUTPUT DISK)) {
$time = $1 if /^\s+(\d+-\S+\s+\S+)/;
if (/DKA0/) {
m/^(\S+)\s.*?\s[0-9.]+\s+([0-9.]+)\s+/;
$disk = $1;
$rate = $2;
print qq($time $disk $rate\n);
}
}
}
print qq(Processed $files files.\n);
-------------------
$perl test.pl
:
11-MAR-2009 07:54:57.67 $8$DKA0: 0.70
11-MAR-2009 07:55:00.67 $8$DKA0: 0.70
11-MAR-2009 07:55:03.68 $8$DKA0: 0.70
11-MAR-2009 07:55:06.68 $8$DKA0: 0.70
11-MAR-2009 07:55:09.69 $8$DKA0: 0.70
11-MAR-2009 07:55:12.69 $8$DKA0: 0.69
Processed 5 files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2009 06:22 AM
03-11-2009 06:22 AM
Re: DCL
The f$cvtime lexical function with the "COMPARISON" argument is your friend here, as is the f$file_attributes lexical with the "CDT" argument for the file creation date.
Don't try to program with Unix and bash designs on OpenVMS; you'll end up frustrated and confused.
And do please acquire and read the Smart Questions FAQ. Terse questions will quite often get you entirely correct -- and somewhere between misleading and entirely wrong -- answers. That reading effort will save everybody involved some time, it will get you the answers you need more quickly, and (more subtly) it'll help you in your career development; simply knowing how to ask good questions can be key to advancement and job promotions.