Determine if TSO user is online



High Level Assembler(HLASM) for MVS & VM & VSE

Determine if TSO user is online

Postby steve-myers » Thu Jul 18, 2013 7:14 am

I am trying to write a process to determine if a TSO user is online. I did this something like 30 years ago, and that code is long lost. My recollection is I got an ASCB address from the ASVT, then got the ASXB from the ASVT. I remember I had to do something funky from the ASXB to get the TSO userid, but I don't remember what that was.

Looking through the ASXB I see ASXBUSER, which I don't remember from 30 years ago. ASXBUSER , from its length, does appear to be a TSO userid. My concern is that ASXBUSER reflects a RACF userid for a batch job, which is not what I want. Other than that the code seems to be OK.

Perhaps someone with a fresher memory than mine can help me.
steve-myers
Global moderator
 
Posts: 1886
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: Determine if TSO user is online

 

Re: Determine if TSO user is online

Postby nevilh » Thu Jul 18, 2013 7:50 pm

Hi; I have the same problem as you in as much as I have not done this in a while but could you not take the name from ASCBJBNS and then check with the CSCB to see if it is a TSO address space.

These users thanked the author nevilh for the post:
steve-myers (Wed Jul 24, 2013 1:20 am)
nevilh
 
Posts: 38
Joined: Wed Jun 01, 2011 8:28 pm
Has thanked: 0 time
Been thanked: 3 times

Re: Determine if TSO user is online

Postby Mickeydusaor » Thu Jul 18, 2013 7:57 pm

I have used this in a Rexx to get the actual user name of the actual person logged on

ASCB = STORAGE(224,4) /* PSAAOLD */
ASXB = STORAGE(D2X(C2D(ASCB)+108),4) /* ASCBASXB */
ACEE = STORAGE(D2X(C2D(ASXB)+200),4) /* ACEE */
UNAM = STORAGE(D2X(C2D(ACEE)+100),4) /* ACEEUNAM */
NAME = STRIP(STORAGE(D2X(C2D(UNAM)+1),20))
User avatar
Mickeydusaor
 
Posts: 29
Joined: Fri Feb 24, 2012 11:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Determine if TSO user is online

Postby dick scherrer » Thu Jul 18, 2013 8:14 pm

Hello,

You might get this thru sdsf . . . (da otsu with the proper prefix)?

REXX plays well with sdsf.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Determine if TSO user is online

Postby steve-myers » Thu Jul 18, 2013 9:52 pm

Mickeydusaor: This is fine for the current address space, but if I'm JOHNDOE and I want to see if MARYDOE is online I'm not sure if it will work. Just a few weeks ago I got to my ACEE using the same path you proposed. But is the ACEE in shared storage or address space storage? I don't know and didn't investigate.

Nevilh: I think your idea about using the CSCB is what I did 30 years ago.

Another odd thing: Running as JOHNDOE I found myself, but not MARYDOE, and I know damned well MARYDOE was online. Running as MARYDOE I found JOHNDOE, but not MARYDOE.

I will try the CSCB idea. If I can't persuade that to work I will try GQSCAN for QNAME SYSIKJUA, RNAME the userid. It may take me a few days.

Thank you both.
steve-myers
Global moderator
 
Posts: 1886
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: Determine if TSO user is online

Postby steve-myers » Fri Jul 19, 2013 7:45 am

Thank you all. Nevilh, the CSCB idea worked like a charm. This is the lookup code:
         L     15,CVTPTR           LOAD ADDR OF THE CVT
         L     2,CVTASVT-CVTMAP(,15)  LOAD ADDR OF THE ASVT
         USING ASVT,2              ESTABLISH ASVT ADDRESSABILITY
         L     3,ASVTMAXU          LOAD NUMBER OF ASVT ASCB POINTERS
         LA    2,ASVTENTY          LOAD ADDR OF THE FIRST ASCB POINTER
         DROP  2                   KILL ASVT ADDRESSABILITY
FINDASCB TM    0(2),ASVTAVAL       TEST IF ADDRESS SPACE AVAILABLE
         BO    NEXTASCB            BR IF SO
         L     4,0(,2)             LOAD THE ASCB ADDRESS FROM THE ASVT
         N     4,=A(X'7FFFFFFF')   ISOLATE THE ASCB ADDRESS
         BZ    NEXTASCB            BR IF NO ASCB ADDRESS
         ICM   5,B'1111',ASCBCSCB-ASCB(4)  LOAD ADDR OF THE CSCB
         BZ    NEXTASCB            BR IF NO CSCB
         USING CHAIN,5             ESTABLISH CSCB ADDRESSABILITY
         CLI   CHTRKID,CHTSID      TEST IF TSO USER
         BNE   NEXTASCB            BR IF NOT
         CLC   USERID,CHKEY        TEST USERID
         BE    EXIT                BR IF SO
NEXTASCB LA    2,4(,2)             COMPUTE ADDR OF THE NEXT ASCB ADDR
         BCT   3,FINDASCB          GO CHECK IT
* ALL ASCBS HAVE BEEN EXAMINED, USER NOT FOUND
         MVI   RC,4                SET MY RETURN CODE
         B     EXIT                AND EXIT
RC is preset to 0, so that will be the return code used when the code branches to EXIT after the CLC USERID,CHKEY.

One slightly unexpected issue is CHTRKID in the CSCB does not define bits; it defines 8 bit complete values.
steve-myers
Global moderator
 
Posts: 1886
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: Determine if TSO user is online

Postby steve-myers » Thu Aug 29, 2013 1:52 am

As often happens, once you figure out how to do something for one application it suggests another application. Along the way there turned out to be a way to simplify the FINDASCB loop:
FINDASCB ICM   4,B'1111',0(2)      LOAD POSSIBLE ASCB ADDRESS
         BNP   NEXTASCB            BR IF NO ASCB ADDRESS
The ICM instruction sets the condition code. Most of the time we are just interested in zero or not zero, but it also notices the high order bit.

The original code was
FINDASCB TM    0(2),ASVTAVAL
         BO    NEXTASCB
         L     4,0(,2)
         N     4,=A(X'7FFFFFFF')
         BZ    NEXTASCB


ASVTAVAL is X'80'. so the TM instruction is testing if the high order bit is on. N 4,=A(X'7FFFFFFF') is testing if the remainder of the word is binary 0s.

The ICM instruction sets 3 possible condition codes.
  • B'00' - All inserted bits are 0 (or the mask is B'0000', which is clearly not the case here)
  • B'01' - The leftmost inserted bit is 1 (the remaining bits can be anything)
  • B'10' - The left most inserted bit is 0, and at least one other inserted bit is 1
The condition mask in the BNP instruction is X'D', B'1101'
  • B'1000' - Branch if the condition code is B'00'
  • B'0100' - Branch if the condition code is B'01'
  • B'0001' - Branch if the condition code is B'11'
By using the condition code from the ICM instruction intelligently we can collapse 5 instructions to 2, and avoid 2 storage references: the storage reference for the L instruction (the storage reference in the ICM instruction combined the storage references of the TM instrution and the L instruction) and the storage reference in the N instruction. ICM may be slower than the L instruction, though since we eliminated other instructions, that really doe not matter.

Though it really does not matter for our application, there are some applications where every instruction and (often more important) every storage reference matters.
steve-myers
Global moderator
 
Posts: 1886
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times


Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post