Running a program with parameters in DCL and saving the output

920 views Asked by At

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?

3

There are 3 answers

0
user2116290 On

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?

0
user2915097 On

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"

0
user3344003 On

I think you want to check the value of the $STATUS DCL variable.