  Terminals and Attached Printers? (IO$M_EXTEND) 
 The Question is:
 
I replaced a bad VT-420 connected(serial) to a DECAlpha (OpenVMS). Now the
 print screen does not work properly to the epson fx-1050(serial). I receive
 unreadable characters when I print. Do I need to change a setting in VMS
 somewhere since I changed monit
ors?
 
 The Answer is :
 
  Unlike a PC graphics display monitor, a serial terminal has rather
  more local intelligence -- PC monitors depend on an external
  graphics controller for all displays, where a serial terminal is
  fully capabable of bi-directional serial communications and local
  character generation and display.
 
  Put another way, the terminal itself is not configured correctly.
  Check the terminal's printer setup configuration setup screen(s).
 
  OpenVMS is not particularly involved in the communications between
  a serial terminal and the attached printer.
 
  Here is an example of OpenVMS I/O communications involving an
  attached printer; this example shows how OpenVMS communicates
  with a serial terminal and its printer.
 
 
 
#pragma module EXAMPLE "SRH X1.0-000"
 
/*
** Copyright 2000 Compaq Computer Corporation
*/
 
/*
**++
**  Facility:
**
**	Examples
**
**  Version: V1.0
**
**  Abstract:
**
**	Example of working with the $QIO Extended Read
**
**  Author:
**	Steve Hoffman
**
**  Creation Date:  1-Jan-1990
**
**  Modification History:
**                  2-Feb-2001  Compaq C updates, Copyright
**
**--
*/
#include &lt;descrip.h&gt;
#include &lt;iodef.h&gt;
#include &lt;ssdef.h&gt;
#include &lt;starlet.h&gt;
#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;stsdef.h&gt;
#include &lt;trmdef.h&gt;
 
open_target( char *trgdev, unsigned short int *chn )
    {
    unsigned long int retstat;
    struct dsc$descriptor trgdsc;
 
    trgdsc.dsc$w_length = strlen( trgdev );
    trgdsc.dsc$b_dtype = DSC$K_DTYPE_T;
    trgdsc.dsc$b_class = DSC$K_CLASS_S;
    trgdsc.dsc$a_pointer = trgdev;
 
    retstat = sys$assign( &amp;trgdsc, chn, 0, 0, 0 );
    if (!$VMS_STATUS_SUCCESS( retstat )) return retstat;
 
    return retstat;
    }
 
close_target( unsigned short int chn )
    {
    unsigned long int retstat;
 
    retstat = sys$dassgn( chn );
    if (!$VMS_STATUS_SUCCESS( retstat )) return retstat;
 
    return retstat;
    }
 
write_target_with_reply( unsigned short int chn,
    char *wrbuf, char *rdbuf )
    {
    unsigned long int retstat;
    struct qioiosb
	{
        short retstat;
	short terminator_offset;
	char  terminator_char;
	char  reserved;
	char  terminator_length;
	char  cursor_position;
	} rdiosb, wriosb;
 
    struct itemlist_3
	{
	unsigned short int itmlen;
	unsigned short int itmcod;
	void *itmbuf;
	void *itmrla;
	} itmlst[]=
	{
	    {
	    0, TRM$_ESCTRMOVR, (void *) 64, 0
	    },
	    {
	    0, TRM$_MODIFIERS, (void *)
	    (TRM$M_TM_ESCAPE | TRM$M_TM_TRMNOECHO |
	    TRM$M_TM_NOFILTR | TRM$M_TM_NORECALL),
	    0
	    }
	};
 
    retstat = sys$qio( 0, chn,
	IO$_READVBLK | IO$M_EXTEND, &amp;rdiosb, 0, 0,
	rdbuf, 255, 0, 0, itmlst, sizeof(itmlst));
    if (!$VMS_STATUS_SUCCESS( retstat )) return retstat;
 
    retstat = sys$qiow( 0, chn,
	IO$_WRITEVBLK, &amp;wriosb, 0, 0,
	wrbuf, strlen(wrbuf), 0, 0, 0, 0);
    if (!$VMS_STATUS_SUCCESS( retstat )) return retstat;
    retstat = sys$synch(0, &amp;wriosb );
 
    retstat = sys$synch(0, &amp;rdiosb );
 
    return retstat;
    }
 
 
main()
    {
    unsigned long int retstat;
    unsigned short int target_chan;
    char *target_device = "SYS$OUTPUT";
    char target_reply[255];
    unsigned long int *rply;
 
    retstat = open_target( target_device, &amp;target_chan );
    if (!$VMS_STATUS_SUCCESS( retstat )) return retstat;
 
    retstat = write_target_with_reply( target_chan, "\033[?15n", target_reply );
    if (!$VMS_STATUS_SUCCESS( retstat )) return retstat;
 
    rply = (void *) &amp;target_reply[2];
    switch (*rply )
	{
	case '?10n':
	    printf("Printer ready\n");
	    break;
	case '?11n':
	    printf("Printer not ready\n");
	    break;
	case '?13n':
	    printf("No printer\n");
	    break;
	case '?18n':
	    printf("Printer busy\n");
	    break;
	default:
	    printf("Unrecognized response\n");
	    break;
	}
 
    retstat = close_target( target_chan );
    if (!$VMS_STATUS_SUCCESS( retstat )) return retstat;
 
    return SS$_NORMAL;
    }
 
 Answer written or last revised on  17-APR-2003 
