× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I am a c# newbie. could use some help.

I'm testing a stored procedure I created on the iSeries to be sure it will
return the data to pc network programmers when called.

Below is the code.

The program is working fine to display the data fields until I added the
code for dr.GetiDB2Integer(5).ToString()
This one happens to be a packed data field size 13.2 on the iSeries
database and I haven't found anything on the internet addressing packed
data with regard to C#.
I have a feeling I will have to change this to signed numeric.

The file data fields are defined below also

Any help would be appreciated.

Line Page Dup Case Null Name Type Length Dec
Co Code K01 SECOCD A 2

Agent Number K02 SEAGNT A 10
Insurance Type K03 SETYP A 1
Year Month K05 SEYYMM S 6 0
Period K04 SEPERD A 2
Net Premium SENPRM P 13
2
Rein Prem SERPRM P 13
2
Claims Paid SECLMP P 13
2
Claim Reserve Beg SECRVB P 13 2
Claim Reserve End SECRVE P 13 2 .


using System;
using System.Collections.Generic;
using System.Text;
using IBM.Data.DB2.iSeries;

namespace getRem126SP
{
class Program
{
[STAThread]
static void Main(string[] args)
{
iDB2Connection cn = new iDB2Connection("DataSource=SWBCDEV;
UserID=CRPRDQUA; Naming=System");
cn.Open();
iDB2Command cmd = new iDB2Command("CALL
CRPRDLIBTS/REM126SP()", cn);
//cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.DeriveParameters();

iDB2DataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
Console.WriteLine("{0} {1} {2} {3}{4}",
dr.GetiDB2Char(0).Value,
dr.GetiDB2Char(1).Value,
dr.GetiDB2Char(2).Value,
dr.GetiDB2Char(3).Value,
dr.GetiDB2Char(4).Value,
dr.GetiDB2Integer(5).ToString());
}
dr.Close();
cmd.Dispose();
cn.Close();
}
}
}




Regards,



SWBC
9311 San Pedro Ave., Suite 600
San Antonio, TX 78216

Visit our website at www.swbc.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.