[comp.lang.asm370] Writing to the console on MVS systems

seb1525@mvs.draper.COM ("Stephen E. Bacher") (03/05/91)

>Hi all,
>
>     Could anybody out there tell me how to write to the console, terminal,
>on the MVS operating system or can recommends a books or manuals discriping
>the way to do it.
>
>Any comment will be appreatuated.
>Thanks in advanced.
>
>Saad Al-Harthi <CCA3407.SAKAAU03.BITNET>
>Jeddah, SA.

To write to the MVS operator console, use the WTO macro.  Example:

     WTO 'Please mount tape number 123456'

Unfortunately, it is unreasonably hard to code a WTO macro that has a
message text to be computed at run time.  Such programs usually resort
to non-standard techniques like guessing where the text of the WTO will
wind up in storage and storing into that location.  This is not even
permitted in a reentrant program, for which you must code a
WTO MF=L form in your static data area, copy it into a similar WTO MF=L
area in your getmained data area, move in the text you want, load
register 1 with the address of the latter MF=L WTO, and then issue WTO
MF=(E,(1)) ... keeping in mind that the text starts 4 bytes in from the
label on the WTO MF=L macro, unless you include fancy options, in which
case...but you don't want to hear any more.

On the other hand, if all you want to do is send a message to a TSO
user's terminal (as opposed to the system operator's console), your
options are better.  The simplest way is to use the TPUT macro, which
takes a message address and message length which can be easily computed
at run time.  For example:

   LA    R2,MESSAGE
   LA    R3,L'MESSAGE
   TPUT  (R2),(R3)

(There are variations on this, but the above will always work.)

However, if you want your output to show up in a batch job (i.e. you
run the TSO terminal monitor program in the background), this
technique will not work, and you must use the PUTLINE macro.  This is
much more complex, so I will refer you to the appropriate manual
(TSO/E Programming Guide or Programming Services if you have TSO/E, or
Guide to Writing a TMP or a Command Processor if your basic TSO system
is that old).

Or, you can just allocate a file to the terminal, ALLOC FI(xxx) DA(*),
and use normal file I/O (as in any high-level language or assembler
PUT macros) to write to the terminal.

Hope this helps.

                                        - SEB