HP OpenVMS Systems

ask the wizard
Content starts here

Assistance with DCL Programming?

» close window

The Question is:

 
Dear Sir/madam.
 
How can I create a mail.dir WHITHOUT loged in
into de user account???
 
I must to do 20 new account every day. Then, loged
in the new account and do:
 
$ mail
mail > set mail_dir [.mail]
mail> exit
$ log
 
I have make a small dcl procedure command, but I have
to run it from the user account or the dcl procedure try
to create the mail_dir in my account.
 
This is the DCl procedure
$ close/nolog maildirtmp
$ tmpfile = "sys$scratch:setmaildir_''f$getjpi("0","PID")'.tmp"
$ open/write maildirtmp 'tmpfile'
$ write maildirtmp "$ set noon"
$ write maildirtmp "$ MAIL"
$ write maildirtmp "SET MAIL_DIRECTORY ''p1'"
$ write maildirtmp "SHOW ALL"         ! for demonstration...
$ write maildirtmp "EXIT"
$ write maildirtmp "$ EXIT"
$ close maildirtmp
$ @'tmpfile'
$ delete 'tmpfile';*
$ exit
 
 
 
Best regards
 
 


The Answer is :

 
  Consider placing the target command procedure in the user's LOGIN.COM
  procedure, conditionalizing the execution for the first login.  The
  LOGIN.COM can conditionalize execution of this DCL based on the presence
  of the mail subdirectory, or (better) can simply replace itself (or
  supercede itself) with a more "benign" version of the LOGIN.COM command
  procedure after the initial execution has completed.  In any event, it
  is typically undesirable that every login invoke this MAIL subdirectory
  logic, as the particular MAIL command need only be executed once.
 
  Alternatively, use DCL DECnet task-to-task specifying the new username
  and password, or a batch procedure submitted via SUBMIT/USER, to invoke
  the command procedure under the context of the target username.
 
  Attached is the full text of a DCL command procedure that the OpenVMS
  Wizard recently provided to a Compaq customer support representative
  for a very similar problem.  (The OpenVMS Wizard would also strongly
  recommend acquiring one or more of the available resources on writing
  DCL command procedures on OpenVMS.  Resources include the OpenVMS User's
  Manual and the second edition of the Digital Press Writing Real Programs
  in DCL book.  Digital Press is an imprint of Butterworth Heinneman,
  information is available at http://www.bh.com/.)
 
  If you require additional assistance or consulting services with this
  problem, please contact your local Compaq Support representative.
 
  --
 
 
$!
$! since I don't want to try this SET MAIL_DIRECTORY at home and
$! mess up my MAIL directory, I have commented the line out.
$!
$! Rather than the SET MAIL_DIRECTORY, I'll use the following
$! rather more benign SET QUEUE and SHOW ALL commands to show
$! that the basic DCL technique works.  Because of this, this
$! demonstration DCL procedure is called with one parameter,
$! the alphanumeric queue name for use within the MAIL profile
$! of the current user.
$!
$ close/nolog maildirtmp
$ tmpfile = "sys$scratch:setmaildir_''f$getjpi("0","PID")'.tmp"
$ open/write maildirtmp 'tmpfile'
$ write maildirtmp "$ set noon"
$ write maildirtmp "$ MAIL"
 
$!$ write maildirtmp "SET MAIL_DIRECTORY ''directory_symbol'"
$ write maildirtmp "SET QUEUE ''p1'"  ! alternative command
$ write maildirtmp "SHOW ALL"         ! for demonstration...
 
$ write maildirtmp "EXIT"
$ write maildirtmp "$ EXIT"
$ close maildirtmp
$ @'tmpfile'
$ delete 'tmpfile';*
$ exit
 
 

answer written or last revised on ( 15-FEB-1999 )

» close window