Operating System - OpenVMS
1748008 Members
4737 Online
108757 Solutions
New Discussion

Re: Need help about $QIOW function

 
SOLVED
Go to solution
AlexandreR
Occasional Visitor

Need help about $QIOW function

Hello developers,

I need your help again, the I/O program evolve but I meet an other obstacle. Let me resume what I want to do : catch informations about a node in order to get I/O information. The problem : I don't know how to choose a node.

Here a part of nodes of the IT system :

____________________________________________________________________________________________________
Node Name            Status       Identification
----------------     -----------  ----------------------------------------------
BUREAU               Reachable     Bureautique SNECMA Le Creusot
LAT23                Reachable     Acces aux consoles
LAT70                Reachable     LAT70 baie 1 étage 1
MVAX2X               Reachable     Superviseur cellule Tours
MVAX3X               Reachable     R.A.: Configuration Site d'exploitation des pointeuses
MVAX1X               On            MicroVAX 3100-30 (MVAX1X addr.7.1)
_____________________________________________________________________________________________________

See the program I/O : qiolat.pas(join to this message).

And see the program result : qiolat.out(join to this message).

I specified the node LAT70 but it returns information about another node (ex. MVAX2X). Maybe the problem is the parameter P4 of the $QIOW function.

I hope that brings you all informations you wish.

Alexandre Rosa,
IT developer.

6 REPLIES 6
abrsvc
Respected Contributor

Re: Need help about $QIOW function

Perhaps just a snipit of the code and output would be enough.  I did not see any attachments. 

 

Dan

AlexandreR
Occasional Visitor

Re: Need help about $QIOW function

Sorry !

 

THE PROGRAM :

_______________________________________________________
_______________________________________________________

[INHERIT ('SYS$LIBRARY     : STARLET'            ,
          'SYS$LIBRARY     : PASCAL$LIB_ROUTINES')]

PROGRAM Qiolat (INPUT, OUTPUT, ficout) ;

{
                                                          -- param. local node
 MC LATCP> SET NODE /CONNECT= BOTH (INCOMING and OUTGOING)
                                                          -- create port
 MC LATCP> CREATE PORT /LOGICAL_NAME=(NAME=lta_test)
           SET PORT lta_test /NODE= lat70 /PORT= lta110
                                                          -- compil. & link
 PASCAL Qiolat  -> LINK   Qiolat
}
  CONST
    max_sense_itemlist_size = 1500 ;

  TYPE
    $Ubyte = [BYTE] 0..255 ;
    $Uword = [WORD] 0..65535 ;

    Iostatusblock = RECORD
                      status  ,             { Return status }
                      field_2 ,
                      cpt     ,             { Amount bytes received }
                      field_4 : UNSIGNED16 ;
                    END ;          

    {                                         Item descriptor
    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 ;
    }

    Tpac05 = PACKED ARRAY [1..5]  OF CHAR ;

    Tdescr = RECORD
               reclen  : UNSIGNED16 ;
               typdsc  : $Ubyte     ;
               cladsc  : $Ubyte     ;
               address : INTEGER32  ;
             END ;

    Typ_senseitemlist = PACKED ARRAY [1..max_sense_itemlist_size] OF CHAR ;

  
  VAR

    hand_block  : [GLOBAL, VOLATILE] RECORD
                                       link        : INTEGER ;
                                       hand_adress : INTEGER ;
                                       no_arg      : INTEGER ;
                                       exit_status : INTEGER ;
                                     END ;
    exit_status : [GLOBAL, VOLATILE] INTEGER ;

    ficout : [VOLATILE] TEXT ;

    itemlistentry : ITEM_ENTRY$TYPE    ;
    senseitemlist : Typ_senseitemlist  ;

    sys_status      : [VOLATILE] INTEGER       ;
    canal_io        : UNSIGNED16               ;
    io_status_block : [VOLATILE] Iostatusblock ;
    device          : VARYING [15] OF CHAR     ;

    infotemp        : VARYING [80] OF CHAR     ;
    bcnt            : INTEGER ;

  [ASYNCHRONOUS, EXTERNAL(SYS$DCLEXH)] FUNCTION Declaration_exit_handler(
        %REF DESBLK : [UNSAFE]
                        ARRAY [$l1..$u1:INTEGER] OF CHAR) : INTEGER ; EXTERNAL ;

  [ASYNCHRONOUS, UNBOUND] PROCEDURE Exit_handler (VAR arg_address : INTEGER) ;
    VAR
      rec_tmp  : VARYING [256] OF CHAR ;

  BEGIN
    REWRITE (ficout) ;
    WRITEV (rec_tmp, '*** exit_handler, status= ', exit_status:1) ;

    WRITELN (ficout, rec_tmp) ;
  END ;

  PROCEDURE Initialisation_exit_handler ;
  BEGIN
    Hand_block.link         :=    0 ;
    Hand_block.hand_adress  :=    IADDRESS (Exit_handler) ;
    Hand_block.no_arg       :=    1 ;
    Hand_block.exit_status  :=    IADDRESS (exit_status) ;

    Declaration_exit_handler (DESBLK := Hand_block) ;
  END ;

  PROCEDURE Sensemode_port ;
    {
    TYPE                                      Item descriptor
      ENTITY$TYPE = RECORD CASE INTEGER OF
        1: (LAT$V_ETYPE : [POS(0)] $BIT16;
            LAT$R_ESTATFLAGS : [BYTE(1)] RECORD END;
            );
        2: (LAT$V_ESTATUS : [POS(16)] $BIT4;
            );
        3: (LAT$R_EFLAG : [POS(16), BYTE(1)] RECORD END;
            );
        4: (LAT$B_EFLAGS : [POS(16)] $UBYTE; Flags for SENSEmode       
            );
        5: (LAT$R_EFLAGBITS : [POS(16), BYTE(1)] RECORD END;
            );
        6: (LAT$V_SENSE_NEXT : [POS(16)] $BOOL;  Wildcard flag           
            LAT$V_SENSE_FULL : [POS(17)] $BOOL;  Full (vs. summary) flag 
            LAT$V_READ_HISTORY : [POS(18)] $BOOL;  Used for history buffer
            )
      END ;
    }
 
    VAR
      cpt     ,
      lngitm  ,
      lngbuf  ,
      entite  : INTEGER ;
      namebuf : Tpac05 ;
      tampon  : VARYING [128] OF CHAR ;

      buf_dsc : [VOLATILE] Tdescr ;

  BEGIN
    namebuf       := ZERO ;
    senseitemlist := ZERO ;

    entite        := LAT$C_ENT_NODE + LSHIFT (LAT$M_SENSE_NEXT, %x10) ;
    entite        := entite + LSHIFT (LAT$M_SENSE_FULL, %x10) ;

    namebuf := 'LAT70' ;     { node name }

    buf_dsc.reclen  := SIZE (namebuf) ;
    buf_dsc.address := IADDRESS (namebuf) ;
    buf_dsc.typdsc  := DSC$K_DTYPE_T ;
    buf_dsc.cladsc  := DSC$K_CLASS_S ;

    sys_status := $QIOW (CHAN := canal_io                         ,
                         FUNC := IO$_TTY_PORT + IO$M_LT_SENSEMODE ,
                         IOSB := io_status_block                  ,
                         P1   := senseitemlist                    ,
                         P2   := SIZE (senseitemlist)             ,
                         P3   := entite                           ,
                         P4   := IADDRESS (buf_dsc)               ,
                         P5   := 0                                ,
                         P6   := 0                                ) ;
     
    WRITELN ('$QIO status code : ', sys_status            ) ;
    WRITELN ('$QIO I/O status  : ', io_status_block.status) ;
    WRITELN ('$QIO I/O cpt     : ', io_status_block.cpt   ) ;

    IF NOT ODD (io_status_block.status) THEN $EXIT (io_status_block.status) ;

AlexandreR
Occasional Visitor

Re: Need help about $QIOW function

 


    tampon := '' ;

    lngbuf := io_status_block.cpt ;
    cpt    := 1 ;

    WHILE (lngbuf > 0) DO
    BEGIN
      bcnt := 1 ;

      itemlistentry := senseitemlist ::ITEM_ENTRY$TYPE ;

      WITH itemlistentry DO
      BEGIN
        CASE lat$v_string OF
          TRUE  :
            BEGIN
              lngitm := lat$b_item_bcnt +3 ;
              IF (lat$w_itemcode = LAT$_ITM_COUNTERS)
              THEN
              BEGIN
                WRITEV (tampon,
                        'item code: >',
{cpt ??}                lat$w_itemcode, '< [counters, len = ', cpt:4, ']') ;
                WRITELN (tampon)
              END
              ELSE
                WRITELN (senseitemlist [bcnt +3..bcnt +3 +lat$b_item_bcnt -1]) ;
            END ;
          FALSE :
            BEGIN
              lngitm := 6 ;
            END ;
        END ;
        bcnt   := bcnt +lngitm ;
        cpt    := cpt +lngitm ;
        lngbuf := lngbuf -lngitm ;
        senseitemlist := senseitemlist [bcnt..io_status_block.cpt] ;
        WRITEV (tampon,
                 'item code: >', LAT$W_ITEMCODE, '< long= >', lngbuf:4, '<') ;
        WRITELN (tampon) ;
      END ;
    END ;

    senseitemlist := ZERO ;
    entite        := LAT$C_ENT_NODE ;

    sys_status := $QIOW (CHAN := canal_io                         ,
                         FUNC := IO$_TTY_PORT + IO$M_LT_SENSEMODE ,
                         IOSB := io_status_block                  ,
                         P1   := senseitemlist                    ,
                         P2   := SIZE (senseitemlist)             ,
                         P3   := entite                           ,
                         P4   := 0                                ,
                         P5   := 0                                ,
                         P6   := 0                                ) ;
     
    WRITELN ('$QIO status code : ', sys_status            ) ;
    WRITELN ('$QIO I/O status  : ', io_status_block.status) ;
    WRITELN ('$QIO I/O cpt     : ', io_status_block.cpt   ) ;

    tampon := '' ;

    lngbuf := io_status_block.cpt ;
    cpt    := 1 ;

    WHILE (lngbuf > 0) DO
    BEGIN
      bcnt := 1 ;

      itemlistentry := senseitemlist ::ITEM_ENTRY$TYPE ;

      WITH itemlistentry DO
      BEGIN
        CASE lat$v_string OF
          TRUE  :
            BEGIN
              lngitm := lat$b_item_bcnt +3 ;
              IF (lat$w_itemcode = LAT$_ITM_COUNTERS)
              THEN
              BEGIN
                WRITEV (tampon,
                        'item code: >',
{cpt ??}                lat$w_itemcode, '< [counters, len = ', cpt:4, ']') ;
                WRITELN (tampon)
              END
              ELSE
                WRITELN (senseitemlist [bcnt +3..bcnt +3 +lat$b_item_bcnt -1]) ;
            END ;
          FALSE :
            BEGIN
              lngitm := 6 ;
            END ;
        END ;
        bcnt   := bcnt +lngitm ;
        cpt    := cpt +lngitm ;
        lngbuf := lngbuf -lngitm ;
        senseitemlist := senseitemlist [bcnt..io_status_block.cpt] ;
        WRITEV (tampon,
                 'item code: >', LAT$W_ITEMCODE, '< long= >', lngbuf:4, '<') ;
        WRITELN (tampon) ;
      END ;
    END ;
  END ;   
{------------------------------------------------
                             Programme principal
                            -------------------------------------------------- }
BEGIN
  Initialisation_exit_handler ;
  device := 'LTA_TEST' ;

  sys_status := $ALLOC (DEVNAM := device) ;            (* Allocation du canal *)
  IF NOT ODD (sys_status) THEN LIB$STOP (sys_status) ;
   
  sys_status := $ASSIGN (DEVNAM := device,            (* Assignation du canal *)
                         CHAN   := canal_io) ;
  IF NOT ODD (sys_status) THEN LIB$STOP (sys_status) ;       
      
  WRITEV (infotemp,
          'Connexion sur le canal ', canal_io, ' pour le device ', device) ;
  WRITELN (infotemp) ;

  Sensemode_port ;

END.

_______________________________________________________
_______________________________________________________

AlexandreR
Occasional Visitor

Re: Need help about $QIOW function

And The program result :

_______________________________________________________
_______________________________________________________
Connexion sur le canal        112 pour le device LTA_TEST
$QIO status code :          1
$QIO I/O status  :          1
$QIO I/O cpt     :        318
MVAX2X
item code: >     16642< long= > 309<
Superviseur cellule Tours
item code: >     16640< long= > 281<
item code: >        14< long= > 275<
item code: >        15< long= > 269<
.................................................
item code: >     16650< long= > 234<
5.2
item code: >     16656< long= > 228<
AA-00-04-xx-xx-xx
item code: >     16655< long= > 208<
..A..AA-00-04-xx-xx-xx°............A..LAT$LINK
item code: >     16670< long= > 168<
item code: >         2< long= > 162<
item code: >         4< long= > 156<
item code: >        10< long= > 150<
........
item code: >     16668< long= > 143<
item code: >     16660< [counters, len =  176]
item code: >     16660< long= >  50<
..A..CTV....S....................A..COURBON (Cellule de Tours)
item code: >     16658< long= >   0<
$QIO status code :          1
$QIO I/O status  :          1
$QIO I/O cpt     :         58
MVAX1X
item code: >     16642< long= >  49<
MicroVAX 3100-30 (MVAX1X addr.7.1)
item code: >     16640< long= >  12<
item code: >        14< long= >   6<
item code: >         1< long= >   0<
_______________________________________________________
_______________________________________________________


I specified the node LAT70 but it returns information about another node (ex. MVAX2X). Maybe the problem is the parameter P4 of the $QIOW function.

I hope that brings you all informations you wish.

(I can't join file to the post... the forum doesn't work very good ?)

John Gillings
Honored Contributor
Solution

Re: Need help about $QIOW function

Alexandre,

 

   You're specifying LAT$M_SENSE_NEXT. According to the documentation:

 

 If the LAT$V_SENSE_NEXT bit is 0, information about the current entity described by the P3 and P4 parameters is returned to the user; if this bit is 1, information about the next entity that logically follows the one described by P4 is returned. 

 So, aren't you asking about the NEXT node, AFTER the one you've specified in P4?

Try removing LAT$M_SENSE_NEXT?

 

A crucible of informative mistakes
AlexandreR
Occasional Visitor

Re: Need help about $QIOW function

John,

 

thank you very much for your reply, it is very helpful and now i choose the correct node. I removed LAT$M_SENSE_NEXT.

 

Thank you for your help again,

Alexandre.