Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5979281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:38:14+00:00 2026-05-22T21:38:14+00:00

I am trying to call an RPG program on our AS/400 machine using OleDb.

  • 0

I am trying to call an RPG program on our AS/400 machine using OleDb. As soon as there are more complex types such as dates and decimals I seem to be getting the following error:

The data value could not be converted for reasons other than sign mismatch or data overflow. For example, the data was corrupted in the data store but the row was still retrievable.

Here is the code that produces the problem:

            //            'p_refno                     9a     ()
        //'p_projdat                   *date (output parm)
        //'p_amount                    13p, 2 (output parm)
        //'p_rtnsts                    1a (output parm)
        using (OleDbConnection cn = new OleDbConnection("Provider=IBMDA400;Data Source=MyAs400;User ID=MyUser;Password=MyPassword;"))
        {
            cn.Open();
            OleDbCommand cmd = new OleDbCommand("{{call PGMLIB.MYPROGRAM(?,?,?,?,?,?,?)}}", cn);
            cmd.CommandType = System.Data.CommandType.Text;

            OleDbParameter p_refno = new OleDbParameter("p_refno","ED4565654");
            OleDbParameter p_projdat = new OleDbParameter("p_projdat", new DateTime());
            p_projdat.Direction = System.Data.ParameterDirection.Output;
            p_projdat.Size = 8;
            OleDbParameter p_amount = new OleDbParameter("p_amount", new Decimal());
            p_amount.Direction = System.Data.ParameterDirection.Output;
            OleDbParameter p_rtnsts = new OleDbParameter("p_rtnsts", " ");
            p_rtnsts.Direction = System.Data.ParameterDirection.Output;
            p_rtnsts.Size = 1;
            p_amount.DbType = System.Data.DbType.Decimal;
            cmd.Parameters.Add(p_refno);
            cmd.Parameters.Add(p_mode);
            cmd.Parameters.Add(p_source);
            cmd.Parameters.Add(p_type);
            cmd.Parameters.Add(p_projdat);
            cmd.Parameters.Add(p_amount);
            cmd.Parameters.Add(p_rtnsts);
            cmd.ExecuteNonQuery();
            Console.WriteLine(p_projdat.Value.ToString());
            Console.WriteLine(p_amount.Value.ToString());
            Console.WriteLine(p_rtnsts.Value.ToString());

        }
        Console.WriteLine("Press any key to quit...");
        Console.ReadKey();

What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:38:15+00:00Added an answer on May 22, 2026 at 9:38 pm

    If you can, use the IBM i Access ADO.NET drivers and place the program call in a stored procedure. They can convert the data from i to PC.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to call an external stored procedure (calls an RPG program). I
I am trying to call a webservice using ssl. How do i get the
I'm trying to call a php webservice using WCF. I googled some public php
While trying to call an EJB made using NETbeans (using jdk1.7) from a client
Trying to call from an android client, using the signpost oauth libs. I generated
Im trying to call functions with same signature. Example: There are two functions with
I'm trying to call a C# method from JavaScript by using ActiveXObject : var
I'm trying the call the label 'LBL' using MOV to BX @loop: MOV [bx],
I'm trying to call the Recurly REST API using the Hammock C# library for
Been trying to call Preferences.java class using: Intent settingsActivity = new Intent(getBaseContext(), Preferences.class); startActivity(settingsActivity);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.