2

I have this file input.text with say 20 lines. (Although I would like to be able to use any number of lines)

So I want to open the said file and use each string as though it was a parameter for another command.

This other command would take each parameter perform it's function and then write the output to another file itself.

How can I accomplish the intended?

Nayantara Jeyaraj
  • 2,624
  • 7
  • 34
  • 63
DiggidyDale
  • 75
  • 1
  • 7
  • 1
    Have a look at [`OPEN`](http://h41379.www4.hpe.com/doc/83final/9996/9996pro_151.html), [`READ`](http://h41379.www4.hpe.com/doc/83final/9996/9996pro_160.html#index_x_849), `IF`, `GOTO` and `CLOSE`. – HABO Oct 11 '16 at 13:08
  • >>> with say 20 lines. (Although I would like to be able to use any number of lines) -> the number of lines is not relevant, with `open log input.txt` a label loop, and a `read/end=end log line` and then a `goto loop` you can read a file, regardless of the number of lines (add a label end, where you `close log`) – user2915097 Oct 11 '16 at 13:46

1 Answers1

1

Here is an example DCL command file that reads INPUT.TXT and uses the lines found as parameters to a DIR command that outputs to a file called DIROUT.TXT:

$! Read file using results as DIR command parameters...
$ file1="INPUT.TXT"
$ file2="DIROUT.TXT"
$ open/read chnl1 'file1'
$ on control_y then goto done_loop
$ on error then goto done_loop
$read_loop:
$ read/end_of_file=done_loop chnl1 opt1
$ write sys$output ">>> Sending DIR ",opt1," output to ''file2'..."
$ dir/out='file2' 'opt1'
$ goto read_loop
$done_loop:
$ close chnl1
$ write sys$output "Finished..."
$ EXIT

You should be able to adapt this to your requirements.

DennisP
  • 63
  • 7