\n is the newline seperator. For example:
Console.WriteLine("{0}\n {1}\n {2}\n {3}\n{4}\n",
dr.GetiDB2Char(0).Value,
dr.GetiDB2Char(1).Value,
dr.GetiDB2Char(2).Value,
dr.GetiDB2Char(3).Value,
dr.GetiDB2Char(4).Value,
dr.GetiDB2Integer(5).ToString());
\t is a tab if that is more what you're chasing?
HTH,
BC
----- Original Message -----
From: DLee
Sent: 29/10/2009 04:39 AM
To: systemidotnet@xxxxxxxxxxxx
Subject: Re: [SystemiDotNet] C# code help
Thanks John;
<You need the iDB2Decimal data type. Sorry, away from computer right now,
so
cannot provide example code.
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());>
That did the trick, and displayed the data I wanted to show.
I'm suprised I didn't notice the iDB2Decimal data type.
I want to add other fields to the display, I'm using a console
application, can you suggest how to cause the fields to separate?
All the fields in the display are running together.
I tried pading to right, but got an argument error.
Again, thanks for your help.
Darrell
Regards,
SWBC
9311 San Pedro Ave., Suite 600
San Antonio, TX 78216
Visit our website at www.swbc.com
systemidotnet-request@xxxxxxxxxxxx
Sent by: systemidotnet-bounces@xxxxxxxxxxxx
10/28/2009 12:02 PM
Please respond to
systemidotnet@xxxxxxxxxxxx
To
systemidotnet@xxxxxxxxxxxx
cc
Subject
SystemiDotNet Digest, Vol 3, Issue 60
Send SystemiDotNet mailing list submissions to
systemidotnet@xxxxxxxxxxxx
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.midrange.com/mailman/listinfo/systemidotnet
or, via email, send a message with subject or body 'help' to
systemidotnet-request@xxxxxxxxxxxx
You can reach the person managing the list at
systemidotnet-owner@xxxxxxxxxxxx
When replying, please edit your Subject line so it is more specific
than "Re: Contents of SystemiDotNet digest..."
Today's Topics:
1. C# code help (DLee@xxxxxxxx)
2. Re: C# code help (John Taylor)
----------------------------------------------------------------------
message: 1
date: Tue, 27 Oct 2009 13:14:43 -0500
from: DLee@xxxxxxxx
subject: [SystemiDotNet] C# code help
I am a c# newbie. could use some help.
I'm testing a stored procedure I created on the iSeries to insure 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,
Darrell
SWBC
9311 San Pedro Ave., Suite 600
San Antonio, TX 78216
Visit our website at www.swbc.com
------------------------------
message: 2
date: Tue, 27 Oct 2009 14:09:59 -0600
from: "John Taylor" <lists@xxxxxxxxxxxxxxxxxxxx>
subject: Re: [SystemiDotNet] C# code help
You need the iDB2Decimal data type. Sorry, away from computer right now,
so
cannot provide example code.
-----Original Message-----
From: systemidotnet-bounces@xxxxxxxxxxxx [mailto:systemidotnet-
bounces@xxxxxxxxxxxx] On Behalf Of DLee@xxxxxxxx
Sent: Tuesday, October 27, 2009 12:15 PM
To: systemidotnet@xxxxxxxxxxxx
Subject: [SystemiDotNet] C# code help
I am a c# newbie. could use some help.
I'm testing a stored procedure I created on the iSeries to insure 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,
Darrell
SWBC
9311 San Pedro Ave., Suite 600
San Antonio, TX 78216
Visit our website at www.swbc.com
------------------------------
_______________________________________________
SystemiDotNet mailing list
SystemiDotNet@xxxxxxxxxxxx
http://lists.midrange.com/mailman/listinfo/systemidotnet
End of SystemiDotNet Digest, Vol 3, Issue 60
********************************************
As an Amazon Associate we earn from qualifying purchases.