[comp.os.vms] Why DEFINE/USER_MODE SYS$OUTPUT... doesn't always work

MCGEE@NUACC.ACNS.NWU.EDU (Randy McGee) (05/26/88)

I received the following query privately and thought that it might be of 
general interest to the list.

> Date: Wed, 18 May 88 19:46 PDT
> From: SUE@UWAV1.ACS.WASHINGTON.EDU
> Subject: HELP MR. WIZARD....
> To: MCGEE@nuacc.acns.nwu.edu
> 
>   DEAR MR. (VAX) WIZARD:
>  
> SINCE YOU WERE SO GOOD IN ELUCIDATING THE DIFFERENCE BETWEEN THE
> ASSIGN AND DEFINE DCL COMMANDS, I THOUGHT YOU SURELY WOULD BE THE ONE TO
> ANSWER MY DCL QUESTION.
>  
>   I HAVE USED USED ASSIGN/DEFINE/USER_MODE WITHIN  COM FILES IN THE PAST
> TO CAPTURE OUTPUT OF DCL COMMAND AND ERROR MESSAGES, AND THEY HAVE NEVER
> FAILED ME BEFORE.
>   RECENTLY, I DISCOVERED TO MY SUPRISE THAT RE-DEFINING SYS$OUTPUT BY THIS
> METHOD WILL NOT WORK FOR "SHOW SYMBOL" AND "SHOW TIME".
>   I FINALLY MANAGED TO MAKE IT WORK BY USING ASSIGN/DEFINE WITHOUT
> THE "USER_MODE" QUALIFIER. (OF COURSE, THEN I HAD TO EXPLICITLY DEASSIGN
> SYS$OUTPUT BEFORE THE COM FILE EXITED, UNLIKE THE USER_MODE OPTION.)
>  
>   MY QUESTION IS WHY??? HOW COME I CAN NOT USE THE "USER_MODE" QUALIFIER
> IN "ASSIGN/DEFINE  SYS$OUTPUT" TO CAPTURE TO FILE THE OUTPUT OF "SHOW SYMBOL"
> AND "SHOW TIME", WHEN IT WORKS JUST FINE FOR ALL OTHER DCL COMMANDS????
>  
>   HOW COME "ASSIGN/DEFINE" BY ITSELF WORKS WHEN ASSIGN/DEFINE/USER FAILS???
>  
>         THANX, MR. WIZARD

The reason is that some commands are executed internaly by DCL and as such do 
not invoke an image.  As a result, only images defined at the supervisor mode 
level or higher are seen by DCL.  DEC could probably fix this if they wanted, 
but then they'd have to delete the user mode logical name by hand since there 
is no image run down to do this.

The best place I've seen this documented is on page 3-10 of the V4.0 "Guide to
Using DCL and Command Procedures on VAX/VMS" (order no AA-Y501A-TE) (the DCL 
dictionary and the DCL concepts manual barely even mention it): 

   "You cannot use the DEFINE/USER_MODE command to redirect output from DCL 
   commands that are executed within the command interpreter.  However, you
   can redirect output from these commands by using the DEFINE command to
   redefine SYS$OUTPUT, and then using the DEASSIGN command to delete the
   definition when you are through with it.  For example: 

   $ DEFINE SYS$OUTPUT TIME.DAT
   $ SHOW TIME
   $ DEASSIGN SYS$OUTPUT

   After you deassign SYS$OUTPUT, its default value is restored.  Table 3-1 
   lists the commands that are executed within the command interpreter.

   Table 3-1  Commands performed Within the Command Interpreter

      =                                  ALLOCATE
      ASSIGN                             ATTACH
      CANCEL                             CLOSE 
      CONNECT                            CONTINUE
      CREATE/LOGICAL_NAME_TABLE          DEALLOCATE
      DEASSIGN                           DEBUG
      DECK                               DEFINE
      DEFINE/KEY                         DELETE/KEY
      DELETE/SYMBOL                      DEPOSIT
      DISCONNECT                         EOD
      EXAMINE                            EXIT
      GOTO                               IF
      INQUIRE                            ON
      OPEN                               READ
      RECALL                             SET CONTROL
      SET DEFAULT                        SET KEY
      SET ON                             SET OUTPUT_RATE
      SET PROMPT                         SET PROTECTION/DEFAULT
      SET UIC                            SET VERIFY
      SHOW DEFAULT                       SHOW KEY
      SHOW QUOTA                         SHOW PROTECTION
      SHOW STATUS                        SHOW SYMBOL
      SHOW TIME                          SHOW TRANSLATION
      SPAWN                              STOP
      WAIT                               WRITE"

Hope this helps,

V(AX/VMS W)izard
Randy McGee (MAGOO) <mcgee@nuacc.acns.nwu.edu>     Phone:    (312) 491 4079
Academic Computing and Network Services            USPost:   2129 Sheridan Road
Northwestern University                                      Evanston, IL  60208

P.S.  I ask that you not send personal queries to me as I do not always have 
      time to answer them.  Please send them to INFO-VAX instead.  You may 
      even get a quicker or better answer from someone else before I can get 
      to it.

MCGEE%NUACC.ACNS.NWU.EDU%ACCuVAX.NWU.EDU%KL.SRI.COM%lbl%sfsu1.hepnet@LBL.GOV (05/28/88)

Received: from KL.SRI.COM by LBL.Gov with INTERNET ;
          Fri, 27 May 88 02:54:17 PDT
Received: from eecs.nwu.edu by KL.SRI.COM with TCP; Wed 25 May 88 12:40:32-PDT
Received: from accuvax.nwu.edu by gamma.eecs.nwu.edu id aa01673;
          25 May 88 12:18 CDT
Received: from nuacc.acns.nwu.edu by accuvax.NWU.Edu id aa00192;
          25 May 88 12:14 CDT
Date: Wed, 25 May 88 12:15 CDT
From: Randy McGee <MCGEE@NUACC.ACNS.NWU.Edu>
Subject: Why DEFINE/USER_MODE SYS$OUTPUT... doesn't always work
To: INFO-VAX@kl.sri.com, SUE@toby.acs.washington.edu
X-VMS-To: INFO-VAX,IN%"SUE@UWAV1.ACS.WASHINGTON.EDU"
Message-ID:  <8805251214.aa00192@accuvax.NWU.Edu>
 
I received the following query privately and thought that it might be of 
general interest to the list.
 
> Date: Wed, 18 May 88 19:46 PDT
> From: SUE@UWAV1.ACS.WASHINGTON.EDU
> Subject: HELP MR. WIZARD....
> To: MCGEE@nuacc.acns.nwu.edu
> 
>   DEAR MR. (VAX) WIZARD:
>  
> SINCE YOU WERE SO GOOD IN ELUCIDATING THE DIFFERENCE BETWEEN THE
> ASSIGN AND DEFINE DCL COMMANDS, I THOUGHT YOU SURELY WOULD BE THE ONE TO
> ANSWER MY DCL QUESTION.
>  
>   I HAVE USED USED ASSIGN/DEFINE/USER_MODE WITHIN  COM FILES IN THE PAST
> TO CAPTURE OUTPUT OF DCL COMMAND AND ERROR MESSAGES, AND THEY HAVE NEVER
> FAILED ME BEFORE.
>   RECENTLY, I DISCOVERED TO MY SUPRISE THAT RE-DEFINING SYS$OUTPUT BY THIS
> METHOD WILL NOT WORK FOR "SHOW SYMBOL" AND "SHOW TIME".
>   I FINALLY MANAGED TO MAKE IT WORK BY USING ASSIGN/DEFINE WITHOUT
> THE "USER_MODE" QUALIFIER. (OF COURSE, THEN I HAD TO EXPLICITLY DEASSIGN
> SYS$OUTPUT BEFORE THE COM FILE EXITED, UNLIKE THE USER_MODE OPTION.)
>  
>   MY QUESTION IS WHY??? HOW COME I CAN NOT USE THE "USER_MODE" QUALIFIER
> IN "ASSIGN/DEFINE  SYS$OUTPUT" TO CAPTURE TO FILE THE OUTPUT OF "SHOW SYMBOL"
> AND "SHOW TIME", WHEN IT WORKS JUST FINE FOR ALL OTHER DCL COMMANDS????
>  
>   HOW COME "ASSIGN/DEFINE" BY ITSELF WORKS WHEN ASSIGN/DEFINE/USER FAILS???
>  
>         THANX, MR. WIZARD
 
The reason is that some commands are executed internaly by DCL and as such do 
not invoke an image.  As a result, only images defined at the supervisor mode 
level or higher are seen by DCL.  DEC could probably fix this if they wanted, 
but then they'd have to delete the user mode logical name by hand since there 
is no image run down to do this.
 
The best place I've seen this documented is on page 3-10 of the V4.0 "Guide to
Using DCL and Command Procedures on VAX/VMS" (order no AA-Y501A-TE) (the DCL 
dictionary and the DCL concepts manual barely even mention it): 
 
   "You cannot use the DEFINE/USER_MODE command to redirect output from DCL 
   commands that are executed within the command interpreter.  However, you
   can redirect output from these commands by using the DEFINE command to
   redefine SYS$OUTPUT, and then using the DEASSIGN command to delete the
   definition when you are through with it.  For example: 
 
   $ DEFINE SYS$OUTPUT TIME.DAT
   $ SHOW TIME
   $ DEASSIGN SYS$OUTPUT
 
   After you deassign SYS$OUTPUT, its default value is restored.  Table 3-1 
   lists the commands that are executed within the command interpreter.
 
   Table 3-1  Commands performed Within the Command Interpreter
 
      =                                  ALLOCATE
      ASSIGN                             ATTACH
      CANCEL                             CLOSE 
      CONNECT                            CONTINUE
      CREATE/LOGICAL_NAME_TABLE          DEALLOCATE
      DEASSIGN                           DEBUG
      DECK                               DEFINE
      DEFINE/KEY                         DELETE/KEY
      DELETE/SYMBOL                      DEPOSIT
      DISCONNECT                         EOD
      EXAMINE                            EXIT
      GOTO                               IF
      INQUIRE                            ON
      OPEN                               READ
      RECALL                             SET CONTROL
      SET DEFAULT                        SET KEY
      SET ON                             SET OUTPUT_RATE
      SET PROMPT                         SET PROTECTION/DEFAULT
      SET UIC                            SET VERIFY
      SHOW DEFAULT                       SHOW KEY
      SHOW QUOTA                         SHOW PROTECTION
      SHOW STATUS                        SHOW SYMBOL
      SHOW TIME                          SHOW TRANSLATION
      SPAWN                              STOP
      WAIT                               WRITE"
 
Hope this helps,
 
V(AX/VMS W)izard
Randy McGee (MAGOO) <mcgee@nuacc.acns.nwu.edu>     Phone:    (312) 491 4079
Academic Computing and Network Services            USPost:   2129 Sheridan Road
Northwestern University                                      Evanston, IL  60208
 
P.S.  I ask that you not send personal queries to me as I do not always have 
      time to answer them.  Please send them to INFO-VAX instead.  You may 
      even get a quicker or better answer from someone else before I can get 
      to it.