Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.os.vms    |    DEC's VAX* line of computers & VMS.    |    264,096 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 262,686 of 264,096    |
|    hb0815 to David Meyer    |
|    Re: Capturing DCL output in symbol    |
|    10 May 25 13:40:45    |
   
   From: mw40171@mucweb.de   
      
   On 5/10/25 03:53, David Meyer wrote:   
   > ...   
   > I was wondering if I could use PIPE to do the same thing without having   
   > to create and later clean up the temporary file, but so far I have been   
   > unable to fine a way to get READ inside a PIPE to set a symbol that's   
   > accessible outside the PIPE command.   
   > ...   
      
   Using PIPE: to capture the output of a (DCL) command you need a   
   "pipeline", that is you need "|". For each pipeline you get a   
   sub-processes. Within the sub-process you can assign a DCL symbol with   
   READ. But a symbol in a sub-process is not propagated to the main   
   process. You have to take a detour via a logical name in the job table   
   to get the symbol value into a symbol of the main process.   
      
   $ del/symb t   
   %DCL-W-UNDSYM, undefined symbol - check validity and spelling   
   $ pipe show time | -   
    (read sys$pipe t ;qt=""""+f$fao("!AS",t)+"""" ;def/job/nolog t &qt) -   
    ;t=f$trnlnm("t")   
   $ sh symb t   
    T = " 10-MAY-2025 10:21:19"   
   $   
      
   As you can see, the PIPE command contains a sequence of two pipelines   
   and a DCL command. The second pipeline is a subshell. The logical is   
   defined in the sub-process of the second pipeline. The subshell is   
   required or you will not have access to the symbol read by READ. The DCL   
   command runs in your main process. Translating the logical name into a   
   (local) symbol makes its value available in the main process.   
      
   There are limitations. This can only work if the equivalence string of   
   the logical name is valid, does not exceed a limit, etc.   
      
   If your output is a DCL token, then you do not need the quoting (in qt).   
      
   And yes, you need the "&" for the "define". If you use 't' the symbol is   
   evaluated when you enter the command and not when the define is executed.   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca