inserting a value into a packed decimal field on AS/400

A

Amaryllis

Hi again,

I'm new to the world of communicating between VB.NET and AS/400, so
I've been posting a lot of questions lately since no one else in the
company has done anything like this before. Hopefully, this one is
fairly simple. I'm trying to insert records into a table on the 400.
I can insert into a packed field that has no decimal places and into
the alphanumeric fields as well. Everything seems to translate
except the values that need to go into a packed decimal field. I've
tried to put decimal, double, and string into them with no luck. Is
there some special kind of conversion I need to do in order to get a
value into those crazy things?

Thanks
 
C

Cor Ligthert

Hi Amaryllis,

This is not the simplest problem, have a look at some of what is written
about this in this newsgroup.

http://tinyurl.com/3dhxm

Otherwise I would check the IBM site in your situation.

I hope this helps

Cor
 
J

Jay B. Harlow [MVP - Outlook]

Amaryllis,
Are you using ADODB or ADO.NET? (your last message was not clear).
Also are you using the OLEDB or ODBC provider for the AS/400?
Is
there some special kind of conversion I need to do in order to get a
value into those crazy things?
There is no special kind of conversions required per se. Both ADODB &
ADO.NET, more accurately the OLEDB & ODBC providers for the AS/400 will
convert the parameters from the PC world into what is required for the
AS/400 world. The trick is to use and define the parameters correctly. I
don't have my notes handy. Zoned & Packed fields map to Numeric & Decimal in
ADODB & ADO.NET. Numeric & Decimal map to Decimal in .NET.

The trick is you need to set the Scale & Precision properties of the
Parameter to match the Scale & Precision of the packed field on the AS/400.

Also remember if you are calling a CL, RPG or COBOL program directly that
packed fields revert to 15 5, you can use the Create Procedure External
Program syntax to define packed fields their true size, if you want to call
a CL, RPG, or COBOL program from the PC...

Hope this helps
Jay

Amaryllis said:
Hi again,

I'm new to the world of communicating between VB.NET and AS/400, so
I've been posting a lot of questions lately since no one else in the
company has done anything like this before. Hopefully, this one is
fairly simple. I'm trying to insert records into a table on the 400.
I can insert into a packed field that has no decimal places and into
the alphanumeric fields as well. Everything seems to translate
except the values that need to go into a packed decimal field. I've
tried to put decimal, double, and string into them with no luck. Is
there some special kind of conversion I need to do in order to get a
value into those crazy things?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top