Announcement
Collapse
No announcement yet.
PING from /free
Collapse
X
-
Can you explain why you are using SQL? This seems like an odd thing to do since you're in an RPG program that can easily call QCMDEXC directly (like the earlier examples in the thread) and elimimate the extra complexity of having SQL involved.
Leave a comment:
-
I was searching on QCMDEXC w/ PING and this thread came up among others. I stumbled into using SQL call to invoke ping and I like this new method of invoking QCMDEXC, but hoping someone can clarify something for me.
In the example below I can use SQLCOD to check whether ping is successful, but the monitor statement does not. It seems to maybe just be verifying that invoking the command worked?
PHP Code:monitor;
exec sql CALL QSYS2.QCMDEXC
( 'PING RMTSYS(WWW.IBM.COM) MSGMODE(*VERBOSE *ESCAPE)' );
// this does not work to test valid ping
PingOk = *on;
on-error;
PingOk = *off;
endmon;
// this works to test valid ping
if SQLCOD = 0;
PingOk = *on;
endIf;
Leave a comment:
-
Re: PING from /free
Yep... trying to get fit for the 220km (around) Lake Constance Marathon.
Leave a comment:
-
Re: PING from /free
Originally posted by kitvb1 View PostI'm getting older ... it takes me a while but I'm almost there
http://www.gpsies.com/map.do?fileId=rnjyypfxmkmwprug
Leave a comment:
-
Re: PING from /free
Originally posted by dhanuxp View Postand Kit is still on his way home....
Leave a comment:
-
Re: PING from /free
this does work ... just thought I'd wake the dead thread.
I needed this because of tracking machines on the shop floor using LXE wireless devices.
when the LXE unit {EXPLODES} and a substitute is put into production, I needed a way
to automatically check to see if the unit is active. There is much more code involved but this
is the core.
PHP Code:
d cmdlength s 15 5
d cmdstring s 512
d*ipaddress s 13 inz('10.0.10.128')
d ipaddress s 13 inz('10.0.10.199')
d pingOK s n
d Q s 1 inz('''')
d $command pr extpgm('QCMDEXC')
d command 512
d Length 15 5
/Free
cmdstring = 'PING RMTSYS(' + Q + %trim(Ipaddress) + Q + ') ' +
' MSGMODE(*VERBOSE *ESCAPE)';
cmdlength = %len(%trim(cmdstring));
monitor;
$command (cmdstring: cmdlength);
PingOk = *on;
on-error;
PingOk = *off;
endmon;
*inlr = *on;
/End-Free
Leave a comment:
-
Re: PING from /free
tis okay , i found this..
Code:monitor; QCMDEXC( 'PING RMTSYS([URL="http://www.ibm.com/"]WWW.IBM.COM[/URL]) MSGMODE(*VERBOSE *ESCAPE)' : 51 ); PingOk = *on; on-error; PingOk = *off; endmon;
Cheers
Huddy
Leave a comment:
-
Re: PING from /free
I can post you some code when I get home tonight.
IIRC ... i did it with CL.
Leave a comment:
-
PING from /free
Hi, Can someone post me an example of a PING from rpg free which has error trapping. i.e. PING not successful.
I guess it's using the QCMDEXC.. in fact how do you monitor for errors when using this command?
Thanks
HuddyTags: None
Leave a comment: