Reputation: 1
I'm trying to run a program and get the output value in DCL.
In Linux platform script like below
result=$(./tool -e $parameter1 $parameter2 )
echo "result:" $result
I try to do the same script in HP openVMS platform but fail.
Could anyone provide a sample or give me some tips?
Thanks a lot.
Reference: How to assign the output of a program to a variable in a DCL com script on VMS?
Upvotes: 0
Views: 1010
Reputation: 21637
I think you want to check the value of the $STATUS DCL variable.
Upvotes: 0
Reputation: 32176
if you want to redirect sys$output in OpenVMS, you can do
1) $ define/user sys$output file.lis
This means that for the next image activation, the output will go in file.lis
For example, the command
mc authorize sh system
will just give back the prompt if you issue a second time
mc authorize sh system
it will be displayed "normally", on the screen
A variant is
define sys$output file.lis
my_command
my_other_command
deassign sys$output
The output of all your commands goes to file.lis until you deassign sys$output
2) @my_script.com/output=file.lis
You run your OpenVMS script and the output goes to file.lis
3) @tt:/output=file.lis
@myscript
CTRL Z
to exit is similar to 2)
This was used to exit "captive command procedure"
Upvotes: 0
Reputation: 1072
What is the result of your "tool"? As long as it is one line, the answer to a similar, recent question How to store a result to a variable in HP OpenVMS DCL? may help. Other than that, using a pipe command with a temporary output file is probably the easiest solution. Something like
$ PIPE tool -e argument1 argument2 >tmp.txt
$ TYPE tmp.txt
In case you don't know how to pass arguments to your "tool", see how to run a c program with reading command line parameters in openvms?
Upvotes: 0