MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

To Cancel A TSO session

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
Sreejith
Intermediate


Joined: 02 Dec 2002
Posts: 155
Topics: 25
Location: N.Ireland

PostPosted: Mon Dec 02, 2002 8:39 am    Post subject: To Cancel A TSO session Reply with quote

To Cancel A TSO session use the following REXX code. you can opy this to SYSEXEC library and use as a tso command
Code:

/* Rexx */
/* Rexx  - To Logoff from a TSO Session                              */
/*                                                                   */
/* Usage  : TSO KILLME userid                                        */
/* ----------------------------------------------------------------- */
ARG UID
clear
if UID=USERID() then
   Say 'Do you want to logoff from your TSO session (Y/N)'
else
  do
   Say '    !!!!!!     WARNING: This is not Your Userid.     !!!!!!'
   Say '    !!!!!!     WARNING: This is not Your Userid.     !!!!!!'
   Say '    !!!!!!     WARNING: This is not Your Userid.     !!!!!!'
   Say '    !!!!!!     WARNING: This is not Your Userid.     !!!!!!'
   Say '    !!!!!!     WARNING: This is not Your Userid.     !!!!!!'
   Say '                                                           '
   Say 'Are you sure you want to logoff TSO session of' UID '(Y/N)'
  end
PULL ANSWER
if answer='Y' then,
 do
  Say "Logging off TSO Session of " UID
  can_card.1 = "/*$VS,'C U="||UID||"'"
  "FREE ATTRLIST(SBM)"
  "FREE F(SUBMIT)"
  "ATTRIB SBM LRECL(80) RECFM(F)"
  "ALLOC F(SUBMIT) SYSOUT(A) WRITER(INTRDR) USING(SBM)"
  "EXECIO 2 DISKW SUBMIT (STEM can_card. FINIS"
  "FREE ATTRLIST(SBM)"
   "FREE F(SUBMIT)"
  end
 else
    if UID=USERID() then
       Say "Good Boy. Don't logoff. Keep working."
    else
       Say "Good Boy. Don't logoff. Let" UID "working."
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Tue Dec 24, 2002 9:04 am    Post subject: Reply with quote

Hi

I tried this rexx, but my session was not getting logged off(I was trying for my own session, which I am working).. rexx is getting executed but session is still active.. can you pls tell me what the problem is..

Anand
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Tue Dec 24, 2002 9:37 am    Post subject: Reply with quote

Anand,
Here is another way to cancel the userid.The following jcl will give you the desired results.

Code:

//YOUR JOB CARD
//*
//STEP0100 EXEC PGM=IEFBR14
//   COMMAND 'C U=XXXXXXX' 


XXXXXX - Is Your TID

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Thu Dec 26, 2002 4:06 am    Post subject: Reply with quote

Kolusu,

I tried to cancel the session using your jcl.. but not getting cancelled. I was trying from the sam id which I am planning to cancel..

And how to specify particular system name( i mean sys1,sys2,sys3... etc) in that job..

I am pasting my job here..

//G1NX62TE JOB (CEFD-CEFTSOU,020),'CAN SESSION',CLASS=9,
// MSGCLASS=X,NOTIFY=&SYSUID
//*
//STEP0100 EXEC PGM=IEFBR14
// COMMAND 'C U=G1NX62T'
Back to top
View user's profile Send private message
DaveyC
Moderator


Joined: 02 Dec 2002
Posts: 151
Topics: 3
Location: Perth, Western Australia

PostPosted: Thu Dec 26, 2002 7:55 am    Post subject: Reply with quote

Your systems programmers can turn off system commands from JCL input streams. And for good reason...
_________________
Dave Crayford
Back to top
View user's profile Send private message Send e-mail
faisal
Beginner


Joined: 05 Dec 2002
Posts: 8
Topics: 1

PostPosted: Fri Dec 27, 2002 1:17 pm    Post subject: Reply with quote

You should use the batch SDSF job for cancelling your id. I wrote a small java tool to run on the PC. It cancels a user-id by submitting a batch sdsf job via FTP. That way you won't need to login with another userid to submit the cancel jcl. If interested I can send the source code via email.
Back to top
View user's profile Send private message
naveen
Beginner


Joined: 03 Dec 2002
Posts: 90
Topics: 31

PostPosted: Tue Dec 31, 2002 10:06 am    Post subject: Reply with quote

I don't know whether it works everywhere or not, Atleast on my installation , for terminating a TSO session ,you only need to write a '\t' on any command line ,and my TSO session get killed.
Back to top
View user's profile Send private message Send e-mail
dorkhead
Beginner


Joined: 07 Jan 2003
Posts: 25
Topics: 0
Location: Lux

PostPosted: Tue Jan 07, 2003 11:56 am    Post subject: Reply with quote

try this bit of code :
Code:

 /* rexx */                   
 arg uzr                     
 if uzr='' then uzr=userid() 
  queue 'c u='uzr             
  queue 'end'                 
  oper

_________________
Dorkhead
Back to top
View user's profile Send private message Visit poster's website
cilesiz
Beginner


Joined: 08 Jan 2003
Posts: 1
Topics: 0

PostPosted: Wed Jan 08, 2003 1:59 am    Post subject: Reply with quote

Or try it with SDSF:

Code:
/* Rexx KANCEL                                               
 !                                                           
 !  Data Set   : RE03063.MACRO.EXEC(KANCEL)                   
 !  Name       : Ugur Cilesiz                                 
 !  Date       : 08.01.2003                                   
 !  Parameter  : UserId                                       
 !  Description: CANCEL User from TSO or ISPF- Session       
 !                                                           
 !               TSO %KANCEL UserId                           
 */                                                           
Arg User_ID                                                         
If User_Id = ''                                                     
   Then User_ID = Userid()                                           
"CLEAR"                                                             
If User_ID <> Userid()                                               
   Then Do                                                           
           Say ' !!   ACHTUNG: WOLLEN SIE WIRKLICH USER = '!! User_ID
           Say ' !!            CANCELN ???????'                     
           Say ' '                                                   
           Say ' !!   C U='!! User_ID ' (Y/N) ?'                     
        Pull Antwort                                                 
        If Antwort = 'Y'                                             
           Then Do                                                   
                Signal DoIt                                         
                End                                                 
           Else Signal Exitus                                       
        End                                                         
DoIt:                                                               
  SDSFCMD = "/C U=" !! User_ID                                       
  "ISPEXEC SELECT PGM(ISFISP) PARM("SDSFCMD")"                       
Exitus:                                                             
  Exit
Back to top
View user's profile Send private message
satyajit_datta
Beginner


Joined: 03 Oct 2004
Posts: 5
Topics: 1

PostPosted: Wed Feb 04, 2009 5:11 am    Post subject: Reply with quote

//YOUR JOB CARD
//*
//STEP0100 EXEC PGM=IEFBR14
// COMMAND 'C U=XXXXXXX'

Works fine.

Can anyone explain how it works.
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Wed Feb 04, 2009 8:12 am    Post subject: Reply with quote

What you are doing is running a job. A job needs a step to execute hence the IEFBR14. As you know, IEFBR14 does not do anythig itself. However, the work is done by the COMMAND keyword which is executed at job execution time and issues the command to the OS (c u=userid)
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
bob_buxton
Beginner


Joined: 20 Dec 2002
Posts: 44
Topics: 0
Location: Hampshire, England

PostPosted: Wed Feb 04, 2009 10:21 am    Post subject: Reply with quote

Nic Clouston wrote:
What you are doing is running a job. A job needs a step to execute hence the IEFBR14. As you know, IEFBR14 does not do anythig itself. However, the work is done by the COMMAND keyword which is executed at job execution time and issues the command to the OS (c u=userid)


Actually the COMMAND is processed at JCL interpretation time not when the job actually executes.

If you ran a multistep Job

/YOUR JOB CARD
//*
//STEP0100 EXEC PGM=WAIT1HR
//STEP0200 EXEC PGM=IEFBR14
// COMMAND 'C U=XXXXXXX'

The command would be executed before the Wait an hour program and not after it has run.

In a production environment it is very dangerous to allow any user to cancel jobs or issue other operator commands so the use of Commands in JCL is usually banned.
_________________
Bob Buxton
Ex Websphere MQ for zOS development
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Wed Feb 04, 2009 3:10 pm    Post subject: Reply with quote

I suspected that it would be at interpretation time but was not sure so erred on the side of caution. Anyway, I hope Satyajit understands what is happening.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group