|
On 6 Aug 97 at 11:42, Staffan Lofberg wrote: > I am trying to check if another host is active in batch mode. I am > using PING. How can I determine if I get the message TCP3206 in a > CL-program? This should do the trick... although I give no guarantees. I had to dredge this code up from the depths of my brain. DCL VAR(&HOST) TYPE(*CHAR) LEN(256) DCL VAR(&MSG) TYPE(*CHAR) LEN(256) DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(256) DCL VAR(&MSGDTALEN) TYPE(*DEC) LEN(5 0) DCL VAR(&PERCENT) TYPE(*DEC) LEN(3 0) DCL VAR(&WORK) TYPE(*CHAR) LEN(4) PING RMTSYS(&HOST) MSGMODE(*QUIET) MONMSG MSGID(TCP0000) /* handle any monitorable msgs */ RCVMSG MSGQ(*PGMQ) MSGTYPE(*LAST) RMV(*NO) + MSG(&MSG) MSGDTA(&MSGDTA) + MSGDTALEN(&MSGDTALEN) MSGID(&MSGID) + /* grab the last message on the queue */ CHGVAR VAR(&WORK) VALUE(%SST(&MSGDTA 9 4)) + /* extract the connection summary percentage + */ CHGVAR VAR(&PERCENT) VALUE(%BIN(&WORK)) + /* convert it to decimal */ If &PERCENT is greater than 0, then you were able to get a connection... otherwise, the remote host was not responding. If &PERCENT is less than 100, then your connection is not necessarily as stable as you might like it. You might want to add some code to make sure you are receiving message TCP3210, which contains the connection summary. david -- David Gibbs Sr. Software Engineer Silvon Software Westmont, IL (630) 655-3313 x6479 http://www.silvon.com mailto:david.gibbs@silvon.com Opinions expressed are strictly my own and do not necessarily reflect those of my employer ... You'll only see your obstacles each time you take your eyes off of your goal. -- DMRoth * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This is the Midrange System Mailing List! To submit a new message, * * send your mail to "MIDRANGE-L@midrange.com". To unsubscribe from * * this list send email to MAJORDOMO@midrange.com and specify * * 'unsubscribe MIDRANGE-L' in the body of your message. Questions * * should be directed to the list owner / operator: david@midrange.com * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.