ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Ping Error

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

  • Ping Error

    eval ip ='111.22.3.444'
    eval cmd = 'PING RMTSYS('+ip+')'
    eval size = %len(trim(cmd))
    call 'QCMDEXC'
    parm cmd
    parm size

    while execution the pgm it ocurs the foling error CPD0020 - Character '.' not valid following string '111.22 '.

    Dos anyone knows how can i fix this?

  • #2
    Re: Ping Error

    Hi

    Try

    eval cmd = 'PING RMTSYS(''' + ip + ''')'
    LP Zdenko

    Comment


    • #3
      Re: Ping Error

      Try in CL program

      PING RMTSYS(IP ADDRESS)
      Error 1: TCP2670: TCP/IP Services not available.
      Error 2: TCP3213: Cannot reach remote system.
      Thanx
      satish
      Anyone who has never made mistake has never tried anything new.

      Comment


      • #4
        Re: Ping Error

        eval size = %len(%trim(cmd))


        However you'd be better off with a robust prototyped call to avoid errors. See below.
        Code:
        d qcmdexc         pr                  ExtPgm('QCMDEXC') 
        d                              256a   Options(*Varsize) 
        d                                     Const             
        d                               15p 5 Const             
        
        d cmd             s            256a   varying inz
          /free
        
            cmd = 'PING RMTSYS('+ip+')';
            callp(e) qcmdexc ( %trim( cmd ) : %len( %trim( cmd ) ) ); 
            if %error; 
               ....
            endif;
        Philippe

        Comment


        • #5
          Re: Ping Error

          in a nut shell. the IP address must be enclosed in quotes. Everybody was showing you but not saying it.

          ping rmtsys('192.168.1.10')

          that is you cmd.
          Have a good one.
          Bill
          "A good friend will bail you out of jail,
          A true friend would be sitting beside you saying,
          'Wow, that was fun.'"

          Comment

          Working...
          X