ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

PING from /free

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • egami
    replied
    Because I can do what I need with about 12 less lines of code...

    Leave a comment:


  • Scott Klement
    replied
    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:


  • egami
    replied
    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:


  • jamief
    replied
    Re: PING from /free

    CL is for small children & farm animals...

    Leave a comment:


  • kitvb1
    replied
    Re: PING from /free

    Yep... trying to get fit for the 220km (around) Lake Constance Marathon.

    Leave a comment:


  • dhanuxp
    replied
    Re: PING from /free

    Originally posted by kitvb1 View Post
    I'm getting older ... it takes me a while but I'm almost there
    http://www.gpsies.com/map.do?fileId=rnjyypfxmkmwprug
    gosh! was that the "nice little ride" u posted in FB ?

    Leave a comment:


  • kitvb1
    replied
    Re: PING from /free

    Originally posted by dhanuxp View Post
    and Kit is still on his way home....
    I'm getting older ... it takes me a while but I'm almost there

    Leave a comment:


  • dhanuxp
    replied
    Re: PING from /free

    Originally posted by kitvb1 View Post
    I can post you some code when I get home tonight.
    IIRC ... i did it with CL.
    and Kit is still on his way home....

    Leave a comment:


  • ARobb73
    replied
    Re: PING from /free

    Originally posted by jamief View Post
    this does work ... just thought I'd wake the dead thread.
    And just cause:

    Click image for larger version

Name:	deadthrd.jpg
Views:	6
Size:	68.9 KB
ID:	126558

    Leave a comment:


  • jamief
    replied
    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(' +  + %trim(Ipaddress) + ') ' +         
                   
    ' MSGMODE(*VERBOSE *ESCAPE)';                               
       
    cmdlength = %len(%trim(cmdstring));                                     
                                                                               
       
    monitor;    
        
    $command (cmdstringcmdlength);                
        
    PingOk = *on;                                   
       
    on-error;                                        
        
    PingOk = *off;                                  
       
    endmon;                                          
                                                        
       *
    inlr = *on;                                     
                                                        
     /
    End-Free 

    Leave a comment:


  • Huddy
    replied
    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;
    Needs to be in a monitor.

    Cheers

    Huddy
    Last edited by kitvb1; June 21, 2010, 08:25 AM. Reason: added code block using # icon

    Leave a comment:


  • kitvb1
    replied
    Re: PING from /free

    I can post you some code when I get home tonight.
    IIRC ... i did it with CL.

    Leave a comment:


  • Huddy
    started a topic PING from /free

    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

    Huddy
Working...
X