[an error occurred while processing this directive]

HP OpenVMS Systems

ask the wizard
Content starts here

Determining the terminal width setting?

» close window

The Question is:

 
In DCL, how do I determine the terminal width without having to run SHOW
SCREEN.
 
I want to do this within a command file and it is really cumbersome to glean
the output from SHOW SCREEN.   I want to avoid unnecessarily doing SET
TERM/WID=132 within a command file because it clears the screen and I cannot
see the results of my last com
mand.   This is a major nuisance because I often want to cut and paste
result from my last command into my next command.
 
I searched the FAQ and the ASK THE WIZARD info back to 1995 but there is no
mention of determining the width via a DCL lexical function.  I used HELP
LEX * and it looked like F$GETDVI would be the answer because it offers most
of the values from SHOW TERM
.   But unfortunately F$GETDVI does not return TT_WIDTH.
 
Sincerely,
 
David.G.Harding@eds.com
(314)344-4164 (St.Louis MO)
 
 
P.S.   Here is a command file that I created to set a global symbol called
WIDTH.   If there is no better solution then perhaps someone reading your
ASK THE WIZARD page can benefit from this
 
$!--------------------------------------------------------------------------
$! WIDTH.COM:
$! Purpose: Determine width that VMS thinks the terminal is set to
$!
$ WIDTH==0 !make global so next process can use this value!
$ SHOW TERM/BRIEF/OUT=TERMINFO.OUT
$ SEARCH TERMINFO.OUT "Width: " /OUT=WIDTH.OUT
$ DELETE TERMINFO.OUT; !cleanup
$!
$ OPEN/READ IPFILE WIDTH.OUT /ERR=ERR_OPEN
$ READ IPFILE IPLINE /ERR=ERR_READ
$ CLOSE IPFILE
$ DELETE WIDTH.OUT; !cleanup
$!
$ LWIDTH = F$LOCATE("Width:",IPLINE)
$ WIDTH == F$EXTRACT(LWIDTH+7,LWIDTH+9,IPLINE)
$!
$! WRITE SYS$OUTPUT "FYI: TERMINAL WIDTH=''WIDTH'"
$!--------------------------------------------------------------------------
 


The Answer is :

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

answer written or last revised on ( 12-JAN-2000 )

» close window