IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Want to know the server is up or down


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bhim_s

New User


Joined: 19 Sep 2006
Posts: 46
Location: Australia

PostPosted: Wed Sep 19, 2007 4:51 pm
Reply with quote

Hi!!

i want to use the tso ping command in rexx to check whether the server is up or down. if it is UP then fine else it should go in sleep mode for 10 seconds and then again check the server is up or down. process will go four times in the loop till the sever is not up. After the loop it will display the final msg if it is UP or DOWN.

My plan was to capture the return code from the ping command to check the server and work accordingly but every time it is returning a rc = 0

Below my code :
Code:
/*REXX*/                                                                         
trace I                                             
say 'Enter host name or address'                   
pull addr                                           
PING addr                                           
say "rc" rc                                         
do digit=1 to 4                                     
if RC = 4 then                                     
   do                                               
       say 'server is not up trying to reconnect...'
       PING addr                                   
       SAY 'RETURN CODE' RC                         
   end                                             
else                                               
   do                                               
       say 'server is up'                           
       SAY 'RETURN CODE' RC
       exit RC             
   end                     
end                         
trace n                     
exit RC         
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Sep 19, 2007 4:55 pm
Reply with quote

I can barely spell REXX, but where is the "sleep" and what is the "exit RC"?
Back to top
View user's profile Send private message
bhim_s

New User


Joined: 19 Sep 2006
Posts: 46
Location: Australia

PostPosted: Wed Sep 19, 2007 5:10 pm
Reply with quote

i have not done the coding for sleep mode yet ... that i will do after checking the server. Exit rc -- i feel it will exit from execution and throw the return code of the last executed statement. please correct me if i am wrong
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Sep 19, 2007 5:14 pm
Reply with quote

Seems to me that it will exit the first time it gets executed...the first time the RC is not 4.....
Code:
else                                               
   do                                               
       say 'server is up'                           
       SAY 'RETURN CODE' RC
       exit RC             
   end                     
end 
Back to top
View user's profile Send private message
bhim_s

New User


Joined: 19 Sep 2006
Posts: 46
Location: Australia

PostPosted: Thu Sep 20, 2007 12:20 pm
Reply with quote

Yes, when the code is executed every time it is throwing rc =0

Code:
CS V1R7: Pinging host XXFTP.AAAA.COM (151.nnn.nnn.nnn)
Ping #1 response took 0.016 seconds.                     
     7 *-* say "rc" rc                                   
       >L>   "rc"                                         
       >V>   "0"                                         
       >O>   "rc 0"                                       
rc 0    


Even if i put the wrong IP. it returns 0.

This is what i have tried i am not sure if e'm on the right track.
Would be great if you can guide me ... how can i check the sever if it is up or down.
Back to top
View user's profile Send private message
bhim_s

New User


Joined: 19 Sep 2006
Posts: 46
Location: Australia

PostPosted: Thu Sep 20, 2007 1:21 pm
Reply with quote

One more thing i come to know if I specify IP : 120.111.10.0 then it returns 4 if I specify IP:10.188.9.0 it returns 0 both are invalid IP for me.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Sep 20, 2007 8:45 pm
Reply with quote

Hello,

It may be that the "ping" command executed "successfully" even though it could not find the named host (i've not ping'ed from the mainframe, so i don't know how it responds). This may also be true when the ping times out. You may need to look into looking at the response from the ping and then determining if the server was up.

I believe there are 3 conditions to look for:
1. invalid name or ip address
2. request timed out
3. request successful
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Z Monitoring server fails to start IBM Tools 1
No new posts FTP datasets to server CLIST & REXX 13
No new posts Anyone using the HTTP server, web app... All Other Mainframe Topics 0
No new posts Using Virtual Tape Server TS7700 as c... All Other Mainframe Topics 0
No new posts SMF logging in RDT server - Steps inv... PL/I & Assembler 1
Search our Forums:

Back to Top