MU-VMS Archives

October 1995

MU-VMS@LISTSERV.MIAMIOH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Kent Covert <[log in to unmask]>
Reply To:
Miami University OpenVMS <[log in to unmask]>
Date:
Mon, 30 Oct 1995 09:56:51 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (113 lines)
In article <1995Oct29.125733@miavx1>, [log in to unmask] (R.E. Willi
ams, Jr.) writes:
> Well, I just discovered that if I use quotes around the message, the
> program will send the whole thing, which solves my one word problem (though
> it would still be nice not to have to use quotes...). Still clueless on
> the second problem, though....
 
As someone else posted, a better way to do this is to define logicals for
the nicknames.  But, since this is a learning experience, I offer the
following modified version of your program that should also work.
 
First, though, there is no "good" way to make p2 get more than one word in
DCL (there are ways to do it though, if you want to write a application
using a high-level language).   You can "trick" DCL into putting the entire
line (after the command) into p1, though.  That is what I in this program.
 
To use this program, you need to have the following definition in your
LOGIN.COM file:
 
    $ NEWSEND == "@SYS$LOGIN:NEWSEND.COM """
 
Of course, you can substitute the real directory spec for SYS$LOGIN.  The
""" at the end defines a single quotation mark (I know it looks strange, but
it works).  Therefore, NEWSEND is defined as:
 
    @SYS$LOGIN:NEWSEND.COM "
 
This will "fool" DCL into putting everything that follows the NEWSEND
command into P1.  The program then takes the first "word" of p1 as the
address and everything else as the message (DCL will automatically add the
other quotation mark at the end of your command).
 
Here's the modified program:
 
$!  NewSend.COM
$!
$!  Initialization
$!
$   p1 = f$edit(p1,"trim")
$   sendAddress = f$element(0," ",f$edit(p1,"lowercase"))
$   message = f$extract(f$locate(" ",p1),999,p1)
$!
$!  Try to find sendAddress in aliases.dat file.
$!
$   open/read/error=doSend aliasFile sys$login:aliases.dat
$   read aliasFile aliasRecord/index=0/key="''f$fao("!80AS",sendAddress)'"-
      /error=closeAliasFile
$   addressSize = f$cvui(0,8,f$extract(80,1,aliasRecord))
$   sendAddress = f$extract(82,addressSize,aliasRecord)
$!
$!  Close Alias File
$!
$closeAliasFile:
$   close aliasFile
$!
$!  Issue Send command
$!
$doSend:
$   if message .nes. ""
$   then
$     send 'sendAddress' "''message'"     ! The quotes keep the case correct.
$   else
$     define/user sys$input sys$command
$     send 'sendAddress'
$   endif
$!
$!  Exit Program
$!
$done:
$   exit
 
Other changes to the program:
 
1) If a message doesn't exist, the program will work more like the original
SEND command.  I did this through the IF statement in the doSend section.
The problem you were having is that in a .COM file, data is assumed to
follow the execution of a program up through the next dollar sign. For
example, if you created the following .COM file and ran it:
 
    $ SEND WILLIAR2
    This is a test!
    This is only a test!
    Ok...Here's a third line.
    $ exit
 
all of the lines between the first and last lines would be sent to you as
interactive messages.  The DEFINE/USER statement in the program above
changes were the data is to come from.  SYS$INPUT is the logical name that
DCL uses to find program data.  SYS$COMMAND should be defined to be your
terminal.  The /USER tells the system to only have the DEFINE effective for
the next command.
 
2)  The /error qualifier on the READ statement should probably point to the
closeAliasFile label since the file is already open at that point.
 
3) You always lowercase P2.  I assume that was an attempt to retain the
case in your messages.  By defining all of the parameters as a string as we
have in this program and by placing quotation marks around the message in
the SEND command, we can retain the original case of the command.
 
> BTW, why doesn't SEND like the ! symbol?
 
The ! is the beginning of a comment in DCL.  The exclamation point and
everything following it (assuming the exclamation point doesn't occur
inside of quotation marks) are ignored by DCL.  If you put the message in
quotes (or use the program I've listed above) it should work correctly.
 
--
                                     Kent Covert, Software Coordinator
                                     Miami Computing and Information Services
                                     Miami University, Oxford, OH
                                     [log in to unmask]

ATOM RSS1 RSS2