%constant %integer maxtcpname= 23 {TCP-name length} %record %format procdatf(%string (6) user, %string (maxtcpname) tcpname, %byte %integer logkey, %byte %integer invoc, protocol, nodeno, fsys, %integer logsno, %byte %integer site, reason, console1, console2, %integer id, process, prev warn, sessend, %byte %integer getmode, preempt, blnk, link) %constant %string (6) %name uinf user= 68<<20 %constant %integer %name uinf isuff=68<<20+x'34' %constant %integer yes=1, no=0 %constant %integer print=no %external %routine %spec emas3string(%string %name vec, val) %external %integer %function %spec dproclist(%integer %name n, adr) %externalroutinespec EMAS3CONNECT %c (%stringname file, %integername mode, hole, prot, conad, %c type, start, end, flag) %external %integer %function fecount(%integer %name num on fe, num on tcp) %integer j, cur, ct, my fe, nentries, fnum, tnum, n %string (maxtcpname) my tcp %record (procdatf) %name c %record (procdatf) %array p(1:256) num on fe = 0 num on tcp = 0 j = dproclist(n, addr(p(1))) %if j # 0 %then %result = j nentries = n my fe = -1 my tcp = "" fnum = 0 tnum = 0 %until fnum > 0 %cycle cur = 0 ct = 0 %while cur < nentries %cycle cur = cur + 1 ct = ct + 1 c == p(cur) %if my fe >= 0 %start ! Second pass: count users on my fe and tcp %if (p(cur)_id >> 16) & 255 = my fe %then fnum = fnum + 1 %if p(cur)_tcpname = my tcp # "null" %then tnum = tnum + 1 %finish %if p(cur)_user = uinf user %and p(cur)_invoc = uinf isuff %and %c my fe < 0 %then my fe = (p(cur)_id >> 16) & 255 %and %c my tcp = p(cur)_tcpname %and %exit %repeat %repeat %if print = yes %start printstring("Num on my fe:") write(fnum, 1) newline printstring("Num on my tcp:") write(tnum, 1) newline %finish num on fe = fnum num on tcp = tnum %result = 0 %end; ! fecount %external %routine test fecount %alias "C#TESTFECOUNT"; !(%string (255) s) %integer a, b, j j = fecount(a, b) printstring("Flag / fecount / tcp count") newline write(j, 1) write(a, 1) write(b, 1) newline %end %external %routine myusers %alias "C#MYUSERS"; !(%string (255) s) %string (255) s, t %record (procdatf) %array p(1:256) %record (procdatf) %name pp %integer j, feusers, tcpusers, i, k, f, l, max, n %owninteger hole,mode,prot,conad,type,start,end,flag,ptr %integer %array fe(0:4) %own %integer %array index(0:255) %ownstring (12) %array x25(1:250) %ownstring (10) %array x25name(1:250) %owninteger last x25 = 0 %constinteger no of pads = 100 %string (maxtcpname) %array nam(1:no of pads) %own %integer %array nuf(1:no of pads) %own %integer %array nus(1:no of pads) %routine read line(%string (*) %name s) %integer i,j,n s="" %cycle n = byteinteger(ptr+conad); ptr = ptr+1 %if n = nl %then %return s = s.tostring(n) %repeat %end %routine get x25addr %integer i,j,n %string (255) s k=0;flag=0; mode = 1; ! read only emas3connect("ercs09:x25addr",hole,mode,prot,conad,type,start,end,flag) %if flag # 0 %then %return ptr = start %cycle %exit %if ptr >= end read line(s) s = s." " %continue %if length(s) < 37 %continue %unless charno(s,13)='0' charno(s,12)=12 last x25 = last x25+1 x25(last x25) = string(addr(s)+12) %cycle j = 34,1,length(s) %if charno(s,j)= ' ' %then %exit %repeat charno(s,33) = j-34 x25name(last x25) = string (addr(s)+33) %repeat %end %string (12) %fn get x25name(%string (*) %name s) %integer i %cycle i = 1,1,last x25 %if s = x25(i) %then %result = x25 name(i) %repeat %result = s %end emas3string("PAD?;word,X121,PAD,FEP,;;", s) %if s = "PAD" %then get x25addr feusers = 0 tcpusers = 0 %routine sort(%integer n) %integer flag, i, j, k %record (procdatf) %name s, t %cycle i = n - 1, -1, 1 flag = 0 %cycle j = 1, 1, i s == p(index(j)) t == p(index(j + 1)) %if s_tcpname > t_tcpname %start k = index(j) index(j) = index(j + 1) index(j + 1) = k flag = 1 %finish %repeat %exit %if flag = 0 %repeat %end index(i) = i %for i = 0, 1, 255 j = fecount(feusers, tcpusers) %if j # 0 %start printstring("feuser count failed ! ") %stop %finish j = dproclist(n, addr(p(1))) %if j = 0 %start max = n printstring("Users =") write(max - 3, 1) printstring(", No of fep users =") write(feusers, 1) printstring(", No of PAD users =") write(tcpusers, 1) newline k = 0 %if s = "X121" %or s = "PAD" %start nam(i) = "" %for i = 1, 1, no of pads k = 1 %cycle i = 1, 1, max pp == p(i) t = pp_tcpname %if length(t) = 14 %then length(t) = 12 %cycle j = 1, 1, k %if t = nam(j) %then %exit %repeat nus(j) = nus(j) + 1 %if j = k %start nam(j) = t nuf(j) = pp_id >> 16 & 255 k = k + 1 %finish %repeat j = 0 %cycle l = 0, 1, 4 %cycle i = 1, 1, k - 1 %if nuf(i) = l %start t = nam(i) %if s = "PAD" %then t = get x25 name(t) printstring(t) spaces(14 - length(t)) printstring("Fe") printsymbol(nuf(i) + '0') write(nus(i), 3) j = j + 1 %if j = 3 %or length(t) > 14 %then %c newline %and j = 0 %else spaces(5) %finish %repeat %repeat newlines(2) -> fe count %finish sort(max) %cycle i = 1, 1, max pp == p(index(i)) %if pp_reason = 2 %and i > 3 %start %cycle l = 1, 1, 4 charno(pp_user, l) = charno(pp_user, l) + 'a' - 'A' %repeat %finish printstring(pp_user) space printsymbol('('); printsymbol(pp_id>>16&255+'0'); printstring(") ") printstring(pp_tcpname) %if length(pp_tcpname) > 6 %start k = k + 1 %if k < 3 %then spaces(22-length(pp_tcpname)) %finish %else %start spaces(6 - length(pp_tcpname)) %if '0' <= pp_console1 <= '9' %start printsymbol('+') printsymbol(pp_console1) printsymbol(pp_console2) %finish %else spaces(3) %finish k = k + 1 %if k >= 4 %then newline %and k = 0 %else spaces(2) %repeat newlines(2) fe count: %cycle i = 0, 1, 4 fe(i) = 0 %repeat %cycle i = 1, 1, n f = (p(i)_id >> 16) & 255 fe(f) = fe(f) + 1 %unless p(i)_tcpname = "null" %repeat %cycle i = 1, 1, 4 %if fe(i) # 0 %start printstring("Fep") write(i, 1) write(fe(i), 3) newline %finish %repeat %finish %else %start printstring("FLAG") write(j, 1) %finish %end %end %of %file