- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Vms DCL Code
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
Discussions
Discussions
Discussions
Forums
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
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
тАО07-13-2008 06:30 AM
тАО07-13-2008 06:30 AM
Ex. Enter # of Days >
How can I limit the number of days requested to a maximum value of 31 or 365 or whatever.
What would the DCL code be for this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2008 08:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2008 08:43 AM
тАО07-13-2008 08:43 AM
Re: Vms DCL Code
Command line argument? From terminal?
Here is an example of a value checking read loop:
$MIN_DAYS = 31
$MAX_DAYS = 365
$read_days_loop:
$READ/END=done/PROMPT="Enter # of Days > " SYS$COMMAND days
$IF F$TYPE(days).NES."INTEGER" -
.OR. days.LT.MIN_DAYS -
.OR. days.GT.MAX_DAYS
$THEN
$ WRITE SYS$OUTPUT "Please enter a NUMBER from ''MIN_DAYS' to ''MAX_DAYS'"
$ GOTO read_days_loop
$ENDIF
$
$ WRITE SYS$OUTPUT "Processing ''days' days."
$ GOTO read_days_loop
$
$done:
$ WRITE SYS$OUTPUT "Bye now."
hth,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2008 12:43 PM
тАО07-13-2008 12:43 PM
Re: Vms DCL Code
You might consider the book, "Writing Real Programs in DCL." http://www.alibris.com/search/books/qwork/8739673/used/Writing%20Real%20Programs%20in%20DCL
Although out of print, it can still be found.
Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2008 12:56 PM
тАО07-13-2008 12:56 PM
Re: Vms DCL Code
There are two questions here.
First, the syntax of an IF statement in DCL. This is covered in the "DCL Dictionary", in the standard documentation library, available on the HP OpenVMS www site at http://www.hp.com/go/openvms , and is documented in the online HELP text.
The short answer to that question is something along the lines of:
$ IF (days .ge. 500) then $ xxx
There are several variants that may be appropriate, depending on what is written in the command file already.
There is a second question, namely, WHY is the command file failing? Also, "At what point does the command file fail?". This, IMHO, is a more serious problem. Generally, I recommend careful investigation of this type of question, as it often uncovers far more serious problems.
I hope that the above is helpful.
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2008 09:05 PM
тАО07-13-2008 09:05 PM
Re: Vms DCL Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2008 11:24 PM
тАО07-13-2008 11:24 PM
Re: Vms DCL Code
After the line:
$ if f$type(date) .nes. "INTEGER" then goto detail
insert a line:
$ if date .gt.
...where
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2008 11:38 PM
тАО07-13-2008 11:38 PM
Re: Vms DCL Code
Maybe you could "set verify" your code and attach the output of the run ?
Jean-Francois
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-14-2008 12:58 AM
тАО07-14-2008 12:58 AM
Re: Vms DCL Code
f$cvtime("-''date'-00",...
will display errors for values bigger than 9999 and this will look like it's looping on an error.
fwiw
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-14-2008 07:10 AM
тАО07-14-2008 07:10 AM
Re: Vms DCL Code
After the line:
$ if f$type(date) .nes. "INTEGER" then goto detail
insert a line:
$ if date .gt.
...where
Yes, When I put in 31 days for the max and type in 32 it just hangs there? Shouldn't it just exit or prompt me to put in the right # of days again?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-14-2008 07:16 AM
тАО07-14-2008 07:16 AM
Re: Vms DCL Code
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-14-2008 07:26 AM
тАО07-14-2008 07:26 AM
Re: Vms DCL Code
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-14-2008 07:35 AM
тАО07-14-2008 07:35 AM
Re: Vms DCL Code
Yes, if you made the edit correctly, then it should.
See my early example how to use a single IF with OR clause if desired.
>> it just hangs there
Are you sure? Dcl scripts do not 'just sit there'.
Check at least with control-T or SET VERIFY
(control-Y, $set verify, $continue).
Please note MANY inefficiencies and oddities in the script.
imho that "f$cvtime("-''date'-00"
is better written withotu the "00". That just confuses.
Instead of worrying about spaces in the dates before the 10'th you may want to search using ... /MATCH=AND "Start: ", " ''thedate'"
IF you are going to unconditionally append the search out to a file, then why not have search put it there directly?
Instead of
$create 'outf'
$loop:
$sea/out=x.tmp
$appen x.tmp 'outf'
:
$if .not.done then goto loop
use:
$create 'outf'
$open/append outf 'outf'
$loop:
$sea/out=outf
:
$if .not.done then goto loop
$close outf
But most importantly... don't loop through the file over and over!
You might want to open it with DCL, or an other language, check each record. If it has "Start:", then check the date.
Personally I would use perl.
I'll stick in an example, because the date handling might be tricky for a first time.
Usage:
$perl date-filter.pl stats_dir:autostat.dat 123 > 'outf'
#---- date-filter.pl ----
use strict;
use Time::Local;
my $file = shift or die "Please provide file to search";
my $days = shift or die "Please provide a number of daqys to look for";
my ($sec,$min,$hour,$mday,$mon,$year) = localtime();
my $cutoff = timelocal(0,0,0,$mday,$mon,$year) - $days*86400;
open FILE, "<$file" or die "Could not open search file $file\n$!";
while (
if (/(\d+)-(\w+)-(\d+)/) {
my $n = index(" JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC", $2)/3;
print if $cutoff < timelocal(0,0,0,$1,$n-1,$3-1900);
}
}
#-------------------------------
Enjoy,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-14-2008 07:47 AM
тАО07-14-2008 07:47 AM
Re: Vms DCL Code
$ maxdays = 365
$detail:
$ read/prompt="ENTER # OF DAYS (up to ''maxdays') > " sys$command date
$ if f$type(date) .nes. "INTEGER" then goto detail
$ if date .gt. maxdays then goto detail
You need to replicate this at 'Summary:', but other than that I cannot see why you have any problem with the code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-14-2008 07:49 AM
тАО07-14-2008 07:49 AM
Re: Vms DCL Code
JT:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-14-2008 08:04 AM
тАО07-14-2008 08:04 AM
Re: Vms DCL Code
Well, only if you coded the DCL to do that, actually.
DCL does what you tell it to do, within its various limits. DCL is certainly arcane, but it's also among the company of most other languages in lacking any sort of magical DWIM (do what I mean) powers. You gotta code it, or it just won't happen.
Now to see what is happening here with your hang, use the verification mechanism; straight SET VERIFY and invoke, or use something akin to:
$ oldvfy = f$verify(f$trnnm("BACKUP_DEBUG"))
[stuff]
$common_exit:
$ vfy = f$verify(oldvfy)
$ exit
to allow you to selectively enable debug with a logical name. Then see what's wedging.
Based on a quick look, that DCL code is laced with design errors and with some subtle restrictions. It's easy for filenames to collide, for instance.
As has been stated, the processing of the input string is best updated. I'd probably swap from:
$detail:
$ read/prompt="ENTER # OF DAYS > " sys$command date
$ if f$type(date) .nes. "INTEGER" then goto detail
over to -- and note I changed "date" to "days" here, which will require changes downstream -- the following:
$detail:
$ read/prompt="ENTER # OF DAYS > " sys$command days
$ days = f$integer(days)
$ if (days .le. 0) .or. (days .gt. 365) then goto detail
This:
$ search prod_admin:backup.log,backup.sav;*
looks broken. Searching the binary saveset? Really?
This:
/output=addm0700_backup_save.tmp
can collide.
This:
$ if f$search("''addm0700*.tmp;'") .nes. "" then purge/nolog 'addm0700*.tmp;';*
$ if f$search("''addm0700*.tmp;'") .nes. "" then delete/nolog 'addm0700*.tmp;';*
looks broken
I'd probably put the days prompt code in a subroutine, since it looks common.)
This:
$ Set proc/priv=all
implies this is some sort of a menu. And f$setprv() is more common. And enabling all privileges at the top of the DCL is just asking for something (else) to get corrupted or deleted. (The good news for those so included: unless that login thing is marked CAPTIVE, full privileges are easily available.)
And I'd add an /ERROR and/or /END_OF_FILE on the READ, to allow a graceful path out if something on the input messes up. Or if the user uses ^Z to try to punt the operation.
I'm not at all certain if my DCL book is in or out of print. It seems to wink in and out of publication status; AFAIK, it's still available as a demand-print book.
Stephen Hoffman
HoffmanLabs LLC