Deutsch English Français Italiano |
<vvvr99$1tp72$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?Q?Arne_Vajh=C3=B8j?= <arne@vajhoej.dk> Newsgroups: comp.os.vms Subject: Re: Capturing DCL output in symbol Date: Tue, 13 May 2025 12:16:42 -0400 Organization: A noiseless patient Spider Lines: 60 Message-ID: <vvvr99$1tp72$1@dont-email.me> References: <87zfflxmbu.fsf@lucy.meyer21c.net> <vvne00$3gp5f$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 13 May 2025 18:16:42 +0200 (CEST) Injection-Info: dont-email.me; posting-host="eb132b3c358f7f0bcd5e2a7db64a40b1"; logging-data="2024674"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/JB38f3jOpNi6FEnTb7+KYESH25i5Yn88=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:/3ri1aaajgRX1MGbx/U+tTDABl8= Content-Language: en-US In-Reply-To: <vvne00$3gp5f$1@dont-email.me> Bytes: 3297 On 5/10/2025 7:40 AM, hb0815 wrote: > 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. That is brilliant! I tried stuffing it in a COM file: $ vf='f$verify(0)' $ pipe 'p1' | - (read sys$pipe lin ; qlin=""""+lin+"""" ; def/job/nolog res &qlin) ; - 'p2'==f$trnlnm("res") $ if vf then exit f$verify(1)+1 $ exit 1 So I can do: $ @cmd2sym "show time" t $ sh symb t T == " 13-MAY-2025 12:11:57" $ @cmd2sym "type z.txt" t $ sh symb t T == "A" Arne