Operating System - OpenVMS
1752780 Members
6224 Online
108789 Solutions
New Discussion юеВ

Re: need help $QIO SENSEMODE

 
SOLVED
Go to solution
Alexandre Rosa
New Member

need help $QIO SENSEMODE

Hi developpers ^^,

I need your help,
i'm trying to develop a Pascal program with the IO$_TTY_PORT + IO$M_LT_SENSEMODE function to read the current characteristics of a DECserver 700. I got the informations of a DECServeur 700 but i don't know how i can interpret the item list. I have many documentation such as the OpenVMS I/O user reference manual but there is not example !
I would be very grateful if you find solution.

Find enclosed my program.
7 REPLIES 7
Robert Gezelter
Honored Contributor

Re: need help $QIO SENSEMODE

Alexandre,

With all due respect:

- Post (as a text [.txt] file) the decoded information from the sense item list
- the completion codes (both the function result from the QIO call, and the contents of the resulting IOSB).

Not everyone has Pascal installed, nor does everyone have a DECserver 700 to run experiments against.

It is a small linguistic issue, but the information retrieved will be primarily about the specific PORT on the DECserver, not the DECserver in general.

- Bob Gezelter, http://www.rlgsc.com
Alexandre Rosa
New Member

Re: need help $QIO SENSEMODE

Thank you for your reply Robert,



Thank you for these precision and i hope this response will agree with you.



So :



- a file.txt is join to this post.



- As you want hereafter is the program's result that I can see on my screen :
_____________________________________________
Connexion sur le canal 128 pour le device LTA70:
$QIO status code : 1
$QIO I/O status : 1
$QIO I/O cpt : 153
._LTA70:............B.....C............A.LTA70.A.LTA110.A..............AN=.....>
_____________________________________________




The buffer of the item list in Hexa his :
____________________BEGIN___________________
07 5F 4C 54 41 37 30 3A 11 00 02 00 00 00 12 00 01 00 00 00 42 00 01 00 00 00
43 00 00 00 00 00 13 00 00 00 00 00 08 41 05 4C 54 41 37 30 09 41 06 4C 54 41
31 31 30 07 41 00 A7 00 00 00 00 00 B3 00 00 00 00 00 14 41 4E 3D 00 4B F6 00
3E 00 00 00 00 00 3F 00 00 00 00 00 40 00 00 00 00 00 7A 00 00 00 00 00 7B
00 00 00 00 00 7C 00 00 00 00 00 7D 00 00 00 00 00 7E 00 00 00 00 00 9F 00 00
00 00 00 A0 00 00 00 00 00 A1 00 00 00 00 00 A5 00 00 00 00 00 00 00
_____________________END_____________________



( 5F 4C 54 41 37 = _LAT70: )



I want to let you know this : I apply a cast on the item list with a type record (struct).
the type record is define in this system file :



_________Extract from STARLET.PAS____________
TYPE ITEM_ENTRY$TYPE = RECORD CASE INTEGER OF
1: (LAT$R_ITM_CODE : [BYTE(2)] RECORD END;
LAT$R_ITEM_VALUE : [BYTE(4)] RECORD END;
);
2: (LAT$W_ITEMCODE : [POS(0)] $UWORD;
);
3: (LAT$R_ITM_BITS : [POS(0), BYTE(2)] RECORD END;
LAT$B_ITEM_BCNT : [POS(16)] $UBYTE;
LAT$T_ITEM_STRING_VALUE : [POS(24)] ARRAY [1..1] OF CHAR;
);
4: (LAT$V_ITEMINDEX : [POS(0)] $BIT14;
LAT$V_STRING : [POS(14)] $BOOL;
LAT$V_CLEAR : [POS(15)] $BOOL;
LAT$L_ITEM_SCALAR_VALUE : [POS(16)] UNSIGNED;
)
END;
_____________________END_____________________







The first cast works good but for the next items list it doesn't work. The first cast return is :
____________________BEGIN____________________
DBG> examine itemlistentry



QIOLAT\ITEMLISTENTRY



Anonymous variant record with 4 variants.



Variant 1:



LAT$R_ITM_CODE



LAT$R_ITEM_VALUE



Variant 2:



LAT$W_ITEMCODE: 16643



Variant 3:



LAT$R_ITM_BITS



LAT$B_ITEM_BCNT: 7



LAT$T_ITEM_STRING_VALUE[1:1]: '_'



Variant 4:



LAT$V_ITEMINDEX: 259



LAT$V_STRING: True



LAT$V_CLEAR: False



LAT$L_ITEM_SCALAR_VALUE: 1414291207



DBG>



_____________________END_____________________







You├в re right when you say I made a mistake, I actually got informations from a specific port on DECserver. ;)




I hope that brings you all informations you wish.



Alexandre Rosa,
IT developer.
Steven Schweda
Honored Contributor
Solution

Re: need help $QIO SENSEMODE

> [...] LAT$C_ENT_NODE [...]

> [...] I actually got informations from a
> specific port on DECserver. ;)

Perhaps, but LAT$C_ENT_NODE might not have
been the way to get info for a port.

> device := 'LTA80' ;

God gave us logical names for a reason.

As I explained before,

http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1479642

my Pascal is too weak to let me do much with
it, but I did manage a C example:

alp $ run 374037
item: 16643 (4103) >_LTA5075:<
item: 17 (0011) %x00000002
item: 18 (0012) %x00000001
item: 66 (0042) %x00000001
item: 67 (0043) %x00000000
item: 19 (0013) %x00000000
item: 16648 (4108) >AN2<
item: 16649 (4109) >PORT_4<
item: 16647 (4107) ><
item: 167 (00a7) %x00000000
item: 179 (00b3) %x00000000
item: 16660 (4114) [counters, len = 78]
alp $

alp $ type 374037.c
/*
* LATCP> create port /logical_name = (name = LTA_TEST)
* LATCP> set port LTA_TEST /node = an2 /port = port_4
*/

#include
#include
#include

#include
#include
#include
#include
#include

int main( int argc, char **argv)
{
int sts;
unsigned short canal_io;
unsigned short item_code;
int i;
int len;
unsigned char buf[ 1500];
struct
{
unsigned short status;
unsigned short fill1;
unsigned short count;
unsigned short fill2;
} iosb;
$DESCRIPTOR( dev_name_descr, "LTA_TEST");

sts = sys$assign( &dev_name_descr, &canal_io, 0, 0, 0);
if ((sts& STS$M_SEVERITY) != STS$K_SUCCESS)
{
fprintf( stderr, " $ASSIGN: %%x%08x\n", sts);
fprintf( stderr, " %s\n", strerror( EVMSERR, sts));
return sts;
}

sts = sys$qiow( 0, /* Event flag. */
canal_io, /* Channel. */
(IO$_TTY_PORT| /* Function code. */
IO$M_LT_SENSEMODE),
&iosb, /* IOSB. */
0, /* AST address. */
0, /* AST parameter. */
buf, /* P1 = result buffer. */
(sizeof buf), /* P2 = buffer size. */
(LAT$C_ENT_PORT| /* P3 = entity type. */
(LAT$M_SENSE_FULL<< 16)),
0, 0, 0); /* P4, P5, P6 (unused). */

if ((sts& STS$M_SEVERITY) == STS$K_SUCCESS)
sts = iosb.status;

if ((sts& STS$M_SEVERITY) != STS$K_SUCCESS)
{
fprintf( stderr, " $QIOW: %%x%08x\n", sts);
fprintf( stderr, " %s\n", strerror( EVMSERR, sts));
return sts;
}

for (i = 0; i < iosb.count; )
{
item_code = *((short *) (buf+ i));
i += 2;
if ((item_code& LAT$M_STRING) != 0)
{
len = buf[ i];
i++;
if (item_code == LAT$_ITM_COUNTERS)
{
printf( " item: %6d (%04x) [counters, len = %d]\n",
item_code, item_code, len);
}
else
{
printf( " item: %6d (%04x) >%.*s<\n",
item_code, item_code, len, (buf+ i));
}
i += len;
}
else
{
printf( " item: %6d (%04x) %%x%08x\n",
item_code, item_code, *((unsigned int *) (buf+ i)));
i += 4;
}
}

return sts;
}
alp $


Most of which looks better with a fixed-width
font.
Steven Schweda
Honored Contributor

Re: need help $QIO SENSEMODE

> Not everyone has Pascal installed,

For a hobbyist, the price is right, and you
never know when you might want to use it.

> [...] nor does everyone have a DECserver
> 700 [...]

AN2 is a 90TL, by the way.

> item_code = *((short *) (buf+ i));

> [...] *((unsigned int *) (buf+ i)));

In case those are not obvious, the first one
says to pretend that "buf+ i" is a pointer to
an unsigned short (int, 16 bits), and to
dereference that pointer-to-unsigned-short.
The other one is similar, for an unsigned int
(32 bits).

If I knew how to assemble multiple bytes into
anything bigger in Pascal, then I might have
been able write an example in Pascal.
RBrown_1
Trusted Contributor

Re: need help $QIO SENSEMODE

There are strange things happening here.

Your program allocates and opens a channel to LTA80. It then asks for information about the local node (LAT$C_ENT_NODE), not about the port. And yet the data you print out includes the string _LTA70, which is not LTA80 and probably isn't your local node name either. Is the program you gave us the same one you are testing with?

Refer to the I/O User's Reference Manual section 5.4.4.4 (in my very old document set) "Obtaining Information About LAT Entities". Read down until you get to "SENSEMODE Item Codes". According to this, the first word of your buffer contains a 1-word item code. Use that to interpret the subsequent bytes. Then you will find another item code, etc.

I ran your code here and found that I did get information about the node running the program.

In the debugger I EXAMINE/WORD SENSEITEM and found 16642 which turns out to be LAT$_ITM_NODE_NAME.

So I EXAMINE/ASCIC SENSEITEM+2 and found "OMEGA", which is my local node name.

Since my nodename plus count is six bytes, the next item code ought to be at senseitem+8, so EXAMINE/WORD SENSEITEM+8, giving me 16640 which is LAT$_ITM_IDENTIFICATION.

Another counted string, so I EXAMINE/ASCIC SENSEITEM+10 and see "DEC 3000 Model 400", which is the Node Ident that I see if I $ MCR LATCP SHOW NODE.

Etc.

Pick up the 1-word item code, do the right thing, repeat.

It turns out that you can tell whether or not the field is string by checking to see if LAT$M_STRING is set in the item code.

Translating this into pascal is left as an exercise. ;-)

hth
Steven Schweda
Honored Contributor

Re: need help $QIO SENSEMODE

> I ran your code here and found that I did
> get information about the node running the
> program.

Same here:

alp $ define LTA80 LTA_TEST
alp $ run 374037_PAS
Connexion sur le canal 208 pour le device LTA80
$QIO status code : 1
$QIO I/O status : 1
$QIO I/O cpt : 882
.ALP.A>COMPAQ Professional Workstation XP1000, VMS V8.3 (Saint Paul)...........
[...]

It's LAT info, but about the node (as
requested). An alert observer might observe
that in my C example I used LAT$C_ENT_PORT.
Alexandre Rosa
New Member

Re: need help $QIO SENSEMODE

First, let me thank you for all your replies. They have been very helpful.

I want to let you know I finally use your program. I have included to the main Pascal program the sense mode function developed in C. It works good and I don't need to spend any more time on this work

Steven, I use your program for what I wanted it does, that├в s fine, thank you again.

I made a mistake in my previous post. I sent you a program with the LAT$C_ENT_NODE function and I wrote the result of the LAT$C_ENT_PORT ! Sorry for my mistake.