Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to get the No of users using the PDS
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
t_ctaram

New User


Joined: 15 May 2007
Posts: 20
Location: mumbai

PostPosted: Fri Aug 17, 2007 5:06 pm    Post subject: How to get the No of users using the PDS
Reply with quote

I've written a sample rexx to get the no of persons who are using a particular PDS.

Code:

/* REXX */                                               
'ISREDIT MACRO'                                 
ADDRESS ISREDIT                                 
X = OUTTRAP('USERIDS.')                         
"TSO WHOHAS 'myid.REXX.EXEC'"                 
Y = OUTTRAP('OFF')                             
SAY 'No of users using this PDS' USERIDS.0                           
EXIT     


Is this code correct? I'm not getting anything in the output.

Ctaram
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Fri Aug 17, 2007 5:42 pm    Post subject:
Reply with quote

WHOHAS is not an ISPF or TSO command, so I can't tell you why it's not working.

You can use the ISPF service QUERYENQ to get that information.

O.
Back to top
View user's profile Send private message
t_ctaram

New User


Joined: 15 May 2007
Posts: 20
Location: mumbai

PostPosted: Fri Aug 17, 2007 6:00 pm    Post subject:
Reply with quote

hi ofer71,

QUERYENQ is not present in my shop. Iam not aware of how to use it to get the info of no of persons using my PDS.

if i use TSO WHOHAS 'myid.rexx.exec'. iam getting the persons who are using my PDS.

i have doubt in the way iam trapping the output of this command.

is outtrap correctly used in my code or is there any other way to get the data.

thanks
Ctaram.
Back to top
View user's profile Send private message
rajesh-amigos
Currently Banned

New User


Joined: 03 Aug 2007
Posts: 25
Location: India

PostPosted: Fri Aug 17, 2007 6:41 pm    Post subject:
Reply with quote

Hi CTARAM,

I am not very sure how Whohas runs, and i am new to Rexx.
But just a thought...you are displaying Userids.0 which is the length of the array. So if the command Whohas returns a number, then Userids.0 wouldnt show you teh correct number.

Moreover if you run this exec with Trace All, you will get a +++RC (20) +++.

I am not sure whether this will help you, just my 2 pieces of thoughts
Back to top
View user's profile Send private message
t_ctaram

New User


Joined: 15 May 2007
Posts: 20
Location: mumbai

PostPosted: Fri Aug 17, 2007 7:19 pm    Post subject:
Reply with quote

Correct rajesh,

iam getting +++RC (20) +++. when iam using Trace.

But thats the thing i want to know. Why iam getting RC(20) ??

if we use TSO WHOHAS 'myid.rexx.exec' in my TSO command line. It will display who is using the PDS like:

ZTSO001I ALLOCATED SHR TO USER Z100192
ZTSO001I ALLOCATED OLD TO USER Z100230
ZTSO001I ALLOCATED SHR TO USER Z100219
ZTSO001I ALLOCATED SHR TO USER Z100311

How to trap this output ??? Is the Outtrap iam using is correct???

Is there any other way to know who and how many users are using my PDS.

Please suggest.
Back to top
View user's profile Send private message
rajesh-amigos
Currently Banned

New User


Joined: 03 Aug 2007
Posts: 25
Location: India

PostPosted: Fri Aug 17, 2007 7:24 pm    Post subject:
Reply with quote

The Trap is correct.
I am not sure whether Whohas command is a ISPF command or not.
The problem is not with your OUTTRAP. Its with the way you are trying to execute the macro.

Can you tell me What is the significance of 'ISREDIT MACRO' in your code.

Once again, I am telling you, I am a newbie to Rexx. : icon_rolleyes.gif
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Fri Aug 17, 2007 8:55 pm    Post subject:
Reply with quote

QUERYENQ is a standard ISPF service. You can read more about it in the fine manual.

O.
Back to top
View user's profile Send private message
t_ctaram

New User


Joined: 15 May 2007
Posts: 20
Location: mumbai

PostPosted: Fri Aug 17, 2007 9:37 pm    Post subject:
Reply with quote

hi all,

Thanks for your help,

My actual need was to know who is using my PDS and need to tell them to come out of my PDS so that i can perform some specific task on the PDS.

My shop uses WHOHAS to know who is using the PDS. for others it may vary. I think there is also some thing as WHOGOT which is used for the same purpose.

Here is the new code which i have written.

SAY 'PLEASE ENTER THE PDS NAME'
PARSE PULL DSN
X = OUTTRAP('USERIDS.')
"WHOHAS '"DSN"'"
Y = OUTTRAP('OFF')
DO A=1 TO USERIDS.0
USER_ID = WORD(USERIDS.A,6)
SAY 'THE USER WHO IS USING MYPDS IS ' USER_ID
"SEND 'PLEASE COME OUT OF THE PDS" DSN " ' U("USER_ID")"
"SEND 'THIS PDS NEED TO BE EDITED ' U("USER_ID")"
END
EXIT


Now i have a new requirement where the REXX should check whether all the users who are using my PDS came out of PDS ???

for that it need to execute the same code after some duration of time and check USERIDS.0 for confirmation.

Is there some thing in rexx where we can provide some delay ???

Thanks in Advance.

Ctaram
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Aug 17, 2007 9:43 pm    Post subject:
Reply with quote

t_ctaram wrote:
Is there some thing in rexx where we can provide some delay?


Yes. Look at the TIME(R) (Reset) and TIME(E) (Elapsed) functions.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Fri Aug 17, 2007 11:16 pm    Post subject:
Reply with quote

If you can issue SYSCALL commands, have a look at the callable service sleep.

O.
Back to top
View user's profile Send private message
t_ctaram

New User


Joined: 15 May 2007
Posts: 20
Location: mumbai

PostPosted: Sun Aug 19, 2007 4:35 pm    Post subject:
Reply with quote

Hi all,

i have tried something like this and its working fine.

PRESENT_TIME = TIME(S)
SAY PRESENT_TIME
CHECK_TIME = PRESENT_TIME+30
SAY CHECK_TIME
DO FOREVER
NEW_TIME = TIME(S)
IF CHECK_TIME = NEW_TIME THEN LEAVE
END

the above code will wait for 30 secs then do a recheck whether any one accessing my PDS.

if no one accessing then it comes out of the program telling the PDS is free now.

Thanks for your help and support.
CTARAM
Back to top
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 126
Location: UK

PostPosted: Tue Aug 21, 2007 5:59 pm    Post subject: HOW to TRAP USERID in OUTREC
Reply with quote

Hi ,


I have tried the above given code but nothing is coming out in outtrap.

if i am using TSO WHOHAS 'myid.rexx.exec' in my TSO command line. It will display who is using the PDS like:

SHR - TSU=DEVLUSE

How to trap this output ??? Is the Outtrap iam using is correct???
Here is the COde


SAY 'PLEASE ENTER THE PDS NAME'
PARSE PULL DSN
X = OUTTRAP('USERIDS.')
"WHOHAS '"DSN"'"
Y = OUTTRAP('OFF')
DO A=1 TO USERIDS.0
USER_ID = WORD(USERIDS.A,6)
SAY 'THE USER WHO IS USING MYPDS IS ' USER_ID
"SEND 'PLEASE COME OUT OF THE PDS" DSN " ' U("USER_ID")"
"SEND 'THIS PDS NEED TO BE EDITED ' U("USER_ID")"
END
EXIT

If there is any other way to trap userid pleae let me know
Thanks In advance
Back to top
View user's profile Send private message
t_ctaram

New User


Joined: 15 May 2007
Posts: 20
Location: mumbai

PostPosted: Tue Aug 21, 2007 7:04 pm    Post subject:
Reply with quote

hi Amar,

what is the userid in the phrase SHR - TSU=DEVLUSE .is it DEVLUSE ??? .

Please tell me the exact out put you get and the Userid in the output phrase.

Thanks
Ctaram.
Back to top
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 126
Location: UK

PostPosted: Tue Aug 21, 2007 10:34 pm    Post subject:
Reply with quote

Hi Ctaram ,

USER ID is DEVLUSE And the exact output coming is

SHR - TSU=DEVLUSE

Infact when you are submitting tso whohas 'Pdsname' in my TSO command line. It will display who is using the PDS like:

SHR - TSU=DEVLUSE

The problem is that outtrap is not able to trap the output for some reason .
USERIDS.1 is coming as spaces .


Let me know if you need any other information

Thanks
Amar
Back to top
View user's profile Send private message
t_ctaram

New User


Joined: 15 May 2007
Posts: 20
Location: mumbai

PostPosted: Wed Aug 22, 2007 12:04 pm    Post subject: Reply to: How to get the No of users using the PDS
Reply with quote

hi Amar,

try the below code. hope this will work at your site.

SAY 'PLEASE ENTER THE PDS NAME'
PARSE PULL DSN
X = OUTTRAP('USERIDS.')
"WHOHAS '"DSN"'"
Y = OUTTRAP('OFF')
DO A=1 TO USERIDS.0
THIRD = WORD(DATA,3)
NUMBER=LENGTH(THIRD)
USER_ID= SUBSTR(THIRD,5,NUMBER)
SAY 'THE USER WHO IS USING MYPDS IS ' USER_ID
"SEND 'PLEASE COME OUT OF THE PDS" DSN " ' U("USER_ID")"
"SEND 'THIS PDS NEED TO BE EDITED ' U("USER_ID")"
END
EXIT

Note that you should not give codes for the PDS name which you provide as input.

Ctaram
Back to top
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 126
Location: UK

PostPosted: Wed Aug 22, 2007 2:24 pm    Post subject:
Reply with quote

Hello CTARAM ,

I think you do not undersatnd the problem . The changes you have made will work when there is data in the USERIDS.1 . I have displayed the value which is coming as spaces.

The problem is in OUTTRAP STEP
X = OUTTRAP('USERIDS.')
"WHOHAS '"DSN"'"
Y = OUTTRAP('OFF')


As data from TSO WHOHAS is not trapped for any reason .

please let me know if you have any querry

Many Thansk & Regards
Amar
Back to top
View user's profile Send private message
t_ctaram

New User


Joined: 15 May 2007
Posts: 20
Location: mumbai

PostPosted: Wed Aug 22, 2007 3:00 pm    Post subject:
Reply with quote

Hi,

As far as i know the outtrap used is working fine.

Use TRACE for finding out the flow.

note that this REXX is not an ISREDIT Macro.

Ctaram
Back to top
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 126
Location: UK

PostPosted: Wed Aug 22, 2007 3:22 pm    Post subject:
Reply with quote

I have used TRACE and found the same thing that OUTTRAP is not able to trap the out from TSO WHOHAS.

As when i have changed the Code to TSO HRECALL it properly TRAPED the output .

Is there is any constrain on OUTTRAP to capture output of TSO WHOHAS at my shop .

Is there any other way to trap the output of TSO WHOHAS or to get USER ID directly .


Regards
Amar
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Wed Aug 22, 2007 4:26 pm    Post subject:
Reply with quote

As was previously explained - WHOHAS is not a TSO or ISPF command, so you can't expect it to behave as a regular command. You should ask the WHOHAS's developer.

O.
Back to top
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 126
Location: UK

PostPosted: Wed Aug 22, 2007 5:08 pm    Post subject:
Reply with quote

WHOHAS Is working fine but data is nt not trapped in the output
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Free FILE not working for specific users sankalp-goyal CLIST & REXX 12 Mon Apr 25, 2016 6:33 pm
No new posts Find list of all TSO users who used i... newroad CA Products 2 Fri Nov 06, 2015 12:01 am
No new posts Pulling the list of all users in a PS... Kanishk Sinha TSO/ISPF 4 Thu Nov 27, 2014 11:47 am
No new posts Calling Stored Proc with out holding ... rexx77 DB2 6 Mon Nov 03, 2014 7:20 pm
No new posts Get the List of Users Using PD Tools Santty IBM Tools 2 Wed Feb 27, 2013 8:22 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us