Detecting comms failure connecting to AS/400

  • I'm currently building interfaces which export data to various AS/400s worldwide through SQL Server. Unfortunately some are in areas prone to comms failures and when this occurs, my SQL jobs which connect via Client Access simply hang. I'm trying to find a way of ascertaining whether the AS/400s are available before attempting the login process, but have not yet come across anything which will give me a return value I can interrogate. I desperately need to resolve this one, please help.

  • Can you use ping via ExecuteProcess Task or xp_cmdshell?

    Thanks

    Phill Carter

    --------------------
    Colt 45 - the original point and click interface

  • Thanks for responding Phill. The problem with using ping is I don't know how I can interrogate the response I get. Basically I have several jobs, each of which exports data to several AS/400s. If one of the connections is unavailable the whole job hangs. What I need to be able to do is test each connection as part of the job and if the AS/400 is available login and export the data, otherwise skip over the export and try to connect to the next AS/400. Its a nightmare scenario isn't it?

  • Try something like

    
    
    DECLARE @Err int

    CREATE TABLE #Tmp (
    PingText varchar(255)
    )

    INSERT INTO #Tmp
    EXEC xp_cmdshell 'ping <your server ip address>'

    SELECT @Err = COUNT(*) FROM #Tmp
    WHERE PingText LIKE '%timed out%'
    OR PingText LIKE '%host unreachable%'

    IF @Err > 0
    PRINT 'Server not responding'

    Hope this helps

    Thanks

    Phill Carter

    --------------------
    Colt 45 - the original point and click interface

  • Many thanks Phill for the time you've taken on this. I've been under so much pressure to get this working, I've been exploring all the impossibly difficult options, without seeing the obvious. This is just what I need.

    Thanks again

    Clare

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply