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
 

 

Want to know the server is up or down

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
bhim_s

New User


Joined: 19 Sep 2006
Posts: 46
Location: New Delhi

PostPosted: Wed Sep 19, 2007 4:51 pm    Post subject: Want to know the server is up or down
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: 2150
Location: At my coffee table

PostPosted: Wed Sep 19, 2007 4:55 pm    Post subject:
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: New Delhi

PostPosted: Wed Sep 19, 2007 5:10 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Wed Sep 19, 2007 5:14 pm    Post subject:
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: New Delhi

PostPosted: Thu Sep 20, 2007 12:20 pm    Post subject:
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: New Delhi

PostPosted: Thu Sep 20, 2007 1:21 pm    Post subject:
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

Site Director


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

PostPosted: Thu Sep 20, 2007 8:45 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts FTP Server and FTP.DATA vasanthz All Other Mainframe Topics 2 Wed Oct 12, 2016 11:49 pm
No new posts FTP from windows server into Mainfram... sathyajes All Other Mainframe Topics 24 Wed Jul 20, 2016 1:33 pm
No new posts How to perform Digest Access Authenti... vasanthz All Other Mainframe Topics 0 Tue Mar 15, 2016 4:47 pm
No new posts Any Mobile Apps use Mainframe Server? jobseeker All Other Mainframe Topics 2 Wed Feb 24, 2016 3:58 pm
No new posts DB2 Server Configuration for AIX Virendra Shambharkar DB2 2 Tue Nov 17, 2015 3:27 pm


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