 |
» |
|
 |
|
 |

Copyright (c) Digital Equipment Corporation 1991. All rights reserved
LAYERED PRODUCT: VAX PL/I, V3.4 OP/SYS: VMS, V5.4-1
SOURCE: Digital Customer Support Center
OVERVIEW:
This program demonstrates how to obtain the port name, server name,
terminal name, physical name, and user name using the system services
SYS$GETJPI and SYS$GETDVI.
*** CAUTION ***
This sample program has been tested using VAX PL/I V3.4 on VMS V5.4-1.
However, we cannot guarantee its effectiveness because of the possibility
of error in transmitting or implementing it. It is meant to be used as a
template for writing your own program and it may require modification for
use on your system.
PROGRAM:
lat_in: proc options(main);
%include sys$getjpi;
%include sys$getdvi;
%include $ssdef;
%include $stsdef;
%include $jpidef;
%include $dvidef;
dcl prcnam char(15);
dcl prcnamlen fixed bin(15);
dcl termnam char(7);
dcl termnamlen fixed bin(15);
dcl usernam char(12);
dcl usernamlen fixed bin(15);
dcl phyportnam char(64);
dcl phyportnamlen fixed bin(15);
dcl serverport char(64);
dcl serverportlen fixed bin(15);
dcl iosb(4) fixed bin(15);
/* Gets the terminal name, username and process name */
dcl 1 itemlist1,
2 bufflen1 fixed bin(15) init(15),
2 itemcode1 fixed bin(15) init(jpi$_prcnam),
2 buffadr1 pointer,
2 bufflenadr1 pointer,
2 bufflen2 fixed bin(15) init(7),
2 itemcode2 fixed bin(15) init(jpi$_terminal),
2 buffadr2 pointer,
2 bufflenadr2 pointer,
2 bufflen3 fixed bin(15) init(12),
2 itemcode3 fixed bin(15) init(jpi$_username),
2 buffadr3 pointer,
2 bufflenadr3 pointer,
2 terminator fixed bin(31) init(0);
/* Gets the physical device name for the terminal */
dcl 1 itemlist2,
2 buff2len fixed bin(15) init(64),
2 item2code fixed bin(15) init(dvi$_tt_phydevnam),
2 buff2adr pointer,
2 buff2lenadr pointer,
2 terminator fixed bin(31) init(0);
/* Gets the port and server name */
dcl 1 itemlist3,
2 buff3len fixed bin(15) init(64),
2 item3code fixed bin(15) init(dvi$_tt_accpornam),
2 buff3adr pointer,
2 buff3lenadr pointer,
2 terminator fixed bin(31) init(0);
buffadr1 = addr (prcnam);
bufflenadr1 = addr (prcnamlen);
buffadr2 = addr (termnam);
bufflenadr2 = addr (termnamlen);
buffadr3 = addr (usernam);
bufflenadr3 = addr (usernamlen);
buff2adr = addr (phyportnam);
buff2lenadr = addr (phyportnamlen);
buff3adr = addr (serverport);
buff3lenadr = addr (serverportlen);
/* Call sys$getjpiw to get the terminal, user and process names */
sts$value = sys$getjpiw(,,,itemlist1,iosb,,);
if ^sts$success
then signal vaxcondition( sts$value);
if iosb(1) ^= ss$_normal
then signal vaxcondition( sts$value);
put skip list ('username: ',substr(usernam,1,usernamlen),
'process name: ',substr(prcnam,1,prcnamlen));
put skip list ('terminal: ',substr(termnam,1,termnamlen));
/* Call sys$getdvi to get the physical port name using the terminal name */
sts$value = sys$getdviw(,,termnam,itemlist2,iosb,,,);
if ^sts$success
then signal vaxcondition( sts$value);
if iosb(1) ^= ss$_normal
then signal vaxcondition( sts$value);
put skip list ('physical port name: ',substr(phyportnam,1,phyportnamlen));
/* Call $getdvi to get the server and port name using physical portname */
sts$value = sys$getdviw(,,substr(phyportnam,1,phyportnamlen),
itemlist3,iosb,,,);
if ^sts$success
then signal vaxcondition( sts$value);
if iosb(1) ^= ss$_normal
then signal vaxcondition( sts$value);
put skip list ('server/port name: ',substr(serverport,1,serverportlen));
end;
|
buy online or call 1.800.AT.COMPAQ
|
|