home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / dbclis.zip / DBCLIST.CMD
OS/2 REXX Batch file  |  1993-03-05  |  4KB  |  138 lines

  1. /* Rexx */
  2.  
  3. /* Display all DBM communications connections (APPN and NETBIOS) */
  4.  
  5. Arg func .
  6. If Left(func,1) = 'N' | func = '' Then
  7.   Call Disp_NETBIOS
  8. If Left(func,1) = 'A' | func = '' Then
  9.   Call Disp_APPN
  10.  
  11. Exit
  12.  
  13. /*------------------------------------------------------------------------*/
  14. /* Display NETBIOS Information */
  15. /*------------------------------------------------------------------------*/
  16. Disp_NETBIOS:
  17.  
  18. If RxFuncQuery('RXNBSESSIONSTATUS') Then
  19.   Call RxFuncAdd 'RXNBSESSIONSTATUS','YDBAUTIL','RXNBSESSIONSTATUS'
  20.  
  21. If RxFuncQuery('SQLDBS') Then
  22.   Call RxFuncAdd 'SQLDBS','SQLAR','SQLDBS'
  23.  
  24. /* Get DBM nodename information */
  25. dbmc.0 = 4       /* 4 elements total */
  26. dbmc.1 = 7       /* nodename */
  27. dbmc.3 = 100     /* nodetype */
  28. Call SQLDBS 'Get Database Manager Configuration Using :dbmc'
  29. If sqlca.sqlcode <> 0 Then
  30.   Do
  31.   Say 'Get-DBM-Configuration failed:';Say sqlmsg
  32.   Exit
  33.   End
  34.  
  35. dbmname = Strip(dbmc.2)
  36. clientname = '#SQL'Left(dbmname,8)'00  '
  37. servername = 'S$SQL'Left(dbmname,8)'#DB'
  38.  
  39. nbrc1 = RxNbSessionStatus(clientname,'c.','i')
  40. nbrc2 = RxNbSessionStatus(servername,'s.','i')
  41.  
  42. If Space(nbrc1,0) <> 0 Then
  43.   c.0 = 0
  44. If Space(nbrc2,0) <> 0 Then
  45.   s.0 = 0
  46.  
  47. /* Constants */
  48. nbs.='?';nbs.1='Listen Pending';nbs.2='Call Pending'
  49. nbs.3='Session Established';nbs.4='Hang-Up Pending'
  50. nbs.5='Hang-Up Complete';nbs.6='Session Aborted'
  51.  
  52. Say;Say Center('Database Manager Active Communications Connections',79,'_')
  53. Say;Say Copies('-',79);Say 'NETBIOS Connection Information:';Say
  54. Say 'Outbound NETBIOS connections:';Say
  55. Say 'To  ' Left('DBM Server',10)'  'Left('Session #',9)'  '||'Session State'
  56. Say '    ' Copies('_',10)'  'Copies('_',9)'  'Copies('_',13)
  57. Do i=1 To c.0
  58.   ss = c.i.2
  59.   If c.i.4 <> '*' Then
  60.     Say '    ' Left(SubStr(c.i.4,6,8),10)'  'Left(c.i.1,9)'  'nbs.ss
  61. End
  62. Say;Say;Say 'Inbound NETBIOS connections:';Say
  63. Say 'From' Left('DBM Client',10)'  'Left('Session #',9)'  '||'Session State'
  64. Say '    ' Copies('_',10)'  'Copies('_',9)'  'Copies('_',13)
  65. Do i=1 To s.0
  66.   ss = s.i.2
  67.   If s.i.4 <> '*' Then
  68.     Say '    ' Left(SubStr(s.i.4,5,8),10)'  'Left(s.i.1,9)'  'nbs.ss
  69. End
  70. Return
  71.  
  72. /*------------------------------------------------------------------------*/
  73. /* Display APPN Information */
  74. /*------------------------------------------------------------------------*/
  75. Disp_APPN:
  76.  
  77. If RxFuncQuery('RXACSMGT') Then
  78.   Call RxFuncAdd 'RXACSMGT','YDBAACSM','YDBAACSM'
  79.  
  80. /* Get APPN Connection information (inbound and outbound) */
  81. Call RxAcsMgt 'display_tp_info','t.'
  82. Call RxAcsMgt 'display_session_info','as.'
  83.  
  84. /* Build indexed list of fqplu names keyed by convid||sessid */
  85. Drop sk. sk1.
  86. Do i=1 To as.0
  87.   cidsid=as.i.2||as.i.1       /* Convid||Sessid key */
  88.   sk.cidsid=Space(as.i.20,0) /* FQ Partner LU Name */
  89.   /* Say "FQPLU for cidsid = x'"c2x(cidsid)"' is '"space(as.i.20,0)"'" */
  90.   sk1.cidsid = as.i.17'/'c2x(as.i.16) /* FQPCID - FqName/UniqueProcId */
  91. End
  92.  
  93. Say;Say Copies('-',79);Say 'APPN Connection Information:';Say
  94. Drop ob. ib.
  95. obc = 0;ibc = 0
  96. Do i=1 To t.0
  97.   If Left(t.i.2,4) = '07'x||'6DB',
  98.   |  Left(t.i.2,4) = '07'x||'6DA' Then
  99.     Do
  100.     If t.i.0 <> 1 Then
  101.       Say 'There are' t.i.0 'conversations for tp number' i
  102.     cidsid = t.i.1.1||t.i.1.4    /* ConvId||SessId key */
  103.     /* Say "DBM Tp cidsid = x'"c2x(cidsid)"'" */
  104.     uid = Strip(t.i.3)
  105.     Select
  106.       When Left(t.i.4,1) = 'R' Then
  107.         Do
  108.         ibc = ibc + 1
  109.         ib.ibc = Left(sk.cidsid,17)'  'Left(uid,9)'  'c2x(t.i.1.2)' ',
  110.                  sk1.cidsid
  111.         End
  112.       When Left(t.i.4,1) = 'L' Then
  113.         Do
  114.         obc = obc + 1
  115.         ob.obc = Left(sk.cidsid,17)'  'Left(uid,9)'  'c2x(t.i.1.2)' ',
  116.                  sk1.cidsid
  117.         End
  118.       Otherwise
  119.         Say "Unknown connection type for session '"c2x(t.i.1.4)"',",
  120.             "conversation '"c2x(t.i.1.1)"'"
  121.     End
  122.     End
  123. End
  124.  
  125. Say;Say;Say 'Outbound APPN connections:';Say
  126. Say 'To  ' Left('Server Node',17)'  '||Left('UserId',9)'  'Left('ProcCorrId',17),
  127.     'FQPCID - FqName/UniqueProcId'
  128. Say '    ' Copies('_',17)'  'Copies('_',9)'  'Copies('_',16)'  'Copies('_',33)
  129. Do i=1 To obc;Say '    ' ob.i;End
  130.  
  131. Say;Say;Say 'Inbound APPN connections:';Say
  132. Say 'From' Left('Client Node',17)'  '||Left('UserId',9)'  'Left('ProcCorrId',17),
  133.     'FQPCID - FqName/UniqueProcId'
  134. Say '    ' Copies('_',17)'  'Copies('_',9)'  'Copies('_',16)'  'Copies('_',33)
  135. Do i=1 To ibc;Say '    ' ib.i;End
  136.  
  137. Return
  138.