Re: Adding pre/post escape sequences to a "SAY"



JF Mezei wrote:

$SAY = "WRITE SYS$OUTPUT" exists on pretty much every VMS system, in many
procedures.

However, what I would like to be able to do is to have a SAY that insert
escape sequence before the message, and another escape sequence after the
message.

(for instance, in a scrolling region environment of a VT terminal, have the
SAY cause the message to be written to the top window, and then return to
the bottom window for any other output).

The one thing I could think of is to define a subroutine:

$SAY: subroutine
$write sys$output esc1,p1,esc2
$exit
$endsubroutine

and then in the program, use CALL SAY "This is the message"

Are there any other suggestions on how this could be done efficiently ?

However, one big drawback of this is that CALL SAY is quite different from
WRITE SYS$OUTPOUT in terms of how the arguments are handled.

one can do WRITE SYS$OUTPUT symbol1,symbol2,symbol3
but you can't CALL SAY symbol1,symbol2,symbol3

Well, technically, you can. Here's how it would work:

$SAY: SUBROUTINE
$ write sys$output esc_seq_1,'p1',esc_seq_2
$ exit
$ endsubroutine

Actually, what I would recommend is this:

$ say := call show_text
.
.
.
$ SAY symbol1,symbol2,symbol3
.
.
.
$ exit
$!
$show_text: SUBROUTINE
$ write sys$output esc_seq_1,'p1',esc_seq_2
$ exit
$ endsubroutine


Any way around that would give me the exact same functionality that is
available with WRITE ?

Well, with the caveat of embedded quotes, that's almost plug-and-pray.

Also, is it correct to state that when using:
$CALL SAY "Nodename: ''f$getsyi("SCSNODENAME")'"

That the argument passed to SAY will have already been expanded (eg: any
symbols inside the strings are translated before it enters the subroutine ?)

Absolutely.

--
David J Dachtera
dba DJE Systems
http://www.djesys.com/

Unofficial OpenVMS Marketing Home Page
http://www.djesys.com/vms/market/

Unofficial Affordable OpenVMS Home Page:
http://www.djesys.com/vms/soho/

Unofficial OpenVMS-IA32 Home Page:
http://www.djesys.com/vms/ia32/

Unofficial OpenVMS Hobbyist Support Page:
http://www.djesys.com/vms/support/
.



Relevant Pages

  • Re: string
    ... and put the parts of the returned value into a string. ... In this case - a dos .com file, ... so after having printed VendorStr twice, you exit normally - without ... call subroutine ...
    (alt.lang.asm)
  • Re: Inappropriate ioctl for device
    ... I understand that die() exits the program. ... assignment to a variable to hold that exit error, ... What does `shift` do? ... scalars that was passed to the subroutine. ...
    (perl.beginners)
  • Re: Error handling in C
    ... using exit() to deal with a problem is seldom the ... mainmight, in some other program, become a subroutine of main. ... I have found that discussing EH is difficult without a given context. ... as stylistic techniques that are context (program type or ...
    (comp.lang.c)
  • RE: Functions 101 The basics
    ... There are two types of procedure in VBA, a function which returns a value ... and a subroutine which cannot return as value. ... the function in the middle of the code using the exit function. ... function splitinhalf(byval s as string, byref s1 as string, byref s2 as ...
    (microsoft.public.excel.programming)
  • Re: Extending DCL [was: Re: DCL suggestion for f$verify()]
    ... $ CASE "A" THEN GOSUB a_label ... SUBROUTINE accepts the input symbol as P1, ... Unofficial OpenVMS Hobbyist Support Page: ... Unofficial Affordable OpenVMS Home Page: ...
    (comp.os.vms)