[comp.os.vms] Setting your process prompt to the current time.

COLEMAN@UMBSKY.BITNET (04/09/88)

> From:         Mingo <pitt!cisunx!rnmst1@cadre.dsl.pittsburgh.edu>
> Subject:      Setting prompt to time
>
> I am accustomed to having the current time as my prompt using the
> extended prompt facilities of tcsh, and was wondering if it was
> possible if I could have something similar set up on VMS.  I realise
> that it would have to be done something like the following
> command procedure:

   Here's a DCL procedure I wrote which does the very thing you asked for.
It's got one slight problem (see "BUGS") but it takes care of almost
everything you'd probably want to do. If anyone finds a solution to the
"BUGS" part, send me the correction. (I never bothered to try)

                                       Steve


----------------------------- cut here ----------------------------------------
$!+++   +++   +++
$!
$!   MODULE.... DCL
$!
$!   AUTHOR.... Steve Coleman                  05/18/87
$!              Computing Services
$!              University of Massachusetts at Boston
$!              Boston Ma 02125  USA
$!              Bitnet:   COLEMAN@UMBSKY
$!
$!   MODIFIED.. none
$!
$!   ABSTRACT.. This module was written to provide the user with a prompt
$!              made up of the current time.
$!
$!   CALL...... @DCL   (probably best used if executed in LOGIN.COM file)
$!
$!   BUGS...... Anything which requires a double quote.
$!              (e.g. SET PROC/NAME="string")
$!---   ---   ---



$!+++   +++   +++
$!
$!   Set up traps for errors and warnings. Build PROMPT from current time
$!   and set the process prompt to it.
$!
$!   Read a command and take appropriate action. STOP, EXIT and EOJ allow one
$!   to exit from the procedure.
$!
$!---   ---   ---
$    ON CONTROL_Y THEN GOTO GET_CMD
$ GET_CMD:
$    ON ERROR THEN GOTO GET_CMD
$    ON WARNING THEN GOTO GET_CMD
$    PROMPT = "<" + F$EXTRACT(12,8,F$TIME()) + "> "
$    ASSIGN/NOLOG/USER_MODE SYS$COMMAND SYS$INPUT
$    INQUIRE/NOPUNC XYZZY_CMD "''PROMPT'"
$    IF XYZZY_CMD .EQS. "" THEN GOTO GET_CMD
$    IF ((XYZZY_CMD .EQS. "EXIT") .OR. -
         (XYZZY_CMD .EQS. "STOP") .OR. -
         (XYZZY_CMD .EQS. "EOJ")) THEN GOTO FINI
$    'XYZZY_CMD'
$    GOTO GET_CMD



$!+++   +++   +++
$!
$!   Let's go back to a "normal" DCL.
$!
$!---   ---   ---
$ FINI:
----------------------------- cut here ----------------------------------------