Liste des Groupes | Revenir à co vms |
On 5/10/25 03:53, David Meyer wrote:That is brilliant!I was wondering if I could use PIPE to do the same thing without havingUsing 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.
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.
$ 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.
Les messages affichés proviennent d'usenet.