user556373
user556373

Reputation: 23

Communicate with IBM AS400 using FTP/C#/BizTalk

I have to communicate with IBM AS400 system using FTP. Need to issue more than just get and put commands. Essentially need to submit jobs to AS400 using QUOTE RCMD SBMJOB command that will ask AS400 to run some of its programs.

I have two options for communication platform (a) use C# and (b) use BizTalk's FTP adapter.

For C# I have looked at MSDN (http://msdn.microsoft.com/en-us/library/ms229718) but do not see how jobs can be submitted as limited FTP commands are exposed.

For BizTalk Adapter I am not sure how this can be achieved.

Anybody has advice on best way to accomplish this either using C# or BizTalk? Thanks.

Upvotes: 0

Views: 2039

Answers (2)

Doug Griffin
Doug Griffin

Reputation: 43

I assume that you don't have the necessary licensing for the HIS server DB2 adapters as that would be the way to go. Licensing info can be found here

If you must use the FTP adpater you may be able to use:

SYSCMD CALL PGM(MYCLPGM) PARM('MYCLPARM')

instead of the QUOTE command you listed above

Upvotes: 0

Mike Wills
Mike Wills

Reputation: 21275

In C#, you can run stored procedures which can call a CL or RPG program.

Another option is you can call CL command directly in SQL. Here is a generic method I use to do that if I don't expect any data back:

public static bool RunCmd(string cmdText, iDB2Connection cn)
{
    bool rc = true;

    // Construct a string which contains the call to QCMDEXC.
    string pgmParm = String.Format("CALL QSYS/QCMDEXC('{0}', {1})", 
                     cmdText.Replace("'", "''").Trim(), 
                     cmdText.Trim().Length.ToString("0000000000.00000"));

    using (cn)
    {
        using (iDB2Command cmd = new iDB2Command(pgmParm, cn))
        {
            try { cmd.ExecuteNonQuery(); }
            catch { rc = false; }
        }
    }

    // Return success or failure
    return rc;
}

Since FTP might be your easiest option, this short article should help you out.

Upvotes: 1

Related Questions