From: mahan@TGV.COM (Patrick L. Mahan)
Newsgroups: comp.os.vms
Subject: Re: Tracking DECW$DISPLAY
Date: 26 Jan 93 19:16:28 GMT
Distribution: world
Organization: The Internet

In <01GTXUFF9BMA8ZDVA9@POMONA.CLAREMONT.EDU> GREG@POMONA.CLAREMONT.EDU writes:
#
# Is there any way (such as a code to $GETDVI) to examine a _WSAn: device
# created with the SET DISPLAY command and determine what node it points
# to (ie the value of the /NODE qualifier to the SET DISPLAY)?

Below the signature is a quick a simple program called WSA.C that allows
you to programmically retrieve the values stored in the UCB of the WSA
device.  I take no credit for this code.  It was written by John McMahon
of TGV, Inc.

--
Patrick L. Mahan

--- TGV Window Washer ------------------------------- Mahan@TGV.COM ---------

Waking a person unnecessarily should not be considered  - Lazarus Long
a capital crime.  For a first offense, that is            From the Notebooks of
							  Lazarus Long

=================================== WSA.H ====================================
#define IO$M_WS_DISPLAY 64
#define	DECW$C_WS_DSP_NODE 1
#define	DECW$C_WS_DSP_TRANSPORT 2
#define	DECW$C_WS_DSP_SERVER 3
#define	DECW$C_WS_DSP_SCREEN 4

=================================== WSA.C ====================================
#include "wsa.h"
#include <ssdef>
#include <iodef>
main()
{
	unsigned int 	status;
	extern int 	sys$assign();
	extern int 	sys$qiow();	 
	unsigned int 	channel;
	char 		node_name[255];
	char		server_name[255];
	char		transport_name[255];
	char		screen_name[255];
	char		output_string[1024];
	unsigned long	iosb[2];

/* Input - display_name is a descriptor containing the logical name/device
   of the display */

	int		display_name[2];
	char *		display_name_string = "DECW$DISPLAY";

	display_name[0] = strlen(display_name_string);
	display_name[1] = display_name_string;

/* Assign a channel to the device */

	status = sys$assign(&display_name,&channel,0,0);
	if (status != SS$_NORMAL) exit(status);

/* Get the node information */

	status = sys$qiow(0,channel,IO$_SENSEMODE|IO$M_WS_DISPLAY,&iosb,0,0,
                         node_name,sizeof(node_name),DECW$C_WS_DSP_NODE,0,0,0);
	if (status != SS$_NORMAL) exit(status);
	if (iosb[0] != SS$_NORMAL) exit(iosb[0]);
	node_name[iosb[1]] = 0;

/* Get the transport information */

	status = sys$qiow(0,channel,IO$_SENSEMODE|IO$M_WS_DISPLAY,&iosb,0,0,
                         transport_name,sizeof(transport_name),
			 DECW$C_WS_DSP_TRANSPORT,
                         0,0,0);
	if (status != SS$_NORMAL) exit(status);
	if (iosb[0] != SS$_NORMAL) exit(iosb[0]);
	transport_name[iosb[1]] = 0;

/* Get the server information */

	status = sys$qiow(0,channel,IO$_SENSEMODE|IO$M_WS_DISPLAY,&iosb,0,0,
                         server_name,sizeof(server_name),
			 DECW$C_WS_DSP_SERVER,0,0,0);
	if (status != SS$_NORMAL) exit(status);
	if (iosb[0] != SS$_NORMAL) exit(iosb[0]);
	server_name[iosb[1]] = 0;

/* Get the screen information */

	status = sys$qiow(0,channel,IO$_SENSEMODE|IO$M_WS_DISPLAY,&iosb,0,0,
                         screen_name,sizeof(screen_name),DECW$C_WS_DSP_SCREEN,
			 	0,0,0);
	if (status != SS$_NORMAL) exit(status);
	if (iosb[0] != SS$_NORMAL) exit(iosb[0]);
	screen_name[iosb[1]] = 0;

/* get rid of the channel */

	status = sys$dassgn(channel);
	if (status != SS$_NORMAL) exit(status);

/* build the output string */

	sprintf(output_string,"%s/%s/%s/%s",node_name,transport_name,
		server_name,screen_name);
	printf("%s\n",output_string);

	exit(SS$_NORMAL);
	
}