Operating System - OpenVMS
1753486 Members
4222 Online
108794 Solutions
New Discussion юеВ

Re: editing a file in tpu editor within a command deck

 
Mary Monaghan
New Member

editing a file in tpu editor within a command deck

when I edit a file using tpu from within a command deck how can I set the screen width to be 132 automatically so the user does not have to enter it.

can I pass it with the edit command

$edit/tpu test.txt
10 REPLIES 10
Wim Van den Wyngaert
Honored Contributor

Re: editing a file in tpu editor within a command deck

Before starting the editor do "set term/wi=132". TPU will set the width itself based upon the current width.

Wim
Wim
Robert Gezelter
Honored Contributor

Re: editing a file in tpu editor within a command deck

Mary,

I concur with Wim, do the SET TERMINAL command.

However, I would STRONGLY recommend that before setting the terminal width, the command procedure should use F$GETDVI to store the current width in a DCL symbol. After the editing session is complete, the prior width setting should be restored.

Also, if this is a general procedure, I would consider using a logical name to select which editor is used. Having an underlying name in the group or system logical name table could provide a default of TPU (see my OpenVMS Technical Journal paper "Inheritance Based Environments in Stand-alone OpenVMS Systems and OpenVMS Clusters", abstract and links at http://www.rlgsc.com/publications/vmstechjournal/inheritance.html, for examples and the concepts of defaulting).

- Bob Gezelter, http://www.rlgsc.com
Karl Rohwedder
Honored Contributor

Re: editing a file in tpu editor within a command deck

To support Roberts idea:
It is not obvious to the casual user, that the terminal width can be obtained with:

$ old_width= F$GETDVI("TT","DEVBUFSIZ")

regards Kalle
Mary Monaghan
New Member

Re: editing a file in tpu editor within a command deck

thanks for the help, one more question when to user exit's or quits from the edit, the screen gets set back to 80 but then it never seems to get to the menu

It just comes back with
$ TYPE SYS$INPUT

and takes input from the screen



$set term/width = 132
$edit/tpu test.txt /read_only
$set term/width 80
$ goto menu


Karl Rohwedder
Honored Contributor

Re: editing a file in tpu editor within a command deck

You should assign sys$input (which comes from the DCL procedure) to your terminal to allow for edit commands, e.g.

$ 1: inquire ok ! here is your menu instead
$ assign /user sys$command sys$input
$ edit/read sys$login:login.com
$ goto 1

Where does the TYPE SYS$INPUT come from?

regards Kalle
Wim Van den Wyngaert
Honored Contributor

Re: editing a file in tpu editor within a command deck

On my VMS 7.3 it's working.

Did you do define (/users) sys$input sys$command somewhere in the command procedure ? Without /user it will stay active ... when you go to the menu.

BTW : You can also use /init=file and put tpu commands in "file". I do "tpu set (mouse,off) in it. Thus I can use cut/paste in tpu.

Wim
Wim
Mary Monaghan
New Member

Re: editing a file in tpu editor within a command deck

thanks for all you help , I'm sorted
Mary Monaghan
New Member

Re: editing a file in tpu editor within a command deck

thanks
John Gillings
Honored Contributor

Re: editing a file in tpu editor within a command deck

Rather than save and restore the terminal width outside, why not get TPU to do it for you? The EVE command SET WIDTH 132 will force the width to 132 characters, and restore it (if necessary) on exit.

There are numerous ways to do this.

1) Using an EVE initialization file:

$ CREATE WIDTH.EVE
SET WIDTH 132
^Z
$ EDIT/TPU/INIT=WIDTH.EVE TEST.TXT

2) Using a TPU command file

$ CREATE WIDTH.TPU
EVE_SET_WIDTH(132);
^Z
$ EDIT/TPU/COMMAND=WIDTH.TPU TEST.TXT

If you don't want to create an extra file, you can even use PIPE!

$ PIPE WRITE SYS$OUTPUT "EVE_SET_WIDTH(132);" | -
(DEFINE/USER SYS$INPUT SYS$COMMAND ; -
EDIT/TPU/COMMAND=SYS$PIPE TEST.TXT)

A crucible of informative mistakes